[PATCH] D120161: [AArch64][GlobalISel] Constrain the right MOs when lowering calls.
Ahmed Bougacha via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 18 13:16:33 PST 2022
ab created this revision.
ab added reviewers: aemerson, fhahn, paquette.
Herald added subscribers: hiraditya, kristof.beyls, rovka.
Herald added a reviewer: apazos.
ab requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
>From what I can tell, this was constraining the stale Info.Callee MO instead of the one we copied into the MI.
In addition, with c8b8c8e989e <https://reviews.llvm.org/rGc8b8c8e989e5aaf53494ea2f5021d238b6d77184>, when there's an attachedcall, the Callee is at position 1 rather than 0.
Found downstream with ptrauth, which has a full operand list in its description rather than variable_ops.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120161
Files:
llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
Index: llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
+++ llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
@@ -1059,10 +1059,10 @@
// If Callee is a reg, since it is used by a target specific instruction,
// it must have a register class matching the constraint of that instruction.
- if (Info.Callee.isReg())
+ if (MIB->getOperand(0).isReg())
constrainOperandRegClass(MF, *TRI, MRI, *MF.getSubtarget().getInstrInfo(),
*MF.getSubtarget().getRegBankInfo(), *MIB,
- MIB->getDesc(), Info.Callee, 0);
+ MIB->getDesc(), MIB->getOperand(0), 0);
MF.getFrameInfo().setHasTailCall();
Info.LoweredTailCall = true;
@@ -1139,12 +1139,16 @@
Opc = getCallOpcode(MF, Info.Callee.isReg(), false);
auto MIB = MIRBuilder.buildInstrNoInsert(Opc);
+ unsigned CalleeOpNo = 0;
+
if (Opc == AArch64::BLR_RVMARKER) {
// Add a target global address for the retainRV/claimRV runtime function
// just before the call target.
Function *ARCFn = *objcarc::getAttachedARCFunction(Info.CB);
MIB.addGlobalAddress(ARCFn);
+ ++CalleeOpNo;
}
+
MIB.add(Info.Callee);
// Tell the call which registers are clobbered.
@@ -1175,10 +1179,10 @@
// If Callee is a reg, since it is used by a target specific
// instruction, it must have a register class matching the
// constraint of that instruction.
- if (Info.Callee.isReg())
+ if (MIB->getOperand(CalleeOpNo).isReg())
constrainOperandRegClass(MF, *TRI, MRI, *Subtarget.getInstrInfo(),
*Subtarget.getRegBankInfo(), *MIB, MIB->getDesc(),
- Info.Callee, 0);
+ MIB->getOperand(CalleeOpNo), CalleeOpNo);
// Finally we can copy the returned value back into its virtual-register. In
// symmetry with the arguments, the physical register must be an
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120161.410009.patch
Type: text/x-patch
Size: 2055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220218/759f50e1/attachment.bin>
More information about the llvm-commits
mailing list