add a comment, make a check more lenient

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22581 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-08-02 02:52:02 +00:00
parent e9100c69cb
commit 7e608bbb5d

View File

@ -71,6 +71,9 @@ namespace {
const TargetData *TD; const TargetData *TD;
const Type *UIntPtrTy; const Type *UIntPtrTy;
bool Changed; bool Changed;
/// MaxTargetAMSize - This is the maximum power-of-two scale value that the
/// target can handle for free with its addressing modes.
unsigned MaxTargetAMSize; unsigned MaxTargetAMSize;
/// IVUsesByStride - Keep track of all uses of induction variables that we /// IVUsesByStride - Keep track of all uses of induction variables that we
@ -649,15 +652,14 @@ void LoopStrengthReduce::runOnLoop(Loop *L) {
// compared against some value to decide loop termination. // compared against some value to decide loop termination.
if (PN->hasOneUse()) { if (PN->hasOneUse()) {
BinaryOperator *BO = dyn_cast<BinaryOperator>(*(PN->use_begin())); BinaryOperator *BO = dyn_cast<BinaryOperator>(*(PN->use_begin()));
if (BO && BO->getOpcode() == Instruction::Add) if (BO && BO->hasOneUse()) {
if (BO->hasOneUse()) { if (PN == *(BO->use_begin())) {
if (PN == dyn_cast<PHINode>(*(BO->use_begin()))) { DeadInsts.insert(BO);
DeadInsts.insert(BO); // Break the cycle, then delete the PHI.
// Break the cycle, then delete the PHI. PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
PN->replaceAllUsesWith(UndefValue::get(PN->getType())); PN->eraseFromParent();
PN->eraseFromParent();
}
} }
}
} }
} }
DeleteTriviallyDeadInstructions(DeadInsts); DeleteTriviallyDeadInstructions(DeadInsts);