diff options
author | Andrew Trick <atrick@apple.com> | 2012-03-16 03:16:56 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-03-16 03:16:56 +0000 |
commit | 75ae20366fd1b480f4cc38400bb075c43c9f4f7f (patch) | |
tree | 5755a9e690aa54dfe2971c55372c4ddf963cc0b5 /lib/Transforms/Scalar/IndVarSimplify.cpp | |
parent | d936045625ae2e101d3a9544586d7568c6dbacc0 (diff) | |
download | llvm-75ae20366fd1b480f4cc38400bb075c43c9f4f7f.tar.gz llvm-75ae20366fd1b480f4cc38400bb075c43c9f4f7f.tar.bz2 llvm-75ae20366fd1b480f4cc38400bb075c43c9f4f7f.tar.xz |
LSR fix: Add isSimplifiedLoopNest to IVUsers analysis.
Only record IVUsers that are dominated by simplified loop
headers. Otherwise SCEVExpander will crash while looking for a
preheader.
I previously tried to work around this in LSR itself, but that was
insufficient. This way, LSR can continue to run if some uses are not
in simple loops, as long as we don't attempt to analyze those users.
Fixes <rdar://problem/11049788> Segmentation fault: 11 in LoopStrengthReduce
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152892 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index d1e57e101b..490617a0c8 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -450,8 +450,10 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PN) { } // Add a new IVUsers entry for the newly-created integer PHI. - if (IU) - IU->AddUsersIfInteresting(NewPHI); + if (IU) { + SmallPtrSet<Loop*, 16> SimplifiedLoopNests; + IU->AddUsersIfInteresting(NewPHI, SimplifiedLoopNests); + } Changed = true; } @@ -1967,8 +1969,11 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { // loop exit test instruction. if (IU && NewICmp) { ICmpInst *NewICmpInst = dyn_cast<ICmpInst>(NewICmp); - if (NewICmpInst) - IU->AddUsersIfInteresting(cast<Instruction>(NewICmpInst->getOperand(0))); + if (NewICmpInst) { + SmallPtrSet<Loop*, 16> SimplifiedLoopNests; + IU->AddUsersIfInteresting(cast<Instruction>(NewICmpInst->getOperand(0)), + SimplifiedLoopNests); + } } // Clean up dead instructions. Changed |= DeleteDeadPHIs(L->getHeader()); |