aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-08-08 05:04:59 +0000
committerBill Wendling <isanbard@gmail.com>2010-08-08 05:04:59 +0000
commitb38c700c87bd03e5271a8e2e86b7fb5b3060b55e (patch)
tree6c3608f5e6e1d1822d0cb67adae4de8fa837e410 /lib/CodeGen
parentc536adf751e8b0bcd5cfad42ebbc0e50a0e7c597 (diff)
downloadexternal_llvm-b38c700c87bd03e5271a8e2e86b7fb5b3060b55e.zip
external_llvm-b38c700c87bd03e5271a8e2e86b7fb5b3060b55e.tar.gz
external_llvm-b38c700c87bd03e5271a8e2e86b7fb5b3060b55e.tar.bz2
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')
-rw-r--r--lib/CodeGen/OptimizeCmps.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/OptimizeCmps.cpp b/lib/CodeGen/OptimizeCmps.cpp
index 5b524cd..209c8b9 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);
}
}