diff options
author | Wei Mi <wmi@google.com> | 2017-05-18 17:21:22 +0000 |
---|---|---|
committer | Wei Mi <wmi@google.com> | 2017-05-18 17:21:22 +0000 |
commit | 8848c1e3c7e94eac2b207fa4418419d8d6765e20 (patch) | |
tree | a9d18013ad759854f533f81d7e4a319a3678962f /llvm/lib/Transforms/Scalar | |
parent | 8b61764cbba4136e038fd94e035f1e965c82ba52 (diff) | |
download | bcm5719-llvm-8848c1e3c7e94eac2b207fa4418419d8d6765e20.tar.gz bcm5719-llvm-8848c1e3c7e94eac2b207fa4418419d8d6765e20.zip |
[LSR] Call canonicalize after we generate a new Formula in GenerateTruncates. Fix PR33077.
The testcase in PR33077 generates a LSR Use Formula with two SCEVAddRecExprs for the same
loop. Such uncommon formula will become non-canonical after GenerateTruncates adds sign
extension to the ScaledReg of the Formula, and it will break the assertion that every
Formula to be inserted is canonical.
The fix is to call canonicalize for the raw Formula generated by GenerateTruncates
before inserting it.
llvm-svn: 303361
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index bd1f21c69eb..28d94497a3e 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -3805,6 +3805,7 @@ void LSRInstance::GenerateTruncates(LSRUse &LU, unsigned LUIdx, Formula Base) { if (!F.hasRegsUsedByUsesOtherThan(LUIdx, RegUses)) continue; + F.canonicalize(*L); (void)InsertFormula(LU, LUIdx, F); } } |