[PATCH] D48597: [LoopInstSimplify] Discard SCEV if simplification happened.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 26 08:54:52 PDT 2018
lebedev.ri created this revision.
lebedev.ri added reviewers: uabelho, mkazantsev, chandlerc, sanjoy, evstupac.
Herald added subscribers: steven_wu, javed.absar, eraman, mehdi_amini.
Fixes PR37936 <https://bugs.llvm.org/show_bug.cgi?id=37936>.
The problem is as follows:
1. `indvars` marks `%dec` as `NUW`.
2. `loop-instsimplify` runs `instsimplify`, which constant-folds `%dec` to -1 (https://reviews.llvm.org/D47908)
3. `loop-reduce` tries to do some further modification, but crashes with an type assertion in cast, because `%dec` is no longer an `Instruction`,
If the runline is split into two, i.e. you first run `-indvars -loop-instsimplify`,
store that into a file, and then run `-loop-reduce`, there is no crash.
So it looks like the problem is due to `-loop-instsimplify` not discarding SCEV.
This does fix the crash (without the patch, that test file crashes),
although i do not know whether there is some other problem that should be solved.
Repository:
rL LLVM
https://reviews.llvm.org/D48597
Files:
lib/Transforms/Scalar/LoopInstSimplify.cpp
test/Other/new-pm-defaults.ll
test/Other/new-pm-thinlto-defaults.ll
test/Transforms/LoopInstSimplify/forget-scev.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48597.152897.patch
Type: text/x-patch
Size: 6483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180626/bc8b9fd3/attachment.bin>
More information about the llvm-commits
mailing list