[clang] [Clang][CodeGen] Emit alignment information for indirect arguments (PR #201999)

Sayan Sivakumaran via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 08:33:08 PDT 2026


================
@@ -3061,13 +3061,9 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
       //
       // This is different from indirect *not* byval, where the object
       // exists already, and the align attribute is purely
-      // informative.
+      // informative (but is still useful for optimization passes).
----------------
sivakusayan wrote:

(Sorry for deleting my comment, I thought I misread the code for a second and wanted to double check)

Yes, we know this from this [chunk of code](https://github.com/llvm/llvm-project/blob/1f10f1ca8af3dff956b353d7ff3ea169c82ed909/clang/lib/CodeGen/CGCall.cpp#L5639). In particular, since we aren't byval we [create the aligned temporary here](https://github.com/llvm/llvm-project/blob/1f10f1ca8af3dff956b353d7ff3ea169c82ed909/clang/lib/CodeGen/CGCall.cpp#L5713). We can see an example of this by running the code sample from the linked issue [through Godbolt](https://godbolt.org/z/nqreGnKGT), and looking at the top of the unoptimized `qux()`.

Let me add a better comment here, maybe there is an additional assertion I can add here too.

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


More information about the cfe-commits mailing list