[llvm] [AMDGPU] Fix broken MIR generated by gfx11 simulated trap lowering (PR #91652)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 09:24:25 PDT 2024


================
@@ -2065,14 +2065,26 @@ MachineBasicBlock *SIInstrInfo::insertSimulatedTrap(MachineRegisterInfo &MRI,
       .addImm(AMDGPU::SendMsg::ID_INTERRUPT);
   BuildMI(MBB, MI, DL, get(AMDGPU::S_MOV_B32), AMDGPU::M0)
       .addUse(AMDGPU::TTMP2);
-  BuildMI(MBB, MI, DL, get(AMDGPU::S_BRANCH)).addMBB(HaltLoop);
+
+  if (MBB.succ_empty()) {
+    BuildMI(MBB, MI, DL, get(AMDGPU::S_BRANCH)).addMBB(HaltLoop);
+  } else {
----------------
arsenm wrote:

That comment is correct. In that context there's no special case instructions being skipped, like trap, that must be skipped if no lanes are active 

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


More information about the llvm-commits mailing list