Commit 1a60ae0
committed
[InstCombine] fold mask-with-signbit-splat to icmp+select
~(iN X s>> (N-1)) & Y --> (X s< 0) ? 0 : Y
https://alive2.llvm.org/ce/z/JKlQ9x
This is similar to D111410 / 727e642 ,
but it includes a 'not' of the signbit and so it
saves an instruction in the basic pattern.
DAGCombiner or target-specific folds can expand
this back into bit-hacks.
The diffs in the logical-select tests are not true
regressions - running early-cse and another round
of instcombine is expected in a normal opt pipeline,
and that reduces back to a minimal form as shown
in the duplicated PhaseOrdering test.
I have no understanding of the SystemZ diffs, so
I made the minimal edits suggested by FileCheck to
make that test pass again. That whole test file is
wrong though. It is running the entire optimizer (-O2)
to check IR, and then topping that by even running
codegen and checking asm. It needs to be split up.
Fixes llvm#526311 parent 96130b5 commit 1a60ae0
File tree
7 files changed
+69
-43
lines changed- clang/test/CodeGen/SystemZ
- llvm
- lib/Transforms/InstCombine
- test/Transforms
- InstCombine
- PhaseOrdering
7 files changed
+69
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3289 | 3289 | | |
3290 | 3290 | | |
3291 | 3291 | | |
3292 | | - | |
| 3292 | + | |
3293 | 3293 | | |
3294 | | - | |
| 3294 | + | |
3295 | 3295 | | |
3296 | | - | |
| 3296 | + | |
3297 | 3297 | | |
3298 | | - | |
| 3298 | + | |
3299 | 3299 | | |
3300 | 3300 | | |
3301 | 3301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2133 | 2133 | | |
2134 | 2134 | | |
2135 | 2135 | | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
2136 | 2145 | | |
2137 | 2146 | | |
2138 | 2147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1463 | 1463 | | |
1464 | 1464 | | |
1465 | 1465 | | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
| 1466 | + | |
| 1467 | + | |
1469 | 1468 | | |
1470 | 1469 | | |
1471 | 1470 | | |
| |||
1477 | 1476 | | |
1478 | 1477 | | |
1479 | 1478 | | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
| 1479 | + | |
| 1480 | + | |
1483 | 1481 | | |
1484 | 1482 | | |
1485 | 1483 | | |
| |||
1489 | 1487 | | |
1490 | 1488 | | |
1491 | 1489 | | |
| 1490 | + | |
| 1491 | + | |
1492 | 1492 | | |
1493 | 1493 | | |
1494 | 1494 | | |
1495 | 1495 | | |
1496 | | - | |
1497 | | - | |
| 1496 | + | |
| 1497 | + | |
1498 | 1498 | | |
1499 | 1499 | | |
1500 | 1500 | | |
| |||
1504 | 1504 | | |
1505 | 1505 | | |
1506 | 1506 | | |
| 1507 | + | |
| 1508 | + | |
1507 | 1509 | | |
1508 | 1510 | | |
1509 | 1511 | | |
| |||
1519 | 1521 | | |
1520 | 1522 | | |
1521 | 1523 | | |
| 1524 | + | |
| 1525 | + | |
1522 | 1526 | | |
1523 | 1527 | | |
1524 | 1528 | | |
| |||
1532 | 1536 | | |
1533 | 1537 | | |
1534 | 1538 | | |
| 1539 | + | |
| 1540 | + | |
1535 | 1541 | | |
1536 | 1542 | | |
1537 | 1543 | | |
| |||
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
586 | | - | |
587 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
588 | 591 | | |
589 | 592 | | |
590 | 593 | | |
| |||
596 | 599 | | |
597 | 600 | | |
598 | 601 | | |
599 | | - | |
600 | | - | |
601 | | - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
602 | 608 | | |
603 | 609 | | |
604 | 610 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
586 | | - | |
587 | | - | |
588 | | - | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
589 | 592 | | |
590 | 593 | | |
591 | 594 | | |
| |||
597 | 600 | | |
598 | 601 | | |
599 | 602 | | |
600 | | - | |
601 | | - | |
602 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
603 | 609 | | |
604 | 610 | | |
605 | 611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
16 | 9 | | |
17 | 10 | | |
18 | 11 | | |
| |||
85 | 78 | | |
86 | 79 | | |
87 | 80 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
91 | 84 | | |
92 | 85 | | |
93 | 86 | | |
| |||
0 commit comments