Ignore conditions that are outside the loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2008-11-03 19:38:07 +00:00
parent 06a1242207
commit 265ca5dff5
2 changed files with 51 additions and 2 deletions
+4 -2
View File
@@ -167,8 +167,10 @@ static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) {
// TODO: Handle: br (VARIANT|INVARIANT).
// TODO: Hoist simple expressions out of loops.
if (L->isLoopInvariant(Cond)) return Cond;
if (Instruction *I = dyn_cast<Instruction>(Cond))
if (!L->contains(I->getParent()))
return 0;
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Cond))
if (BO->getOpcode() == Instruction::And ||
BO->getOpcode() == Instruction::Or) {