[llvm] [AMDGPU][SIInsertWaitCnts] Use RegUnits-based tracking (PR #162077)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 05:09:12 PST 2025
================
@@ -2421,21 +2391,20 @@ bool WaitcntBrackets::merge(const WaitcntBrackets &Other) {
}
}
- for (int J = 0; J <= VgprUB; J++)
- StrictDom |= mergeScore(M, VgprScores[T][J], Other.VgprScores[T][J]);
+ for (auto &[RegID, Info] : Other.VMem)
+ StrictDom |= mergeScore(M, VMem[RegID].Scores[T], Info.Scores[T]);
if (isSmemCounter(T)) {
unsigned Idx = getSgprScoresIdx(T);
- for (int J = 0; J <= SgprUB; J++)
- StrictDom |=
- mergeScore(M, SgprScores[Idx][J], Other.SgprScores[Idx][J]);
+ for (auto &[RegID, Info] : Other.SGPRs)
+ StrictDom |= mergeScore(M, SGPRs[RegID].Scores[Idx], Info.Scores[Idx]);
}
}
- for (int J = 0; J <= VgprUB; J++) {
- unsigned char NewVmemTypes = VgprVmemTypes[J] | Other.VgprVmemTypes[J];
- StrictDom |= NewVmemTypes != VgprVmemTypes[J];
- VgprVmemTypes[J] = NewVmemTypes;
+ for (auto &[TID, Info] : Other.VMem) {
+ unsigned char NewVmemTypes = VMem[TID].VMEMTypes | Info.VMEMTypes;
+ StrictDom |= NewVmemTypes != VMem[TID].VMEMTypes;
+ VMem[TID].VMEMTypes = NewVmemTypes;
----------------
jayfoad wrote:
Can you avoid all these repeated lookups of the same key in the same map? Especially since we have already done this lookup in the other loop over Other.VMem on line 2394 above.
https://github.com/llvm/llvm-project/pull/162077
More information about the llvm-commits
mailing list