diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.h b/llvm/lib/Target/AMDGPU/SIInstrInfo.h --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.h +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.h @@ -931,7 +931,7 @@ uint64_t getScratchRsrcWords23() const; bool isLowLatencyInstruction(const MachineInstr &MI) const; - bool isHighLatencyInstruction(const MachineInstr &MI) const; + bool isHighLatencyDef(int Opc) const override; /// Return the descriptor of the target-specific machine instruction /// that corresponds to the specified pseudo or native opcode. diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -6005,10 +6005,9 @@ return isSMRD(Opc); } -bool SIInstrInfo::isHighLatencyInstruction(const MachineInstr &MI) const { - unsigned Opc = MI.getOpcode(); - - return isMUBUF(Opc) || isMTBUF(Opc) || isMIMG(Opc); +bool SIInstrInfo::isHighLatencyDef(int Opc) const { + return get(Opc).mayLoad() && + (isMUBUF(Opc) || isMTBUF(Opc) || isMIMG(Opc) || isFLAT(Opc)); } unsigned SIInstrInfo::isStackAccess(const MachineInstr &MI, diff --git a/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp b/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp --- a/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp +++ b/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp @@ -1955,7 +1955,7 @@ if (SITII->getMemOperandWithOffset(*SU->getInstr(), BaseLatOp, OffLatReg, TRI)) LowLatencyOffset[i] = OffLatReg; - } else if (SITII->isHighLatencyInstruction(*SU->getInstr())) + } else if (SITII->isHighLatencyDef(SU->getInstr()->getOpcode())) IsHighLatencySU[i] = 1; }