Commit 3e6bc8c
committed
[GISel] Teach computeKnownBitsImpl to handle COPY instructions that change bit width.
The selectShiftMask ComplexRenderFn on RISCV calls computeKnownBits.
I encountered a case where we looked through a G_PHI and found a
COPY that was created from an already selected G_ANYEXT from s32 to
s64. s32 and s64 integers on RISC-V end up in the same register class.a
The input to the COPY was an already selected s32 SELECT instruction.
We need an s32 SELECT to be legal to support f32 selects. If it isn't
used by FP operations, regbank select will assign to GPR.
This patch uses KnownBits::anyextOrTrunc to adjust the width when
they mismatch.
I haven't reduced a test case yet, but wanted to make sure this is
the right fix.1 parent 4b24ab4 commit 3e6bc8c
File tree
2 files changed
+37
-0
lines changed- llvm
- lib/CodeGen/GlobalISel
- test/CodeGen/RISCV/GlobalISel
2 files changed
+37
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments