[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Feb 23 01:43:01 PST 2004
Changes in directory llvm/lib/Target/X86:
InstSelectSimple.cpp updated: 1.172 -> 1.173
---
Log message:
Simplify code a bit, don't go off the end of the block, now that the current
block we are in might be empty
---
Diffs of the changes: (+9 -11)
Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.172 llvm/lib/Target/X86/InstSelectSimple.cpp:1.173
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.172 Mon Feb 23 01:29:45 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp Mon Feb 23 01:42:19 2004
@@ -682,7 +682,6 @@
const TargetInstrInfo &TII = TM.getInstrInfo();
for (MachineFunction::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
- bool UsesFPReg = false;
for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end(); I!=E; ++I)
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
if (I->getOperand(i).isRegister()) {
@@ -695,16 +694,15 @@
// If we haven't found an FP register use or def in this basic block, check
// to see if any of our successors has an FP PHI node, which will cause a
// copy to be inserted into this block.
- if (!UsesFPReg)
- for (succ_const_iterator SI = succ_begin(BB->getBasicBlock()),
- E = succ_end(BB->getBasicBlock()); SI != E; ++SI) {
- MachineBasicBlock *SBB = MBBMap[*SI];
- for (MachineBasicBlock::iterator I = SBB->begin();
- I != SBB->end() && I->getOpcode() == X86::PHI; ++I) {
- if (RegMap.getRegClass(I->getOperand(0).getReg())->getSize() == 10)
- goto UsesFPReg;
- }
+ for (succ_const_iterator SI = succ_begin(BB->getBasicBlock()),
+ E = succ_end(BB->getBasicBlock()); SI != E; ++SI) {
+ MachineBasicBlock *SBB = MBBMap[*SI];
+ for (MachineBasicBlock::iterator I = SBB->begin();
+ I != SBB->end() && I->getOpcode() == X86::PHI; ++I) {
+ if (RegMap.getRegClass(I->getOperand(0).getReg())->getSize() == 10)
+ goto UsesFPReg;
}
+ }
continue;
UsesFPReg:
// Okay, this block uses an FP register. If the block has successors (ie,
@@ -714,7 +712,7 @@
// Rewind past any terminator instructions that might exist.
MachineBasicBlock::iterator I = BB->end();
while (I != BB->begin() && TII.isTerminatorInstr((--I)->getOpcode()));
- ++I;
+ if (I != BB->end()) ++I;
BMI(BB, I, X86::FP_REG_KILL, 0);
++NumFPKill;
}
More information about the llvm-commits
mailing list