[llvm] Resolve FIXME: use RegScavenger to find the best unused register (PR #78910)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 21 12:01:18 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-aarch64
Author: AtariDreams (AtariDreams)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/78910.diff
1 Files Affected:
- (modified) llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp (+2-7)
``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp b/llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp
index a991d645eb6f405..86135ef39d82148 100644
--- a/llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp
+++ b/llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp
@@ -300,13 +300,8 @@ bool AArch64SpeculationHardening::instrumentControlFlow(
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.
- Register TmpReg = RS.FindUnusedReg(&AArch64::GPR64commonRegClass);
+ Register TmpReg = RS.scavengeRegisterBackwards(AArch64::GPR64commonRegClass,
+ I, false, 0, false);
LLVM_DEBUG(dbgs() << "RS finds "
<< ((TmpReg == 0) ? "no register " : "register ");
if (TmpReg != 0) dbgs() << printReg(TmpReg, TRI) << " ";
``````````
</details>
https://github.com/llvm/llvm-project/pull/78910
More information about the llvm-commits
mailing list