[llvm] [SystemZ] Avoid modifying IR in mcount instrumentation. (PR #152298)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 06:58:49 PDT 2025
================
@@ -574,13 +574,11 @@ void SystemZELFFrameLowering::emitPrologue(MachineFunction &MF,
// Call mcount (Regmask from CC AnyReg since mcount preserves all normal
// argument registers).
- FunctionCallee FC = MF.getFunction().getParent()->getOrInsertFunction(
- "mcount", Type::getVoidTy(MF.getFunction().getContext()));
const uint32_t *Mask = MF.getSubtarget<SystemZSubtarget>()
.getSpecialRegisters()
->getCallPreservedMask(MF, CallingConv::AnyReg);
BuildMI(MBB, MBBI, DL, ZII->get(SystemZ::CallBRASL))
- .addGlobalAddress(dyn_cast<Function>(FC.getCallee()))
+ .addExternalSymbol(MF.createExternalSymbolName("mcount"))
----------------
uweigand wrote:
Why do we need the `createExternalSymbolName` here? Shouldn't pointing to a string constant directly be just fine?
https://github.com/llvm/llvm-project/pull/152298
More information about the llvm-commits
mailing list