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

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 10:55:32 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;
----------------
boomanaiden154 wrote:

`tryFindEvictionCandidate` is marked `const`, so a function like `incrementEvictCount` would also need to be `const`, unless we refactor those functions to be non-const. That's also why the field is mutable.

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


More information about the llvm-commits mailing list