Commit a5d3522
authored
[SCEV] Rewrite A - B = UMin(1, A - B) lazily for A != B loop guards. (#163787)
Follow-up to 2d02726
(#160500)
Creating the SCEV subtraction eagerly is very expensive. To soften the
blow, just collect a map with inequalities and check if we can apply the
subtract rewrite when rewriting SCEVAddExpr.
Restores most of the regression:
http://llvm-compile-time-tracker.com/compare.php?from=0792478e4e133be96650444f3264e89d002fc058&to=7fca35db60fe6f423ea6051b45226046c067c252&stat=instructions:u
stage1-O3: -0.10%
stage1-ReleaseThinLTO: -0.09%
stage1-ReleaseLTO-g: -0.10%
stage1-O0-g: +0.02%
stage1-aarch64-O3: -0.09%
stage1-aarch64-O0-g: +0.00%
stage2-O3: -0.17%
stage2-O0-g: -0.05%
stage2-clang: -0.07%
There is still some negative impact compared to before 2d02726, but
there's probably not much we could do reduce this even more.
Compile-time improvement with 2d02726 reverted on top of the
current PR:
http://llvm-compile-time-tracker.com/compare.php?from=7fca35db60fe6f423ea6051b45226046c067c252&to=98dd152bdfc76b30d00190d3850d89406ca3c21f&stat=instructions:u
stage1-O3: 60628M (-0.03%)
stage1-ReleaseThinLTO: 76388M (-0.04%)
stage1-ReleaseLTO-g: 89228M (-0.02%)
stage1-O0-g: 18523M (-0.03%)
stage1-aarch64-O3: 67623M (-0.03%)
stage1-aarch64-O0-g: 22595M (+0.01%)
stage2-O3: 52336M (+0.01%)
stage2-O0-g: 16174M (+0.00%)
stage2-clang: 34890032M (-0.03%)
PR: #1637871 parent c491c6e commit a5d3522
File tree
3 files changed
+54
-15
lines changed- llvm
- include/llvm/Analysis
- lib/Analysis
- test/Transforms/IndVarSimplify
3 files changed
+54
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1345 | 1345 | | |
1346 | 1346 | | |
1347 | 1347 | | |
| 1348 | + | |
1348 | 1349 | | |
1349 | 1350 | | |
1350 | 1351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15740 | 15740 | | |
15741 | 15741 | | |
15742 | 15742 | | |
| 15743 | + | |
| 15744 | + | |
| 15745 | + | |
| 15746 | + | |
15743 | 15747 | | |
15744 | 15748 | | |
15745 | 15749 | | |
15746 | 15750 | | |
15747 | 15751 | | |
15748 | 15752 | | |
15749 | | - | |
15750 | | - | |
15751 | | - | |
15752 | | - | |
15753 | | - | |
15754 | | - | |
15755 | | - | |
| 15753 | + | |
| 15754 | + | |
| 15755 | + | |
| 15756 | + | |
| 15757 | + | |
| 15758 | + | |
| 15759 | + | |
| 15760 | + | |
| 15761 | + | |
| 15762 | + | |
15756 | 15763 | | |
15757 | 15764 | | |
15758 | 15765 | | |
| |||
15886 | 15893 | | |
15887 | 15894 | | |
15888 | 15895 | | |
| 15896 | + | |
15889 | 15897 | | |
15890 | 15898 | | |
15891 | 15899 | | |
15892 | 15900 | | |
15893 | 15901 | | |
15894 | 15902 | | |
15895 | | - | |
| 15903 | + | |
| 15904 | + | |
15896 | 15905 | | |
15897 | 15906 | | |
15898 | 15907 | | |
| |||
15947 | 15956 | | |
15948 | 15957 | | |
15949 | 15958 | | |
| 15959 | + | |
| 15960 | + | |
| 15961 | + | |
| 15962 | + | |
| 15963 | + | |
| 15964 | + | |
| 15965 | + | |
| 15966 | + | |
| 15967 | + | |
| 15968 | + | |
| 15969 | + | |
| 15970 | + | |
| 15971 | + | |
| 15972 | + | |
| 15973 | + | |
| 15974 | + | |
| 15975 | + | |
15950 | 15976 | | |
15951 | 15977 | | |
15952 | 15978 | | |
15953 | 15979 | | |
15954 | 15980 | | |
15955 | 15981 | | |
15956 | | - | |
15957 | | - | |
| 15982 | + | |
| 15983 | + | |
| 15984 | + | |
| 15985 | + | |
| 15986 | + | |
| 15987 | + | |
| 15988 | + | |
15958 | 15989 | | |
15959 | 15990 | | |
15960 | 15991 | | |
| |||
15989 | 16020 | | |
15990 | 16021 | | |
15991 | 16022 | | |
15992 | | - | |
| 16023 | + | |
15993 | 16024 | | |
15994 | 16025 | | |
15995 | 16026 | | |
| |||
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
120 | 119 | | |
121 | 120 | | |
122 | | - | |
| 121 | + | |
123 | 122 | | |
124 | 123 | | |
125 | 124 | | |
| |||
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
| 164 | + | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
170 | 171 | | |
171 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
172 | 175 | | |
173 | 176 | | |
174 | 177 | | |
| |||
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
| 188 | + | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
| 194 | + | |
190 | 195 | | |
191 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
| |||
0 commit comments