Skip to content

Commit 88cbc8c

Browse files
authored
[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.
1 parent ae18b94 commit 88cbc8c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,10 +1438,8 @@ std::string NVPTXTargetLowering::getPrototype(
14381438

14391439
if (!Outs[OIdx].Flags.isByVal()) {
14401440
if (IsTypePassedAsArray(Ty)) {
1441-
const CallInst *CallI = cast<CallInst>(&CB);
14421441
Align ParamAlign =
1443-
getAlign(*CallI, i + AttributeList::FirstArgIndex)
1444-
.value_or(getFunctionParamOptimizedAlign(F, Ty, DL));
1442+
getArgumentAlignment(&CB, Ty, i + AttributeList::FirstArgIndex, DL);
14451443
O << ".param .align " << ParamAlign.value() << " .b8 ";
14461444
O << "_";
14471445
O << "[" << DL.getTypeAllocSize(Ty) << "]";

0 commit comments

Comments
 (0)