Fix loop condition so that we don't decrement off the beginning of the

list.

llvm-svn: 16440
This commit is contained in:
Alkis Evlogimenos 2004-09-20 06:42:58 +00:00
parent 91006d8e2c
commit d59cebf87a
1 changed files with 5 additions and 5 deletions

View File

@ -3002,12 +3002,12 @@ static bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom) {
// Otherwise, be a little bit agressive by scanning the local block where we
// want to check to see if the pointer is already being loaded or stored
// from/to. If so, the previous load or store would hav already trapped, so
// there is no harm doing an extra load (also, CSE will later eliminate the
// load entirely).
// from/to. If so, the previous load or store would have already trapped,
// so there is no harm doing an extra load (also, CSE will later eliminate
// the load entirely).
BasicBlock::iterator BBI = ScanFrom, E = ScanFrom->getParent()->begin();
do {
while (BBI != E) {
--BBI;
if (LoadInst *LI = dyn_cast<LoadInst>(BBI)) {
@ -3015,7 +3015,7 @@ static bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom) {
} else if (StoreInst *SI = dyn_cast<StoreInst>(BBI))
if (SI->getOperand(1) == V) return true;
} while (BBI != E);
}
return false;
}