LCOV - code coverage report
Current view: top level - lib/CodeGen/GlobalISel - CombinerHelper.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 0 13 0.0 %
Date: 2018-09-23 13:06:45 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //== ---lib/CodeGen/GlobalISel/GICombinerHelper.cpp --------------------- == //
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : #include "llvm/CodeGen/GlobalISel/CombinerHelper.h"
      10             : #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
      11             : #include "llvm/CodeGen/GlobalISel/Utils.h"
      12             : #include "llvm/CodeGen/MachineInstr.h"
      13             : #include "llvm/CodeGen/MachineRegisterInfo.h"
      14             : 
      15             : #define DEBUG_TYPE "gi-combine"
      16             : 
      17             : using namespace llvm;
      18             : 
      19           0 : CombinerHelper::CombinerHelper(MachineIRBuilder &B) :
      20           0 :   Builder(B), MRI(Builder.getMF().getRegInfo()) {}
      21             : 
      22           0 : bool CombinerHelper::tryCombineCopy(MachineInstr &MI) {
      23           0 :   if (MI.getOpcode() != TargetOpcode::COPY)
      24             :     return false;
      25           0 :   unsigned DstReg = MI.getOperand(0).getReg();
      26           0 :   unsigned SrcReg = MI.getOperand(1).getReg();
      27           0 :   LLT DstTy = MRI.getType(DstReg);
      28             :   LLT SrcTy = MRI.getType(SrcReg);
      29             :   // Simple Copy Propagation.
      30             :   // a(sx) = COPY b(sx) -> Replace all uses of a with b.
      31           0 :   if (DstTy.isValid() && SrcTy.isValid() && DstTy == SrcTy) {
      32           0 :     MI.eraseFromParent();
      33           0 :     MRI.replaceRegWith(DstReg, SrcReg);
      34           0 :     return true;
      35             :   }
      36             :   return false;
      37             : }
      38             : 
      39           0 : bool CombinerHelper::tryCombine(MachineInstr &MI) {
      40           0 :   return tryCombineCopy(MI);
      41             : }

Generated by: LCOV version 1.13