[llvm] [NVPTX][NFC] Use same logic to get alignment in param declarations and function prototypes (PR #98220)
Kevin McAfee via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 14:59:28 PDT 2024
================
@@ -1438,10 +1438,8 @@ std::string NVPTXTargetLowering::getPrototype(
if (!Outs[OIdx].Flags.isByVal()) {
if (IsTypePassedAsArray(Ty)) {
- const CallInst *CallI = cast<CallInst>(&CB);
Align ParamAlign =
- getAlign(*CallI, i + AttributeList::FirstArgIndex)
- .value_or(getFunctionParamOptimizedAlign(F, Ty, DL));
+ getArgumentAlignment(&CB, Ty, i + AttributeList::FirstArgIndex, DL);
----------------
kalxr wrote:
If there is no alignment metadata or the call is indirect, the `getArgumentAlignment` path ultimately uses `getFunctionParamOptimizedAlign`. If the call is indirect it uses the ABI type alignment, which `getFunctionParamOptimizedAlign` does as well, so we shouldn't lose out on opportunities for increased alignments.
Unfortunately, I don't think we can test that the increased alignment remains right now. We only emit prototypes for indirect calls, which would use the ABI type alignment.
https://github.com/llvm/llvm-project/pull/98220
More information about the llvm-commits
mailing list