diff options
author | Andrew Trick <atrick@apple.com> | 2012-01-20 21:23:40 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-01-20 21:23:40 +0000 |
commit | 0041d4d447c26825e566ba38a4fe301471fda1eb (patch) | |
tree | e58e18bc89fc519d44827fd990234a899aee07ff /lib/Transforms | |
parent | a44919ef4574621a64817dfb85cbf68ee4ebf7a8 (diff) | |
download | external_llvm-0041d4d447c26825e566ba38a4fe301471fda1eb.zip external_llvm-0041d4d447c26825e566ba38a4fe301471fda1eb.tar.gz external_llvm-0041d4d447c26825e566ba38a4fe301471fda1eb.tar.bz2 |
Handle a corner case with IV chain collection with bailout instead of assert.
Fixes PR11783: bad cast to AddRecExpr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 42f45ae..5aee483 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2484,11 +2484,15 @@ void LSRInstance::ChainInstruction(Instruction *UserInst, Instruction *IVOper, DEBUG(dbgs() << "IV Chain Limit\n"); return; } + LastIncExpr = SE.getSCEV(NextIV); + // IVUsers may have skipped over sign/zero extensions. We don't currently + // attempt to form chains involving extensions unless they can be hoisted + // into this loop's AddRec. + if (!isa<SCEVAddRecExpr>(LastIncExpr)) + return; ++NChains; IVChainVec.resize(NChains); ChainUsersVec.resize(NChains); - LastIncExpr = SE.getSCEV(NextIV); - assert(isa<SCEVAddRecExpr>(LastIncExpr) && "expect recurrence at IV user"); DEBUG(dbgs() << "IV Head: (" << *UserInst << ") IV=" << *LastIncExpr << "\n"); } |