[PATCH] D134166: [MLGO] Add per-instruction MBB frequencies to regalloc dev features

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 24 00:11:39 PDT 2022


aidengrossman added inline comments.


================
Comment at: llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp:1048
+                         const int MBBMappingIndex) {
+  size_t CurrentMBBIndex = VisitedMBBs[CurrentMBBName];
+  float CurrentMBBFreq = GetMBBFreq(CurrentIndex);
----------------
mtrofin wrote:
> aidengrossman wrote:
> > mtrofin wrote:
> > > Why not use the MBB address?
> > Give me a little bit of time to do some experimentation/investigation, but I tried calling `getSectionIDNum()` and utilizing that, but it would only return a single value for all the MBBs in the MF (only a single value would appear in the map).
> I mean &MBB. I.e. `MachineBasicBlock*`
Mapping using the MBB pointer as the key works perfectly and avoids passing around/generating strings. I've switched over. I had to do some slightly unorthodox casting to generate some test values in the unittest. I've added a comment explaining it, but if necessary I can modify it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134166/new/

https://reviews.llvm.org/D134166



More information about the llvm-commits mailing list