[llvm] [NVPTX] Cleanup and refactor param align computation, addressing a few minor bugs and discrepancies (PR #188588)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 22:13:19 PDT 2026


================
@@ -38,14 +38,26 @@ Function *getMaybeBitcastedCallee(const CallBase *CB);
 /// function has internal or private linkage as for other linkage types callers
 /// may already rely on default alignment. To allow using 128-bit vectorized
 /// loads/stores, this function ensures that alignment is 16 or greater.
-Align getFunctionParamOptimizedAlign(const Function *F, Type *ArgTy,
-                                     const DataLayout &DL);
-
-Align getFunctionArgumentAlignment(const Function *F, Type *Ty, unsigned Idx,
-                                   const DataLayout &DL);
-
-Align getFunctionByValParamAlign(const Function *F, Type *ArgTy,
-                                 Align InitialAlign, const DataLayout &DL);
+Align getPromotedParamTypeAlign(const Function *F, Type *ArgTy,
+                                const DataLayout &DL);
+
+Align getDeviceByValParamAlign(const Function *F, Type *ArgTy,
+                               Align InitialAlign, const DataLayout &DL);
+
+/// Get the alignment for a function parameter or return value.
+/// \p AttrIdx is the AttributeList index (e.g. FirstArgIndex + argNo, or
+/// ReturnIndex for return values). Checks for an explicit alignment attribute,
+/// then falls back to getPromotedParamTypeAlign, incorporating byval param
+/// alignment when applicable.
+Align getParamAlign(const Function *F, Type *Ty, unsigned AttrIdx,
----------------
AlexMaclean wrote:

Sounds good, I've added PTX to these function names to clarify. 

https://github.com/llvm/llvm-project/pull/188588


More information about the llvm-commits mailing list