[llvm] [AArch64] Resolve FIXME: Use scavengeRegisterBackwards to find the best unused register (PR #78910)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 03:19:47 PST 2024


================
@@ -296,17 +296,9 @@ bool AArch64SpeculationHardening::instrumentControlFlow(
     // The RegScavenger represents registers available *after* the MI
     // instruction pointed to by RS.getCurrentPosition().
     // We need to have a register that is available *before* the MI is executed.
-    if (I == MBB.begin())
-      RS.enterBasicBlock(MBB);
-    else
-      RS.backward(I);
-    // FIXME: The below just finds *a* unused register. Maybe code could be
-    // optimized more if this looks for the register that isn't used for the
-    // longest time around this place, to enable more scheduling freedom. Not
-    // sure if that would actually result in a big performance difference
-    // though. Maybe RegisterScavenger::findSurvivorBackwards has some logic
-    // already to do this - but it's unclear if that could easily be used here.
----------------
arsenm wrote:

This comment should probably be reserved, fundamentally the scavenge is still doing the same thing and not finding a "nicer" register 

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


More information about the llvm-commits mailing list