Commit 22ec44f
authored
[DAGCombiner] Add support for scalarising extracts of a vector setcc (llvm#116031)
For IR like this:
%icmp = icmp ult <4 x i32> %a, splat (i32 5)
%res = extractelement <4 x i1> %icmp, i32 1
where there is only one use of %icmp we can take a similar approach
to what we already do for binary ops such add, sub, etc. and convert
this into
%ext = extractelement <4 x i32> %a, i32 1
%res = icmp ult i32 %ext, 5
For AArch64 targets at least the scalar boolean result will almost
certainly need to be in a GPR anyway, since it will probably be
used by branches for control flow. I've tried to reuse existing code
in scalarizeExtractedBinop to also work for setcc.
NOTE: The optimisations don't apply for tests such as
extract_icmp_v4i32_splat_rhs in the file
CodeGen/AArch64/extract-vector-cmp.ll
because scalarizeExtractedBinOp only works if one of the input
operands is a constant.1 parent e5faeb6 commit 22ec44f
File tree
7 files changed
+281
-41
lines changed- llvm
- lib
- CodeGen/SelectionDAG
- Target
- AArch64
- RISCV
- WebAssembly
- X86
- test/CodeGen/AArch64
7 files changed
+281
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22746 | 22746 | | |
22747 | 22747 | | |
22748 | 22748 | | |
22749 | | - | |
22750 | | - | |
| 22749 | + | |
| 22750 | + | |
22751 | 22751 | | |
22752 | 22752 | | |
22753 | 22753 | | |
22754 | 22754 | | |
22755 | | - | |
| 22755 | + | |
| 22756 | + | |
22756 | 22757 | | |
22757 | 22758 | | |
22758 | 22759 | | |
| 22760 | + | |
| 22761 | + | |
| 22762 | + | |
| 22763 | + | |
22759 | 22764 | | |
22760 | 22765 | | |
22761 | 22766 | | |
| |||
22766 | 22771 | | |
22767 | 22772 | | |
22768 | 22773 | | |
22769 | | - | |
22770 | | - | |
22771 | | - | |
22772 | | - | |
22773 | | - | |
22774 | | - | |
22775 | | - | |
22776 | | - | |
22777 | | - | |
22778 | | - | |
22779 | | - | |
| 22774 | + | |
| 22775 | + | |
| 22776 | + | |
| 22777 | + | |
| 22778 | + | |
22780 | 22779 | | |
22781 | | - | |
| 22780 | + | |
| 22781 | + | |
| 22782 | + | |
| 22783 | + | |
| 22784 | + | |
| 22785 | + | |
| 22786 | + | |
| 22787 | + | |
| 22788 | + | |
| 22789 | + | |
| 22790 | + | |
22782 | 22791 | | |
22783 | 22792 | | |
22784 | 22793 | | |
| |||
23011 | 23020 | | |
23012 | 23021 | | |
23013 | 23022 | | |
23014 | | - | |
| 23023 | + | |
23015 | 23024 | | |
23016 | 23025 | | |
23017 | 23026 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1348 | 1348 | | |
1349 | 1349 | | |
1350 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
1351 | 1355 | | |
1352 | 1356 | | |
1353 | 1357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2093 | 2093 | | |
2094 | 2094 | | |
2095 | 2095 | | |
2096 | | - | |
| 2096 | + | |
2097 | 2097 | | |
2098 | 2098 | | |
2099 | 2099 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
| 432 | + | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3300 | 3300 | | |
3301 | 3301 | | |
3302 | 3302 | | |
3303 | | - | |
| 3303 | + | |
3304 | 3304 | | |
3305 | 3305 | | |
3306 | 3306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
0 commit comments