summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PeepholeOptimizer.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-09-10 23:34:19 +0000
committerBill Wendling <isanbard@gmail.com>2010-09-10 23:34:19 +0000
commit041230014cfcac43b7a7204ee5ef8c4dd42f599e (patch)
tree6b171bdbbad3dab9f73532c5ce394431424f9e33 /llvm/lib/CodeGen/PeepholeOptimizer.cpp
parenta8bac37bb1141f046286e2f246a4ecc470509a46 (diff)
downloadbcm5719-llvm-041230014cfcac43b7a7204ee5ef8c4dd42f599e.tar.gz
bcm5719-llvm-041230014cfcac43b7a7204ee5ef8c4dd42f599e.zip
Move some of the decision logic for converting an instruction into one that sets
the 'zero' bit down into the back-end. There are other cases where this logic isn't sufficient, so they should be handled separately. llvm-svn: 113665
Diffstat (limited to 'llvm/lib/CodeGen/PeepholeOptimizer.cpp')
-rw-r--r--llvm/lib/CodeGen/PeepholeOptimizer.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
index a4ff04bec1c..7a1bf4050df 100644
--- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp
+++ b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
@@ -240,16 +240,11 @@ bool PeepholeOptimizer::OptimizeCmpInstr(MachineInstr *MI,
unsigned SrcReg;
int CmpValue;
if (!TII->AnalyzeCompare(MI, SrcReg, CmpValue) ||
- TargetRegisterInfo::isPhysicalRegister(SrcReg) || CmpValue != 0)
- return false;
-
- MachineRegisterInfo::def_iterator DI = MRI->def_begin(SrcReg);
- if (llvm::next(DI) != MRI->def_end())
- // Only support one definition.
+ TargetRegisterInfo::isPhysicalRegister(SrcReg))
return false;
// Attempt to convert the defining instruction to set the "zero" flag.
- if (TII->ConvertToSetZeroFlag(&*DI, MI, NextIter)) {
+ if (TII->ConvertToSetZeroFlag(MI, NextIter)) {
++NumEliminated;
return true;
}
OpenPOWER on IntegriCloud