[llvm] [SPIR-V][Codegen] Add isPhi bit to MCInstrDesc/MIR definitions (PR #110019)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 08:07:11 PDT 2024


Keenuts wrote:

Mmm a lot of things are starting to blow up if the OpPhi is generically accepted as a PHI instruction. (MIR optimizations relying on isPHI, but then loading operands by index, hard-coded to start at 1).

Surprisingly, this wasn't the case with the change here.
I see 2 options:
 - make `MachineInstr::isPHI()` return true for `G_PHI`, `PHI` and `OpPhi`, but this requires fixing all shared MIR passes (like TailDuplication) modifying phi nodes so they don't hard-code offsets. But we would leave non-generic code (for ex x86 backend with hard-coded values)
 - ass a `MachineInstr::isLikePHI()` or something like that to only fix the MachineVerifier case.
 
 I think option 1 is better, but quite invasive. Option 2 is more safe, localized.
 @arsenm, any objection to have such large-scale change?


https://github.com/llvm/llvm-project/pull/110019


More information about the llvm-commits mailing list