[CodeGen] Remove parameter from LiveRangeEdit::canRematerializeAt [NFC]
Only one caller cares about the true case of this parameter, so move the check to that single caller. Note that RegisterCoalescer seems like it should care, but it already duplicates the check several lines above.
This commit is contained in:
committed by
Philip Reames
parent
befb52db94
commit
bdb4012fe3
@@ -200,9 +200,7 @@ public:
|
||||
|
||||
/// canRematerializeAt - Determine if ParentVNI can be rematerialized at
|
||||
/// UseIdx. It is assumed that parent_.getVNINfoAt(UseIdx) == ParentVNI.
|
||||
/// When cheapAsAMove is set, only cheap remats are allowed.
|
||||
bool canRematerializeAt(Remat &RM, VNInfo *OrigVNI, SlotIndex UseIdx,
|
||||
bool cheapAsAMove);
|
||||
bool canRematerializeAt(Remat &RM, VNInfo *OrigVNI, SlotIndex UseIdx);
|
||||
|
||||
/// rematerializeAt - Rematerialize RM.ParentVNI into DestReg by inserting an
|
||||
/// instruction into MBB before MI. The new instruction is mapped, but
|
||||
|
||||
@@ -644,7 +644,7 @@ bool InlineSpiller::reMaterializeFor(LiveInterval &VirtReg, MachineInstr &MI) {
|
||||
LiveRangeEdit::Remat RM(ParentVNI);
|
||||
RM.OrigMI = LIS.getInstructionFromIndex(OrigVNI->def);
|
||||
|
||||
if (!Edit->canRematerializeAt(RM, OrigVNI, UseIdx, false)) {
|
||||
if (!Edit->canRematerializeAt(RM, OrigVNI, UseIdx)) {
|
||||
markValueUsed(&VirtReg, ParentVNI);
|
||||
LLVM_DEBUG(dbgs() << "\tcannot remat for " << UseIdx << '\t' << MI);
|
||||
return false;
|
||||
|
||||
@@ -156,7 +156,7 @@ bool LiveRangeEdit::allUsesAvailableAt(const MachineInstr *OrigMI,
|
||||
}
|
||||
|
||||
bool LiveRangeEdit::canRematerializeAt(Remat &RM, VNInfo *OrigVNI,
|
||||
SlotIndex UseIdx, bool cheapAsAMove) {
|
||||
SlotIndex UseIdx) {
|
||||
assert(ScannedRemattable && "Call anyRematerializable first");
|
||||
|
||||
// Use scanRemattable info.
|
||||
@@ -168,10 +168,6 @@ bool LiveRangeEdit::canRematerializeAt(Remat &RM, VNInfo *OrigVNI,
|
||||
assert(RM.OrigMI && "No defining instruction for remattable value");
|
||||
DefIdx = LIS.getInstructionIndex(*RM.OrigMI);
|
||||
|
||||
// If only cheap remats were requested, bail out early.
|
||||
if (cheapAsAMove && !TII.isAsCheapAsAMove(*RM.OrigMI))
|
||||
return false;
|
||||
|
||||
// Verify that all used registers are available with the same values.
|
||||
if (!allUsesAvailableAt(RM.OrigMI, DefIdx, UseIdx))
|
||||
return false;
|
||||
|
||||
@@ -1398,7 +1398,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
|
||||
|
||||
LiveRangeEdit::Remat RM(ValNo);
|
||||
RM.OrigMI = DefMI;
|
||||
if (!Edit.canRematerializeAt(RM, ValNo, CopyIdx, true))
|
||||
if (!Edit.canRematerializeAt(RM, ValNo, CopyIdx))
|
||||
return false;
|
||||
|
||||
DebugLoc DL = CopyMI->getDebugLoc();
|
||||
|
||||
@@ -591,9 +591,6 @@ SlotIndex SplitEditor::buildCopy(Register FromReg, Register ToReg,
|
||||
bool SplitEditor::rematWillIncreaseRestriction(const MachineInstr *DefMI,
|
||||
MachineBasicBlock &MBB,
|
||||
SlotIndex UseIdx) const {
|
||||
if (!DefMI)
|
||||
return false;
|
||||
|
||||
const MachineInstr *UseMI = LIS.getInstructionFromIndex(UseIdx);
|
||||
if (!UseMI)
|
||||
return false;
|
||||
@@ -640,7 +637,8 @@ VNInfo *SplitEditor::defFromParent(unsigned RegIdx, const VNInfo *ParentVNI,
|
||||
if (OrigVNI) {
|
||||
LiveRangeEdit::Remat RM(ParentVNI);
|
||||
RM.OrigMI = LIS.getInstructionFromIndex(OrigVNI->def);
|
||||
if (Edit->canRematerializeAt(RM, OrigVNI, UseIdx, true)) {
|
||||
if (RM.OrigMI && TII.isAsCheapAsAMove(*RM.OrigMI) &&
|
||||
Edit->canRematerializeAt(RM, OrigVNI, UseIdx)) {
|
||||
if (!rematWillIncreaseRestriction(RM.OrigMI, MBB, UseIdx)) {
|
||||
SlotIndex Def = Edit->rematerializeAt(MBB, I, Reg, RM, TRI, Late);
|
||||
++NumRemats;
|
||||
|
||||
Reference in New Issue
Block a user