LSR fix: add a missing phi check during IV hoisting.

Fixes PR12898: SCEVExpander crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick
2012-05-22 17:39:59 +00:00
parent 5c525b59d5
commit 3de8ad8bf9
2 changed files with 59 additions and 1 deletions

View File

@ -955,7 +955,8 @@ bool SCEVExpander::hoistIVInc(Instruction *IncV, Instruction *InsertPos) {
// InsertPos must itself dominate IncV so that IncV's new position satisfies
// its existing users.
if (!SE.DT->dominates(InsertPos->getParent(), IncV->getParent()))
if (isa<PHINode>(InsertPos)
|| !SE.DT->dominates(InsertPos->getParent(), IncV->getParent()))
return false;
// Check that the chain of IV operands leading back to Phi can be hoisted.