[clang] [llvm] [clang-tools-extra] [AArch64] Implement -fno-plt for SelectionDAG/GlobalISel (PR #78890)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 5 10:37:48 PST 2024
================
@@ -1293,8 +1293,19 @@ bool AArch64CallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
!Subtarget.noBTIAtReturnTwice() &&
MF.getInfo<AArch64FunctionInfo>()->branchTargetEnforcement())
Opc = AArch64::BLR_BTI;
- else
+ else {
+ // For an intrinsic call (e.g. memset), use GOT if "RtLibUseGOT" (-fno-plt)
+ // is set.
+ if (Info.Callee.isSymbol() && F.getParent()->getRtLibUseGOT()) {
+ auto Reg =
+ MRI.createGenericVirtualRegister(getLLTForType(*F.getType(), DL));
+ auto MIB = MIRBuilder.buildInstr(TargetOpcode::G_GLOBAL_VALUE);
+ DstOp(Reg).addDefToMIB(MRI, MIB);
----------------
MaskRay wrote:
Did you propose a new MachineIRBuilder API? This is a special use of `buildInstr(TargetOpcode::G_GLOBAL_VALUE)` and there is only one. I think avoid adding another API is good for now.
https://github.com/llvm/llvm-project/pull/78890
More information about the cfe-commits
mailing list