Commit b733229
committed
[DAGCombiner] Add support for scalarising extracts of a vector setcc
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 4717e0c commit b733229
File tree
6 files changed
+61
-61
lines changed- llvm
- lib
- CodeGen/SelectionDAG
- Target
- AArch64
- RISCV
- WebAssembly
- X86
- test/CodeGen/AArch64
6 files changed
+61
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22749 | 22749 | | |
22750 | 22750 | | |
22751 | 22751 | | |
22752 | | - | |
22753 | | - | |
| 22752 | + | |
| 22753 | + | |
22754 | 22754 | | |
22755 | 22755 | | |
22756 | 22756 | | |
22757 | 22757 | | |
22758 | | - | |
| 22758 | + | |
| 22759 | + | |
22759 | 22760 | | |
22760 | 22761 | | |
22761 | 22762 | | |
| 22763 | + | |
| 22764 | + | |
| 22765 | + | |
| 22766 | + | |
22762 | 22767 | | |
22763 | 22768 | | |
22764 | 22769 | | |
| |||
22769 | 22774 | | |
22770 | 22775 | | |
22771 | 22776 | | |
22772 | | - | |
22773 | | - | |
22774 | | - | |
22775 | | - | |
22776 | | - | |
22777 | | - | |
22778 | | - | |
22779 | | - | |
22780 | | - | |
22781 | | - | |
22782 | | - | |
| 22777 | + | |
| 22778 | + | |
| 22779 | + | |
| 22780 | + | |
| 22781 | + | |
22783 | 22782 | | |
22784 | | - | |
| 22783 | + | |
| 22784 | + | |
| 22785 | + | |
| 22786 | + | |
| 22787 | + | |
| 22788 | + | |
| 22789 | + | |
| 22790 | + | |
| 22791 | + | |
| 22792 | + | |
| 22793 | + | |
| 22794 | + | |
22785 | 22795 | | |
22786 | 22796 | | |
22787 | 22797 | | |
| |||
23014 | 23024 | | |
23015 | 23025 | | |
23016 | 23026 | | |
23017 | | - | |
| 23027 | + | |
23018 | 23028 | | |
23019 | 23029 | | |
23020 | 23030 | | |
| |||
| 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 | |
|---|---|---|---|
| |||
3306 | 3306 | | |
3307 | 3307 | | |
3308 | 3308 | | |
3309 | | - | |
| 3309 | + | |
3310 | 3310 | | |
3311 | 3311 | | |
3312 | 3312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
| |||
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
29 | 25 | | |
30 | 26 | | |
31 | 27 | | |
| |||
35 | 31 | | |
36 | 32 | | |
37 | 33 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
44 | 37 | | |
45 | 38 | | |
46 | 39 | | |
| |||
50 | 43 | | |
51 | 44 | | |
52 | 45 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
59 | 50 | | |
60 | 51 | | |
61 | 52 | | |
| |||
66 | 57 | | |
67 | 58 | | |
68 | 59 | | |
69 | | - | |
70 | | - | |
| 60 | + | |
| 61 | + | |
71 | 62 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 63 | + | |
| 64 | + | |
76 | 65 | | |
77 | 66 | | |
78 | 67 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
82 | 71 | | |
83 | 72 | | |
84 | 73 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
89 | 77 | | |
90 | 78 | | |
91 | | - | |
| 79 | + | |
92 | 80 | | |
93 | 81 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
99 | 85 | | |
100 | 86 | | |
101 | | - | |
| 87 | + | |
102 | 88 | | |
103 | 89 | | |
104 | 90 | | |
| |||
0 commit comments