[llvm] [AMDGPU][SIInsertWaitcnts] Track SCC. Insert KM_CNT waits for SCC writes. (PR #157843)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 12 01:59:26 PDT 2025
================
@@ -2419,6 +2468,19 @@ bool WaitcntBrackets::merge(const WaitcntBrackets &Other) {
if (T == DS_CNT)
StrictDom |= mergeScore(M, LastGDS, Other.LastGDS);
+ if (T == KM_CNT) {
+ StrictDom |= mergeScore(M, SCCScore, Other.SCCScore);
+ if (Other.hasPendingEvent(SCC_WRITE)) {
+ unsigned OldEventsHasSCCWrite = OldEvents & (1 << SCC_WRITE);
+ if (!OldEventsHasSCCWrite) {
+ PendingSCCWrite = Other.PendingSCCWrite;
+ } else {
+ if (PendingSCCWrite != Other.PendingSCCWrite)
----------------
jayfoad wrote:
When control flow paths merge, each path could have a different unique scc-writing instruction. Then in the merged state PendingSCCWrite will be set to nullptr, indicating that we can no longer uniquely identify the scc-writing instruction.
https://github.com/llvm/llvm-project/pull/157843
More information about the llvm-commits
mailing list