[llvm] [MLGO] Count LR Evictions Rather than Relying on Cascade (PR #124440)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 10:49:15 PST 2025


================
@@ -803,6 +805,21 @@ MCRegister MLEvictAdvisor::tryFindEvictionCandidate(
   }
   assert(CandidatePos < ValidPosLimit);
   (void)ValidPosLimit;
+
+  // Update information about how many times the virtual registers being
+  // evicted have been evicted.
+  if (CandidatePos == CandidateVirtRegPos) {
+    VirtRegEvictionCounts[VirtReg.reg()] += 1;
----------------
mtrofin wrote:

wrap this increment in a small private function, like `incrementEvictCount`, for readability. The function wouldn't need to be const. Is there a reason to keep the field `mutable`?

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


More information about the llvm-commits mailing list