[llvm] [AMDGPU] Fix FinalizeISel skipping blocks after insertSimulatedTrap (PR #174774)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 7 09:20:34 PST 2026


================
@@ -1981,8 +1982,8 @@ MachineBasicBlock *SIInstrInfo::insertSimulatedTrap(MachineRegisterInfo &MRI,
     MBB.addSuccessor(TrapBB);
   } else {
     // Since we're adding HaltLoopBB and modifying the CFG, we must return a
-    // different block to signal the change.
-    ContBB = HaltLoopBB;
+    // next block to signal the change.
----------------
arsenm wrote:

I do not think you should be using getNextNode. This should not be sensitive to the placement in the function. This is implementing [EmitInstrWithCustomInserter](https://github.com/llvm/llvm-project/blob/8a3039f977428f461e2cb45c4a34b9eb07588685/llvm/include/llvm/CodeGen/TargetLowering.h#L5846) which merely requires returning a different block. I do not see why this would need to be the next block. And what would happen if this did happen to be the final block? 

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


More information about the llvm-commits mailing list