[PATCH] D150560: [AArch64] Avoid RegScavenger::forward in AArch64SpeculationHardening
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 01:32:55 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG910af0e79e4d: [AArch64] Avoid RegScavenger::forward in AArch64SpeculationHardening (authored by foad).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150560/new/
https://reviews.llvm.org/D150560
Files:
llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp
Index: llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp
+++ llvm/lib/Target/AArch64/AArch64SpeculationHardening.cpp
@@ -286,18 +286,20 @@
bool TmpRegisterNotAvailableEverywhere = false;
RegScavenger RS;
- RS.enterBasicBlock(MBB);
+ RS.enterBasicBlockEnd(MBB);
- for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); I++) {
- MachineInstr &MI = *I;
+ for (MachineBasicBlock::iterator I = MBB.end(); I != MBB.begin(); ) {
+ MachineInstr &MI = *--I;
if (!MI.isReturn() && !MI.isCall())
continue;
// 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.forward(std::prev(I));
+ if (I == MBB.begin())
+ RS.enterBasicBlock(MBB);
+ else
+ RS.backward(std::prev(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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150560.524607.patch
Type: text/x-patch
Size: 1283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230523/a616faee/attachment-0001.bin>
More information about the llvm-commits
mailing list