Commit 9f45c5e
authored
[InstCombine] Fix infinite loop in select equivalence fold (#84036)
When replacing with a non-constant, it's possible that the result of the
simplification is actually more complicated than the original, and may
result in an infinite combine loop.
Mitigate the issue by requiring that either the replacement or
simplification result is constant, which should ensure that it's
simpler. While this check is crude, it does not appear to cause
optimization regressions in real-world code in practice.
Fixes #83127.1 parent 7a0accc commit 9f45c5e
File tree
2 files changed
+44
-3
lines changed- llvm
- lib/Transforms/InstCombine
- test/Transforms/InstCombine
2 files changed
+44
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1285 | 1285 | | |
1286 | 1286 | | |
1287 | 1287 | | |
1288 | | - | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
1289 | 1293 | | |
1290 | 1294 | | |
1291 | 1295 | | |
| |||
1303 | 1307 | | |
1304 | 1308 | | |
1305 | 1309 | | |
1306 | | - | |
| 1310 | + | |
| 1311 | + | |
1307 | 1312 | | |
1308 | 1313 | | |
1309 | 1314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2849 | 2849 | | |
2850 | 2850 | | |
2851 | 2851 | | |
| 2852 | + | |
2852 | 2853 | | |
2853 | 2854 | | |
2854 | 2855 | | |
2855 | 2856 | | |
2856 | 2857 | | |
2857 | | - | |
| 2858 | + | |
| 2859 | + | |
2858 | 2860 | | |
2859 | 2861 | | |
2860 | 2862 | | |
| |||
2904 | 2906 | | |
2905 | 2907 | | |
2906 | 2908 | | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
2907 | 2943 | | |
2908 | 2944 | | |
2909 | 2945 | | |
| |||
0 commit comments