Alignment of function arguments can be increased only if we can do
this for all call sites. Therefore we do not increase it for external
functions, and now we skip functions that have address taken, to avoid
any issues with functions pointers.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Without the patch, @callee has alignment of 16, while the call site uses alignment of 4 for param memory.
We also need D134548 to fix handling of bitcasts.
Comment Actions
> Index: llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp > =================================================================== > --- llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp > +++ llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp > @@ -4326,8 +4326,13 @@ > const uint64_t ABITypeAlign = DL.getABITypeAlign(ArgTy).value(); > > // If a function has linkage different from internal or private, we > - // must use default ABI alignment as external users rely on it. > - if (!(F && F->hasLocalLinkage())) > + // must use default ABI alignment as external users rely on it. Same > + // for a function that may be called from a function pointer. > + if (!F || !F->hasLocalLinkage()) || > + F->hasAddressTaken(/*Users=*/nullptr, > + /*IgnoreCallbackUses=*/false, > + /*IgnoreAssumeLikeCalls=*/true, > + /*IngoreLLVMUsed=*/true)) > return Align(ABITypeAlign); > > assert(!isKernelFunction(*F) && "Expect kernels to have non-local > linkage");
s/IngoreLLVMUsed/IgnoreLLVMUsed/g
otherwise LGTM
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | ||
---|---|---|
4345 | There's actually a syntax error here. |
Comment Actions
- Fixed typos
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | ||
---|---|---|
4345 | Right, I planned to fix this before landing, along with the typo below. |
There's actually a syntax error here.