Index: llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp =================================================================== --- llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp +++ llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp @@ -876,7 +876,7 @@ if (MI.getOpcode() == AMDGPU::SI_RETURN_TO_EPILOG || MI.getOpcode() == AMDGPU::S_SETPC_B64_return || (MI.isReturn() && MI.isCall() && !callWaitsOnFunctionEntry(MI))) { - Wait = Wait.combined(AMDGPU::Waitcnt::allZero(IV)); + Wait = Wait.combined(AMDGPU::Waitcnt::allZero(ST->hasVscnt())); } // Resolve vm waits before gs-done. else if ((MI.getOpcode() == AMDGPU::S_SENDMSG || @@ -1057,7 +1057,7 @@ // requiring a WAITCNT beforehand. if (MI.getOpcode() == AMDGPU::S_BARRIER && !ST->hasAutoWaitcntBeforeBarrier()) { - Wait = Wait.combined(AMDGPU::Waitcnt::allZero(IV)); + Wait = Wait.combined(AMDGPU::Waitcnt::allZero(ST->hasVscnt())); } // TODO: Remove this work-around, enable the assert for Bug 457939 @@ -1099,7 +1099,7 @@ } if (ForceEmitZeroWaitcnts) - Wait = AMDGPU::Waitcnt::allZero(IV); + Wait = AMDGPU::Waitcnt::allZero(ST->hasVscnt()); if (ForceEmitWaitcnt[VM_CNT]) Wait.VmCnt = 0; @@ -1268,7 +1268,7 @@ } else if (Inst.isCall()) { if (callWaitsOnFunctionReturn(Inst)) { // Act as a wait on everything - ScoreBrackets->applyWaitcnt(AMDGPU::Waitcnt::allZero(IV)); + ScoreBrackets->applyWaitcnt(AMDGPU::Waitcnt::allZero(ST->hasVscnt())); } else { // May need to way wait for anything. ScoreBrackets->applyWaitcnt(AMDGPU::Waitcnt()); Index: llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h =================================================================== --- llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h +++ llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h @@ -368,8 +368,8 @@ Waitcnt(unsigned VmCnt, unsigned ExpCnt, unsigned LgkmCnt, unsigned VsCnt) : VmCnt(VmCnt), ExpCnt(ExpCnt), LgkmCnt(LgkmCnt), VsCnt(VsCnt) {} - static Waitcnt allZero(const IsaVersion &Version) { - return Waitcnt(0, 0, 0, Version.Major >= 10 ? 0 : ~0u); + static Waitcnt allZero(bool HasVscnt) { + return Waitcnt(0, 0, 0, HasVscnt ? 0 : ~0u); } static Waitcnt allZeroExceptVsCnt() { return Waitcnt(0, 0, 0, ~0u); }