Simplify code a bit, don't go off the end of the block, now that the current

block we are in might be empty


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11744 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-02-23 07:42:19 +00:00
parent 65cf42d32f
commit fbc39d5045
2 changed files with 18 additions and 22 deletions

View File

@ -682,7 +682,6 @@ void ISel::InsertFPRegKills() {
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,7 +694,6 @@ void ISel::InsertFPRegKills() {
// 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];
@ -714,7 +712,7 @@ void ISel::InsertFPRegKills() {
// 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;
}

View File

@ -682,7 +682,6 @@ void ISel::InsertFPRegKills() {
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,7 +694,6 @@ void ISel::InsertFPRegKills() {
// 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];
@ -714,7 +712,7 @@ void ISel::InsertFPRegKills() {
// 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;
}