Skip to content

Commit 3c8bb18

Browse files
committed
[AArch64][SME] Don't use OBSCURE_COPY to avoid rematerialization.
This is intended to be a non-functional change. This patch removes OBSCURE_COPY in favour of using `forceDisableTriviallyReMaterializable`. Reviewed By: paulwalker-arm Differential Revision: https://reviews.llvm.org/D159194
1 parent a0e3418 commit 3c8bb18

File tree

5 files changed

+5
-31
lines changed

5 files changed

+5
-31
lines changed

llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,17 +1515,6 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock &MBB,
15151515
NextMBBI = MBB.end(); // The NextMBBI iterator is invalidated.
15161516
return true;
15171517
}
1518-
case AArch64::OBSCURE_COPY: {
1519-
if (MI.getOperand(0).getReg() != MI.getOperand(1).getReg()) {
1520-
BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(AArch64::ORRXrs))
1521-
.add(MI.getOperand(0))
1522-
.addReg(AArch64::XZR)
1523-
.add(MI.getOperand(1))
1524-
.addImm(0);
1525-
}
1526-
MI.eraseFromParent();
1527-
return true;
1528-
}
15291518
case AArch64::LD1B_2Z_IMM_PSEUDO:
15301519
return expandMultiVecPseudo(
15311520
MBB, MBBI, AArch64::ZPR2RegClass, AArch64::ZPR2StridedRegClass,

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,6 @@ const char *AArch64TargetLowering::getTargetNodeName(unsigned Opcode) const {
23032303
switch ((AArch64ISD::NodeType)Opcode) {
23042304
case AArch64ISD::FIRST_NUMBER:
23052305
break;
2306-
MAKE_CASE(AArch64ISD::OBSCURE_COPY)
23072306
MAKE_CASE(AArch64ISD::SMSTART)
23082307
MAKE_CASE(AArch64ISD::SMSTOP)
23092308
MAKE_CASE(AArch64ISD::RESTORE_ZA)
@@ -7510,11 +7509,6 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
75107509
return ArgReg.Reg == VA.getLocReg();
75117510
});
75127511
} else {
7513-
// Add an extra level of indirection for streaming mode changes by
7514-
// using a pseudo copy node that cannot be rematerialised between a
7515-
// smstart/smstop and the call by the simple register coalescer.
7516-
if (RequiresSMChange && isa<FrameIndexSDNode>(Arg))
7517-
Arg = DAG.getNode(AArch64ISD::OBSCURE_COPY, DL, MVT::i64, Arg);
75187512
RegsToPass.emplace_back(VA.getLocReg(), Arg);
75197513
RegsUsed.insert(VA.getLocReg());
75207514
const TargetOptions &Options = DAG.getTarget().Options;

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ enum NodeType : unsigned {
5858

5959
CALL_BTI, // Function call followed by a BTI instruction.
6060

61-
// Essentially like a normal COPY that works on GPRs, but cannot be
62-
// rematerialised by passes like the simple register coalescer. It's
63-
// required for SME when lowering calls because we cannot allow frame
64-
// index calculations using addvl to slip in between the smstart/smstop
65-
// and the bl instruction. The scalable vector length may change across
66-
// the smstart/smstop boundary.
67-
OBSCURE_COPY,
6861
SMSTART,
6962
SMSTOP,
7063
RESTORE_ZA,

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8538,7 +8538,11 @@ bool AArch64InstrInfo::isReallyTriviallyReMaterializable(
85388538
// scalable values, such as 'pfalse' or 'ptrue', which result in different
85398539
// results when the runtime vector length is different.
85408540
const MachineRegisterInfo &MRI = MF.getRegInfo();
8541-
if (any_of(MI.operands(), [&MRI](const MachineOperand &MO) {
8541+
const MachineFrameInfo &MFI = MF.getFrameInfo();
8542+
if (any_of(MI.operands(), [&MRI, &MFI](const MachineOperand &MO) {
8543+
if (MO.isFI() &&
8544+
MFI.getStackID(MO.getIndex()) == TargetStackID::ScalableVector)
8545+
return true;
85428546
if (!MO.isReg())
85438547
return false;
85448548

llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ def AArch64_restore_za : SDNode<"AArch64ISD::RESTORE_ZA", SDTypeProfile<0, 3,
2323
[SDNPHasChain, SDNPSideEffect, SDNPVariadic,
2424
SDNPOptInGlue]>;
2525

26-
def AArch64ObscureCopy : SDNode<"AArch64ISD::OBSCURE_COPY", SDTypeProfile<1, 1, []>, []>;
27-
2826
//===----------------------------------------------------------------------===//
2927
// Instruction naming conventions.
3028
//===----------------------------------------------------------------------===//
@@ -185,10 +183,6 @@ def : Pat<(int_aarch64_sme_set_tpidr2 i64:$val),
185183
(MSR 0xde85, GPR64:$val)>;
186184
def : Pat<(i64 (int_aarch64_sme_get_tpidr2)),
187185
(MRS 0xde85)>;
188-
189-
def OBSCURE_COPY : Pseudo<(outs GPR64:$dst), (ins GPR64:$idx), []>, Sched<[]> { }
190-
def : Pat<(i64 (AArch64ObscureCopy (i64 GPR64:$idx))),
191-
(OBSCURE_COPY GPR64:$idx)>;
192186
} // End let Predicates = [HasSME]
193187

194188
// Pseudo to match to smstart/smstop. This expands:

0 commit comments

Comments
 (0)