Commit 4a24c68
[DAGCombiner] Fold (or (seteq X, 0), (seteq X, -1)) to (setult (add X, 1), 2) (llvm#192183)
This is the De Morgan dual of the existing fold:
(and (setne X, 0), (setne X, -1)) --> (setuge (add X, 1), 2)
The or-of-equalities version checks if X is either 0 or -1, which is
equivalent to (X+1) < 2 (unsigned). This reduces two comparisons and
an or to one add and one comparison.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 7780e54 commit 4a24c68
File tree
2 files changed
+18
-4
lines changed- llvm
- lib/CodeGen/SelectionDAG
- test/CodeGen/ARM
2 files changed
+18
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6605 | 6605 | | |
6606 | 6606 | | |
6607 | 6607 | | |
6608 | | - | |
6609 | 6608 | | |
6610 | | - | |
6611 | | - | |
| 6609 | + | |
| 6610 | + | |
| 6611 | + | |
6612 | 6612 | | |
6613 | 6613 | | |
6614 | 6614 | | |
6615 | 6615 | | |
6616 | 6616 | | |
6617 | 6617 | | |
6618 | | - | |
| 6618 | + | |
6619 | 6619 | | |
6620 | 6620 | | |
6621 | 6621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
18 | 32 | | |
19 | 33 | | |
20 | 34 | | |
| |||
0 commit comments