No need to recompute the SrcReg and CmpValue.
authorBill Wendling <isanbard@gmail.com>
Fri, 10 Sep 2010 23:46:12 +0000 (23:46 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 10 Sep 2010 23:46:12 +0000 (23:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113666 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetInstrInfo.h
lib/CodeGen/PeepholeOptimizer.cpp
lib/Target/ARM/ARMBaseInstrInfo.cpp
lib/Target/ARM/ARMBaseInstrInfo.h

index c0baec3808c8bb4edef6d2cf5beadc9e4d1c42c4..29fbe8217fe37dc0ea2448d0df0db38cffdec322 100644 (file)
@@ -589,6 +589,7 @@ public:
   /// the comparison into one that sets the zero bit in the flags
   /// register. Update the iterator *only* if a transformation took place.
   virtual bool ConvertToSetZeroFlag(MachineInstr * /*CmpInstr*/,
+                                    unsigned /*SrcReg*/, int /*CmpValue*/,
                                     MachineBasicBlock::iterator &) const {
     return false;
   }
index 7a1bf4050dfebee628b1b8c3ea6a4c894cdb3a0b..529f994f0032a2fa676b3f9166ba0cfb9e7152bd 100644 (file)
@@ -244,7 +244,7 @@ bool PeepholeOptimizer::OptimizeCmpInstr(MachineInstr *MI,
     return false;
 
   // Attempt to convert the defining instruction to set the "zero" flag.
-  if (TII->ConvertToSetZeroFlag(MI, NextIter)) {
+  if (TII->ConvertToSetZeroFlag(MI, SrcReg, CmpValue, NextIter)) {
     ++NumEliminated;
     return true;
   }
index a73e7ad44db937024421efd3b7ad73d43ba42b9c..d79905a80b935cd3d7a22aec59b18afed954ce70 100644 (file)
@@ -1381,11 +1381,9 @@ AnalyzeCompare(const MachineInstr *MI, unsigned &SrcReg, int &CmpValue) const {
 /// comparison into one that sets the zero bit in the flags register. Update the
 /// iterator *only* if a transformation took place.
 bool ARMBaseInstrInfo::
-ConvertToSetZeroFlag(MachineInstr *CmpInstr,
+ConvertToSetZeroFlag(MachineInstr *CmpInstr, unsigned SrcReg, int CmpValue,
                      MachineBasicBlock::iterator &MII) const {
-  unsigned SrcReg;
-  int CmpValue;
-  if (!AnalyzeCompare(CmpInstr, SrcReg, CmpValue) || CmpValue != 0)
+  if (CmpValue != 0)
     return false;
 
   MachineRegisterInfo &MRI = CmpInstr->getParent()->getParent()->getRegInfo();
index 2be0d3687d28b68f42fdc86a303343f2e62d4863..e76e2fe4023ea2a5410ceac49091ff9bc378d68c 100644 (file)
@@ -346,7 +346,8 @@ public:
 
   /// ConvertToSetZeroFlag - Convert the instruction to set the zero flag so
   /// that we can remove a "comparison with zero".
-  virtual bool ConvertToSetZeroFlag(MachineInstr *CmpInstr,
+  virtual bool ConvertToSetZeroFlag(MachineInstr *CmpInstr, unsigned SrcReg,
+                                    int CmpValue,
                                     MachineBasicBlock::iterator &MII) const;
 
   virtual unsigned getNumMicroOps(const MachineInstr *MI,