[llvm] a8dd9f4 - [ARC] Use backwards scavenging in frame index elimination
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu May 18 02:05:47 PDT 2023
Author: Jay Foad
Date: 2023-05-18T09:58:44+01:00
New Revision: a8dd9f42b7f437b233b1cd98e0c4c12aa2fab2f4
URL: https://github.com/llvm/llvm-project/commit/a8dd9f42b7f437b233b1cd98e0c4c12aa2fab2f4
DIFF: https://github.com/llvm/llvm-project/commit/a8dd9f42b7f437b233b1cd98e0c4c12aa2fab2f4.diff
LOG: [ARC] Use backwards scavenging in frame index elimination
This is preferred because it does not rely on accurate kill flags.
Differential Revision: https://reviews.llvm.org/D150599
Added:
Modified:
llvm/lib/Target/ARC/ARCRegisterInfo.cpp
llvm/lib/Target/ARC/ARCRegisterInfo.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARC/ARCRegisterInfo.cpp b/llvm/lib/Target/ARC/ARCRegisterInfo.cpp
index 4b818c0b539d..28dca4f4663f 100644
--- a/llvm/lib/Target/ARC/ARCRegisterInfo.cpp
+++ b/llvm/lib/Target/ARC/ARCRegisterInfo.cpp
@@ -63,7 +63,8 @@ static void replaceFrameIndex(MachineBasicBlock::iterator II,
// of the load offset.
const TargetRegisterInfo *TRI =
MBB.getParent()->getSubtarget().getRegisterInfo();
- BaseReg = RS->scavengeRegister(&ARC::GPR32RegClass, II, SPAdj);
+ BaseReg =
+ RS->scavengeRegisterBackwards(ARC::GPR32RegClass, II, false, SPAdj);
assert(BaseReg && "Register scavenging failed.");
LLVM_DEBUG(dbgs() << "Scavenged register " << printReg(BaseReg, TRI)
<< " for FrameReg=" << printReg(FrameReg, TRI)
diff --git a/llvm/lib/Target/ARC/ARCRegisterInfo.h b/llvm/lib/Target/ARC/ARCRegisterInfo.h
index ea82289022eb..fce4b6980450 100644
--- a/llvm/lib/Target/ARC/ARCRegisterInfo.h
+++ b/llvm/lib/Target/ARC/ARCRegisterInfo.h
@@ -39,6 +39,8 @@ struct ARCRegisterInfo : public ARCGenRegisterInfo {
bool useFPForScavengingIndex(const MachineFunction &MF) const override;
+ bool supportsBackwardScavenger() const override { return true; }
+
bool eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
unsigned FIOperandNum,
RegScavenger *RS = nullptr) const override;
More information about the llvm-commits
mailing list