SCEVExpander: hoistStep should check strict dominance.
authorAndrew Trick <atrick@apple.com>
Fri, 6 Jan 2012 21:23:43 +0000 (21:23 +0000)
committerAndrew Trick <atrick@apple.com>
Fri, 6 Jan 2012 21:23:43 +0000 (21:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147683 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolutionExpander.cpp

index 0a3cda998f49c073eece0205c9b4745cf4cd5879..b9c2304b31309d428eb196610c9e6a34339ad142 100644 (file)
@@ -1564,7 +1564,7 @@ bool SCEVExpander::hoistStep(Instruction *IncV, Instruction *InsertPos,
   for (User::op_iterator OI = IncV->op_begin(), OE = IncV->op_end();
        OI != OE; ++OI) {
     Instruction *OInst = dyn_cast<Instruction>(OI);
-    if (OInst && !DT->dominates(OInst, InsertPos))
+    if (OInst && (OInst == InsertPos || !DT->dominates(OInst, InsertPos)))
       return false;
   }
   IncV->moveBefore(InsertPos);