Skip to content

Commit 2a73a79

Browse files
authored
DAG: Remove TargetLowering::checkForPhysRegDependency (#161787)
I have no idea why this was here. The only implementation was AMDGPU, which was essentially repeating the generic logic but for one specific case.
1 parent 78c5d91 commit 2a73a79

File tree

4 files changed

+1
-53
lines changed

4 files changed

+1
-53
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4654,23 +4654,6 @@ class LLVM_ABI TargetLowering : public TargetLoweringBase {
46544654
return false;
46554655
}
46564656

4657-
/// Allows the target to handle physreg-carried dependency
4658-
/// in target-specific way. Used from the ScheduleDAGSDNodes to decide whether
4659-
/// to add the edge to the dependency graph.
4660-
/// Def - input: Selection DAG node defininfg physical register
4661-
/// User - input: Selection DAG node using physical register
4662-
/// Op - input: Number of User operand
4663-
/// PhysReg - inout: set to the physical register if the edge is
4664-
/// necessary, unchanged otherwise
4665-
/// Cost - inout: physical register copy cost.
4666-
/// Returns 'true' is the edge is necessary, 'false' otherwise
4667-
virtual bool checkForPhysRegDependency(SDNode *Def, SDNode *User, unsigned Op,
4668-
const TargetRegisterInfo *TRI,
4669-
const TargetInstrInfo *TII,
4670-
MCRegister &PhysReg, int &Cost) const {
4671-
return false;
4672-
}
4673-
46744657
/// Target-specific combining of register parts into its original value
46754658
virtual SDValue
46764659
joinRegisterPartsIntoValue(SelectionDAG &DAG, const SDLoc &DL,

llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,11 @@ SUnit *ScheduleDAGSDNodes::Clone(SUnit *Old) {
111111
static void CheckForPhysRegDependency(SDNode *Def, SDNode *User, unsigned Op,
112112
const TargetRegisterInfo *TRI,
113113
const TargetInstrInfo *TII,
114-
const TargetLowering &TLI,
115114
MCRegister &PhysReg, int &Cost) {
116115
if (Op != 2 || User->getOpcode() != ISD::CopyToReg)
117116
return;
118117

119118
Register Reg = cast<RegisterSDNode>(User->getOperand(1))->getReg();
120-
if (TLI.checkForPhysRegDependency(Def, User, Op, TRI, TII, PhysReg, Cost))
121-
return;
122-
123119
if (Reg.isVirtual())
124120
return;
125121

@@ -490,8 +486,7 @@ void ScheduleDAGSDNodes::AddSchedEdges() {
490486
MCRegister PhysReg;
491487
int Cost = 1;
492488
// Determine if this is a physical register dependency.
493-
const TargetLowering &TLI = DAG->getTargetLoweringInfo();
494-
CheckForPhysRegDependency(OpN, N, i, TRI, TII, TLI, PhysReg, Cost);
489+
CheckForPhysRegDependency(OpN, N, i, TRI, TII, PhysReg, Cost);
495490
assert((!PhysReg || !isChain) && "Chain dependence via physreg data?");
496491
// FIXME: See ScheduleDAGSDNodes::EmitCopyFromReg. For now, scheduler
497492
// emits a copy from the physical register to a virtual register unless

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18860,31 +18860,6 @@ SITargetLowering::getTargetMMOFlags(const Instruction &I) const {
1886018860
return Flags;
1886118861
}
1886218862

18863-
bool SITargetLowering::checkForPhysRegDependency(
18864-
SDNode *Def, SDNode *User, unsigned Op, const TargetRegisterInfo *TRI,
18865-
const TargetInstrInfo *TII, MCRegister &PhysReg, int &Cost) const {
18866-
if (User->getOpcode() != ISD::CopyToReg)
18867-
return false;
18868-
if (!Def->isMachineOpcode())
18869-
return false;
18870-
MachineSDNode *MDef = dyn_cast<MachineSDNode>(Def);
18871-
if (!MDef)
18872-
return false;
18873-
18874-
unsigned ResNo = User->getOperand(Op).getResNo();
18875-
if (User->getOperand(Op)->getValueType(ResNo) != MVT::i1)
18876-
return false;
18877-
const MCInstrDesc &II = TII->get(MDef->getMachineOpcode());
18878-
if (II.isCompare() && II.hasImplicitDefOfPhysReg(AMDGPU::SCC)) {
18879-
PhysReg = AMDGPU::SCC;
18880-
const TargetRegisterClass *RC =
18881-
TRI->getMinimalPhysRegClass(PhysReg, Def->getSimpleValueType(ResNo));
18882-
Cost = RC->expensiveOrImpossibleToCopy() ? -1 : RC->getCopyCost();
18883-
return true;
18884-
}
18885-
return false;
18886-
}
18887-
1888818863
void SITargetLowering::emitExpandAtomicAddrSpacePredicate(
1888918864
Instruction *AI) const {
1889018865
// Given: atomicrmw fadd ptr %addr, float %val ordering

llvm/lib/Target/AMDGPU/SIISelLowering.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,6 @@ class SITargetLowering final : public AMDGPUTargetLowering {
561561
bool denormalsEnabledForType(const SelectionDAG &DAG, EVT VT) const;
562562
bool denormalsEnabledForType(LLT Ty, const MachineFunction &MF) const;
563563

564-
bool checkForPhysRegDependency(SDNode *Def, SDNode *User, unsigned Op,
565-
const TargetRegisterInfo *TRI,
566-
const TargetInstrInfo *TII,
567-
MCRegister &PhysReg, int &Cost) const override;
568-
569564
bool isKnownNeverNaNForTargetNode(SDValue Op, const APInt &DemandedElts,
570565
const SelectionDAG &DAG, bool SNaN = false,
571566
unsigned Depth = 0) const override;

0 commit comments

Comments
 (0)