Commit 7334a28
committed
[SPIR-V][Codegen] Add isPhi bit to MIR
the isPHI() function relied on the MIR opcode. This was fine as AFAIK
no real target has a real PHI instruction. With SPIR-V, this assumption
breaks.
The MachineVerifier has a special handling for PHI instructions to check
liveness, but since this relied on the PHI/G_PHI opcode check, it was
raising an error when the OpPhi MIR was checked.
Since the SPIR-V opcode is specific to the backend, I don't think
checking the actual opcode in the MachineVerifier code is correct, so
I added a bit in the instruction description, and applied it to the 3
existing PHI instruction I found (G_PHI, PHI, OpPhi).
Another different bit is the index of the first BB/reg pair:
%res = PHI [reg, BB]
%res = OpPhi %reg [reg, BB]
The solution I had is to have a function in the MachineInstr returning
the start index, allowing the MachineVerifier to work on both formats.
Its slightly better, it works, but it's not THAT great.
An alternative could be to add the index in the MCInstrDesc, this way,
the index bit definition would be in the TD files, closer to the
definition.
This patch reduces the amount of failling tests with EXPENSIVE_CHECKS
from 120 to 113 (All fixed are in the SPIR-V backend).
Fixes #108844
Signed-off-by: Nathan Gauër <[email protected]>1 parent f43ad88 commit 7334a28
File tree
9 files changed
+32
-7
lines changed- llvm
- include/llvm
- CodeGen
- MC
- Target
- lib
- CodeGen
- Target/SPIRV
- utils/TableGen
- Common
9 files changed
+32
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1394 | 1394 | | |
1395 | 1395 | | |
1396 | 1396 | | |
1397 | | - | |
1398 | | - | |
1399 | | - | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
1400 | 1408 | | |
| 1409 | + | |
1401 | 1410 | | |
1402 | 1411 | | |
1403 | 1412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| |||
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
295 | 300 | | |
296 | 301 | | |
297 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| 638 | + | |
638 | 639 | | |
639 | 640 | | |
640 | 641 | | |
| |||
1174 | 1175 | | |
1175 | 1176 | | |
1176 | 1177 | | |
| 1178 | + | |
1177 | 1179 | | |
1178 | 1180 | | |
1179 | 1181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3213 | 3213 | | |
3214 | 3214 | | |
3215 | 3215 | | |
3216 | | - | |
| 3216 | + | |
| 3217 | + | |
3217 | 3218 | | |
3218 | 3219 | | |
3219 | 3220 | | |
| |||
3268 | 3269 | | |
3269 | 3270 | | |
3270 | 3271 | | |
3271 | | - | |
| 3272 | + | |
| 3273 | + | |
3272 | 3274 | | |
3273 | 3275 | | |
3274 | 3276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
618 | | - | |
619 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
620 | 622 | | |
621 | 623 | | |
622 | 624 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
| 472 | + | |
472 | 473 | | |
473 | 474 | | |
474 | 475 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1240 | 1240 | | |
1241 | 1241 | | |
1242 | 1242 | | |
| 1243 | + | |
| 1244 | + | |
1243 | 1245 | | |
1244 | 1246 | | |
1245 | 1247 | | |
| |||
0 commit comments