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

Emma Pilkington via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 09:48:28 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 {
----------------
epilk wrote:

Sure, fixed in the update. Did you also mean using `s_cbranch_execnz`? I'm not certain why that's actually correct, can we just assume that exec is non-zero?

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


More information about the llvm-commits mailing list