Skip to content

Commit

Permalink
[ARC] Use backwards scavenging in frame index elimination
Browse files Browse the repository at this point in the history
This is preferred because it does not rely on accurate kill flags.

Differential Revision: https://reviews.llvm.org/D150599
  • Loading branch information
jayfoad committed May 18, 2023
1 parent e13f88d commit a8dd9f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/Target/ARC/ARCRegisterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/ARC/ARCRegisterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a8dd9f4

Please sign in to comment.