[llvm] [SPIR-V] Erase all instructions after OpKill, not just the next one (PR #219022)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 07:23:58 PDT 2026


================
@@ -4483,9 +4483,11 @@ bool SPIRVInstructionSelector::selectDiscard(Register ResVReg,
   } else {
     Opcode = SPIRV::OpKill;
     // OpKill must be the last operation of any basic block.
-    if (MachineInstr *NextI = I.getNextNode()) {
-      GR.invalidateMachineInstr(NextI);
-      NextI->eraseFromParent();
+    for (MachineInstr *NextI = I.getNextNode(); NextI;) {
----------------
jmmartinez wrote:

Could this loop be a `make_early_inc_range`?

Likely a bit weirder because we have to first build a range, but we immediately know from its name what is doing.

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


More information about the llvm-commits mailing list