[llvm] [AMDGPU] Correctly insert s_nops for dst forwarding hazard (PR #100276)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 10:46:03 PDT 2024


================
@@ -913,30 +954,39 @@ int GCNHazardRecognizer::checkVALUHazards(MachineInstr *VALU) {
     const int Shift16DefWaitstates = 1;
 
     auto IsShift16BitDefFn = [this, VALU](const MachineInstr &MI) {
-      if (!SIInstrInfo::isVALU(MI))
-        return false;
-      const SIInstrInfo *TII = ST.getInstrInfo();
-      if (SIInstrInfo::isSDWA(MI)) {
-        if (auto *DstSel = TII->getNamedOperand(MI, AMDGPU::OpName::dst_sel))
-          if (DstSel->getImm() == AMDGPU::SDWA::DWORD)
-            return false;
-      } else {
-        if (!AMDGPU::hasNamedOperand(MI.getOpcode(), AMDGPU::OpName::op_sel) ||
-            !(TII->getNamedOperand(MI, AMDGPU::OpName::src0_modifiers)
-                  ->getImm() &
-              SISrcMods::DST_OP_SEL))
-          return false;
-      }
       const SIRegisterInfo *TRI = ST.getRegisterInfo();
-      if (auto *Dst = TII->getNamedOperand(MI, AMDGPU::OpName::vdst)) {
-        Register Def = Dst->getReg();
+      SmallVector<const MachineOperand *, 4> Dsts;
----------------
arsenm wrote:

Don't need this intermediate array. Just the below code as a helper function for the one operand case, and then in a loop over all_defs() of the inline asm 

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


More information about the llvm-commits mailing list