Commit 7fecf8e
committed
[RISCV] Fix incorrect folding of select on ctlz/cttz
This patch tries to fix #155014. The pattern of `ctlz`/`cttz` -> `icmp` -> `select` can occur when accounting for targets which don't support `cttz(0)` or `ctlz(0)`. We can replace this with a mask, but **only on power-of-2 bitwidths**.1 parent dc3d14a commit 7fecf8e
File tree
2 files changed
+22
-9
lines changed- llvm
- lib/Target/RISCV
- test/CodeGen/RISCV
2 files changed
+22
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18746 | 18746 | | |
18747 | 18747 | | |
18748 | 18748 | | |
| 18749 | + | |
| 18750 | + | |
| 18751 | + | |
| 18752 | + | |
18749 | 18753 | | |
18750 | 18754 | | |
18751 | 18755 | | |
| |||
18754 | 18758 | | |
18755 | 18759 | | |
18756 | 18760 | | |
18757 | | - | |
18758 | 18761 | | |
18759 | 18762 | | |
18760 | 18763 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
159 | 165 | | |
160 | 166 | | |
161 | 167 | | |
162 | | - | |
163 | | - | |
164 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
165 | 173 | | |
166 | 174 | | |
167 | 175 | | |
| |||
219 | 227 | | |
220 | 228 | | |
221 | 229 | | |
222 | | - | |
223 | | - | |
224 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
225 | 235 | | |
226 | 236 | | |
227 | 237 | | |
| |||
0 commit comments