[llvm] [AArch64] Implement -fno-plt for SelectionDAG/GlobalISel (PR #78890)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 21:42:17 PST 2024
================
@@ -144,9 +144,16 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, const CallBase &CB,
// Try looking through a bitcast from one function type to another.
// Commonly happens with calls to objc_msgSend().
const Value *CalleeV = CB.getCalledOperand()->stripPointerCasts();
- if (const Function *F = dyn_cast<Function>(CalleeV))
- Info.Callee = MachineOperand::CreateGA(F, 0);
- else if (isa<GlobalIFunc>(CalleeV) || isa<GlobalAlias>(CalleeV)) {
+ if (const Function *F = dyn_cast<Function>(CalleeV)) {
+ if (F->hasFnAttribute(Attribute::NonLazyBind)) {
+ auto Reg =
+ MRI.createGenericVirtualRegister(getLLTForType(*F->getType(), DL));
+ MIRBuilder.buildGlobalValue(Reg, F);
----------------
MaskRay wrote:
After clang-format, this becomes
```
- auto Reg =
- MRI.createGenericVirtualRegister(getLLTForType(*F->getType(), DL));
- MIRBuilder.buildGlobalValue(Reg, F);
+ Register Reg =
+ MIRBuilder.buildGlobalValue(getLLTForType(*F->getType(), DL), F)
+ .getReg(0);
```
which is not shorter... In addition, the new code `AArch64CallLowering.cpp` uses `createGenericVirtualRegister`. So sticking with `createGenericVirtualRegister` here adds consistency.
https://github.com/llvm/llvm-project/pull/78890
More information about the llvm-commits
mailing list