[llvm] [WIP][AMDGPU][SIInsertWaitcnts] Do not add s_waitcnt when the counters are known to be 0 already (PR #65735)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 03:19:57 PDT 2023


================
@@ -1720,26 +1730,25 @@ bool SIInsertWaitcnts::insertWaitcntInBlock(MachineFunction &MF,
 // which we want to flush the vmcnt counter, and false otherwise.
 bool SIInsertWaitcnts::isPreheaderToFlush(MachineBasicBlock &MBB,
                                           WaitcntBrackets &ScoreBrackets) {
-  if (PreheadersToFlush.count(&MBB))
-    return PreheadersToFlush[&MBB];
-
-  auto UpdateCache = [&](bool val) {
-    PreheadersToFlush[&MBB] = val;
-    return val;
-  };
+  auto [Iterator, IsInserted] = PreheadersToFlush.try_emplace(&MBB, false);
----------------
jayfoad wrote:

Looks like an unrelated clean up? Please commit it separately.

https://github.com/llvm/llvm-project/pull/65735


More information about the llvm-commits mailing list