[PATCH] D140581: [NVPTX] Enforce minumum alignment of 4 for byval parametrs in a function prototype

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 16:33:35 PST 2023


tra accepted this revision.
tra added a comment.

LGTM. Thank you!



================
Comment at: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp:1615-1623
+      Align OptimalAlign;
+      if (isKernelFunc)
+        OptimalAlign = getOptimalAlignForParam(ETy);
+      else {
+        // ByVal parameters of device functions require special alignment.
+        MaybeAlign ParamAlign = PAL.getParamAlignment(paramIndex);
+        OptimalAlign = TLI->getFunctionByValParamAlign(
----------------
Nit. This all could be folded into 

```
Align OptimalAlign = isKernelFunc 
        ? getOptimalAlignForParam(ETy);
        : TLI->getFunctionByValParamAlign(F, ETy, PAL.getParamAlignment(paramIndex).valueOrOne(), DL);
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140581/new/

https://reviews.llvm.org/D140581



More information about the llvm-commits mailing list