[llvm] [AMDGPU] Refactor GFX11 VALU Mask Hazard Waitcnt Merging (PR #169213)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 06:33:34 PDT 2026


================
@@ -3556,16 +3556,15 @@ bool GCNHazardRecognizer::fixVALUMaskWriteHazard(MachineInstr *MI) {
   };
 
   SmallVector<const MachineInstr *> WaitInstrs;
-  bool HasSGPRRead = false;
   StateType InitialState;
 
   // Look for SGPR write.
   MachineOperand *HazardDef = nullptr;
-  for (MachineOperand &Op : MI->operands()) {
+  for (MachineOperand &Op : MI->all_defs()) {
     if (!Op.isReg())
       continue;
-    if (Op.isDef() && HazardDef)
-      continue;
+    if (HazardDef)
+      break;
----------------
jayfoad wrote:

Simpler to break unconditionally at the end of the loop?

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


More information about the llvm-commits mailing list