[llvm] [NVPTX][NFC] Use same logic to get alignment in param declarations and function prototypes (PR #98220)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 14:04:14 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);
----------------
Artem-B wrote:

One of the things `getFunctionParamOptimizedAlign` is doing is `increase their alignment in a way that
ensures that we can effectively vectorize their loads & stores.` 
https://github.com/llvm/llvm-project/blob/694b132177a96a61dac62b3e3d2989a063feafa7/llvm/lib/Target/NVPTX/NVPTXISelLowering.h#L468

I think that with this change we may lose this increase and that will be a potential performance regression.

While we're on the subject of changes, it would be great to add a test verifying that this increased alignment on PTX-level function arguments remains in place.

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


More information about the llvm-commits mailing list