Commit 3be8e2c
authored
[InstCombine] Prefer to keep power-of-2 constants when combining ashr exact and slt/ult of a constant (#86111)
We have flexibility in what constant to use when combining an `ashr
exact` with a slt or ult of a constant, and it's not possible to revisit
this decision later in the compilation pipeline after the `ashr exact`
is removed. Keeping a constant close to power-of-2 (pow2val + 1) should
be no worse than neutral, and in some cases may allow better codegen
later on for targets that can more cheaply generate power of 2 (which
may be selectable if converting back to setle/setge) or near power of 2
constants.
Alive2 proofs:
<https://alive2.llvm.org/ce/z/2BmPnq> and
<https://alive2.llvm.org/ce/z/DtuhnR>1 parent 452f439 commit 3be8e2c
File tree
2 files changed
+14
-6
lines changed- llvm
- lib/Transforms/InstCombine
- test/Transforms/InstCombine
2 files changed
+14
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2479 | 2479 | | |
2480 | 2480 | | |
2481 | 2481 | | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
2482 | 2492 | | |
2483 | 2493 | | |
2484 | 2494 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3379 | 3379 | | |
3380 | 3380 | | |
3381 | 3381 | | |
3382 | | - | |
| 3382 | + | |
3383 | 3383 | | |
3384 | 3384 | | |
3385 | 3385 | | |
| |||
3389 | 3389 | | |
3390 | 3390 | | |
3391 | 3391 | | |
3392 | | - | |
| 3392 | + | |
3393 | 3393 | | |
3394 | 3394 | | |
3395 | 3395 | | |
| |||
3800 | 3800 | | |
3801 | 3801 | | |
3802 | 3802 | | |
3803 | | - | |
3804 | | - | |
3805 | 3803 | | |
3806 | 3804 | | |
3807 | | - | |
| 3805 | + | |
3808 | 3806 | | |
3809 | 3807 | | |
3810 | 3808 | | |
| |||
3814 | 3812 | | |
3815 | 3813 | | |
3816 | 3814 | | |
3817 | | - | |
| 3815 | + | |
3818 | 3816 | | |
3819 | 3817 | | |
3820 | 3818 | | |
| |||
0 commit comments