[llvm] 88cbc8c - [NVPTX][NFC] Use same logic to get alignment in param declarations and function prototypes (#98220)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 09:11:03 PDT 2024
Author: Kevin McAfee
Date: 2024-07-11T09:10:59-07:00
New Revision: 88cbc8ce58a0e6724f3054c7d65a494999d85483
URL: https://github.com/llvm/llvm-project/commit/88cbc8ce58a0e6724f3054c7d65a494999d85483
DIFF: https://github.com/llvm/llvm-project/commit/88cbc8ce58a0e6724f3054c7d65a494999d85483.diff
LOG: [NVPTX][NFC] Use same logic to get alignment in param declarations and function prototypes (#98220)
Unifies the logic used to choose function prototype argument alignment
and param alignment declared in the caller. The call in `getPrototype`
to `getAlign`/`getFunctionParamOptimizedAlign` is replaced with
`getArgumentAlignment`, which is what is currently used to select the
alignment for the param declarations. This avoids code duplication of
`getAlign().value_or(getFunctionParamOptimizedAlign())` and ensures that
param alignments are the same in declarations and prototypes.
Added:
Modified:
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 26c16ee9fd18f..9fccfb26eb6fe 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -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);
O << ".param .align " << ParamAlign.value() << " .b8 ";
O << "_";
O << "[" << DL.getTypeAllocSize(Ty) << "]";
More information about the llvm-commits
mailing list