Skip to content

Commit

Permalink
[AMDGPU] Switch to named simm16 in vscnt insertion
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D86568
  • Loading branch information
rampitec committed Aug 25, 2020
1 parent 2da1eef commit 817c831
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,8 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(
} else {
assert(II->getOpcode() == AMDGPU::S_WAITCNT_VSCNT);
assert(II->getOperand(0).getReg() == AMDGPU::SGPR_NULL);
ScoreBrackets.applyWaitcnt(
AMDGPU::Waitcnt(~0u, ~0u, ~0u, II->getOperand(1).getImm()));
auto W = TII->getNamedOperand(*II, AMDGPU::OpName::simm16)->getImm();
ScoreBrackets.applyWaitcnt(AMDGPU::Waitcnt(~0u, ~0u, ~0u, W));
}
}
}
Expand Down Expand Up @@ -1139,12 +1139,13 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(
assert(II->getOpcode() == AMDGPU::S_WAITCNT_VSCNT);
assert(II->getOperand(0).getReg() == AMDGPU::SGPR_NULL);

unsigned ICnt = II->getOperand(1).getImm();
unsigned ICnt = TII->getNamedOperand(*II, AMDGPU::OpName::simm16)
->getImm();
OldWait.VsCnt = std::min(OldWait.VsCnt, ICnt);
if (!TrackedWaitcntSet.count(&*II))
Wait.VsCnt = std::min(Wait.VsCnt, ICnt);
if (Wait.VsCnt != ICnt) {
II->getOperand(1).setImm(Wait.VsCnt);
TII->getNamedOperand(*II, AMDGPU::OpName::simm16)->setImm(Wait.VsCnt);
Modified = true;
}
Wait.VsCnt = ~0u;
Expand Down

0 comments on commit 817c831

Please sign in to comment.