diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-08-08 05:04:59 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-08-08 05:04:59 +0000 |
commit | c98af3370f899a0d1570b1dff01a2e36632f884f (patch) | |
tree | 6c3608f5e6e1d1822d0cb67adae4de8fa837e410 /lib/CodeGen/OptimizeCmps.cpp | |
parent | be04fdeb6c46e92fdeda7535c5912d072eff008c (diff) |
Use the "isCompare" machine instruction attribute instead of calling the
relatively expensive comparison analyzer on each instruction. Also rename the
comparison analyzer method to something more in line with what it actually does.
This pass is will eventually be folded into the Machine CSE pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/OptimizeCmps.cpp')
-rw-r--r-- | lib/CodeGen/OptimizeCmps.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/OptimizeCmps.cpp b/lib/CodeGen/OptimizeCmps.cpp index 5b524cd641..209c8b9504 100644 --- a/lib/CodeGen/OptimizeCmps.cpp +++ b/lib/CodeGen/OptimizeCmps.cpp @@ -72,9 +72,8 @@ bool OptimizeCmps::OptimizeCmpInstr(MachineInstr *MI, MachineBasicBlock *MBB) { // physical register, we can try to optimize it. unsigned SrcReg; int CmpValue; - if (!TII->isCompareInstr(MI, SrcReg, CmpValue) || - TargetRegisterInfo::isPhysicalRegister(SrcReg) || - CmpValue != 0) + if (!TII->AnalyzeCompare(MI, SrcReg, CmpValue) || + TargetRegisterInfo::isPhysicalRegister(SrcReg) || CmpValue != 0) return false; MachineRegisterInfo::def_iterator DI = MRI->def_begin(SrcReg); @@ -83,7 +82,7 @@ bool OptimizeCmps::OptimizeCmpInstr(MachineInstr *MI, MachineBasicBlock *MBB) { return false; // Attempt to convert the defining instruction to set the "zero" flag. - if (TII->convertToSetZeroFlag(&*DI, MI)) { + if (TII->ConvertToSetZeroFlag(&*DI, MI)) { ++NumEliminated; return true; } @@ -104,7 +103,8 @@ bool OptimizeCmps::runOnMachineFunction(MachineFunction &MF) { for (MachineBasicBlock::iterator MII = MBB->begin(), ME = MBB->end(); MII != ME; ) { MachineInstr *MI = &*MII++; - Changed |= OptimizeCmpInstr(MI, MBB); + if (MI->getDesc().isCompare()) + Changed |= OptimizeCmpInstr(MI, MBB); } } |