Index: llvm/lib/Target/AMDGPU/SIInstrInfo.h =================================================================== --- llvm/lib/Target/AMDGPU/SIInstrInfo.h +++ 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. Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp =================================================================== --- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -6021,10 +6021,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, Index: llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp =================================================================== --- llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp +++ 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; }