[llvm] [AMDGPU] Correctly insert s_nops for implicit read of SDWA (PR #100276)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 11:37:21 PDT 2024


================
@@ -1040,6 +1096,37 @@ int GCNHazardRecognizer::checkInlineAsmHazards(MachineInstr *IA) {
     if (Op.isReg() && Op.isDef()) {
       WaitStatesNeeded =
           std::max(WaitStatesNeeded, checkVALUHazardsHelper(Op, MRI));
+
+      if (!TRI.isVectorRegister(MRI, Op.getReg()))
+        continue;
+
+      if (ST.hasDstSelForwardingHazard()) {
----------------
jrbyrnes wrote:

In has12DWordStoreHazard case, WaitStatesNeeded = std::max(WaitStatesNeeded, checkVALUHazardsHelper(Op, MRI)); .  If hasDstSelForwardingHazard then we also account for possible waits needed for dest forwarding hazard.

I've touched up the code to make this more obvious and less reliant on early exit.

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


More information about the llvm-commits mailing list