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)
llvm-svn: 147683

llvm/lib/Analysis/ScalarEvolutionExpander.cpp

index 0a3cda9..b9c2304 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);