[PATCH] D141931: [BOLT] Fix error for -reg-reassign option

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 16:06:01 PST 2023


rafauler added a comment.

Thanks for fixing this, @hzq !

Some suggestions below.

Ideally we would have a test case loosely similar to this one (https://reviews.llvm.org/D138245) that shows that the fix is working as intended. Let me know if you need help writing this.

Finally, be aware that this pass is also experimental because it does not update debug info. So it really depends on how serious you are about keeping debug info accurate.



================
Comment at: bolt/include/bolt/Core/BinaryFunction.h:366
   /// All fragments for a parent function.
   SmallPtrSet<BinaryFunction *, 1> Fragments;
 
----------------



================
Comment at: bolt/include/bolt/Core/BinaryFunction.h:1835-1837
+  SmallPtrSet<BinaryFunction *, 1> getFragments() {
+    return Fragments;
+  }
----------------



================
Comment at: bolt/lib/Passes/RegReAssign.cpp:311-313
+    for (BinaryFunction *childF : Function.getFragments()) {
+      swap(*childF, RBX, Candidate);
+      FuncsChanged.insert(childF);
----------------



================
Comment at: bolt/lib/Passes/RegReAssign.cpp:356-358
+  for (BinaryFunction *childF : Function.getFragments()) {
+    swap(*childF, RBX, Candidate);
+    FuncsChanged.insert(childF);
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141931



More information about the llvm-commits mailing list