Commit 0dd4235
[SCEV] Use ashr to adjust constant multipliers (llvm#135534)
SCEV converts "-2 *nsw (i32 V)" into "2148473647 *nsw (i32 V)". But we
cannot preserve the nsw flag when the constant multiplier is negative.
This patch changes lshr to ashr so that we can preserve both nsw and nuw
flags.
Alive2 proof: https://alive2.llvm.org/ce/z/LZVSEa
Closes llvm#135531.
(cherry picked from commit bb9580a)1 parent a141e58 commit 0dd4235
File tree
2 files changed
+20
-1
lines changed- llvm
- lib/Analysis
- test/Analysis/ScalarEvolution
2 files changed
+20
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7854 | 7854 | | |
7855 | 7855 | | |
7856 | 7856 | | |
7857 | | - | |
| 7857 | + | |
7858 | 7858 | | |
7859 | 7859 | | |
7860 | 7860 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments