diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp --- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp +++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp @@ -349,14 +349,6 @@ return; } - // Do not track non-instructions which do not affect the wait states. - // If included, these instructions can lead to buffer overflow such that - // detectable hazards are missed. - if (CurrCycleInstr->isMetaInstruction()) { - CurrCycleInstr = nullptr; - return; - } - if (CurrCycleInstr->isBundle()) { processBundle(); return; @@ -413,7 +405,7 @@ if (IsHazard(*I)) return WaitStates; - if (I->isInlineAsm() || I->isMetaInstruction()) + if (I->isInlineAsm()) continue; WaitStates += SIInstrInfo::getNumWaitStates(*I); 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 @@ -1637,7 +1637,10 @@ unsigned SIInstrInfo::getNumWaitStates(const MachineInstr &MI) { switch (MI.getOpcode()) { - default: return 1; // FIXME: Do wait states equal cycles? + default: + if (MI.isMetaInstruction()) + return 0; + return 1; // FIXME: Do wait states equal cycles? case AMDGPU::S_NOP: return MI.getOperand(0).getImm() + 1;