[clang] [KeyIntsr][Clang] Builtins alloca auto-init atom (PR #134651)

Orlando Cazalet-Hyams via cfe-commits cfe-commits at lists.llvm.org
Tue May 27 06:54:09 PDT 2025


================
@@ -0,0 +1,77 @@
+
+// RUN: %clang_cc1 -gkey-instructions -x c++ %s -debug-info-kind=line-tables-only -gno-column-info -emit-llvm -o - -ftrivial-auto-var-init=zero -fenable-matrix -disable-llvm-passes \
+// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
+
+// RUN: %clang_cc1 -gkey-instructions -x c %s -debug-info-kind=line-tables-only -gno-column-info -emit-llvm -o - -ftrivial-auto-var-init=zero -fenable-matrix -disable-llvm-passes \
+// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
+
+typedef float m2x2 __attribute__((matrix_type(2, 2)));
+m2x2 mat;
+float f4[4];
+float f8[8];
+
+void fun() {
+// CHECK: %a = alloca ptr, align 8
+// CHECK: %0 = alloca i8, i64 4{{.*}}, !dbg [[G1R2:!.*]]
+// CHECK: call void @llvm.memset{{.*}}, !dbg [[G1R1:!.*]], !annotation
+// CHECK: store ptr %0, ptr %a{{.*}}, !dbg [[G1R1:!.*]]
+    void *a = __builtin_alloca(4);
+
+// CHECK: %1 = alloca i8, i64 4{{.*}}, !dbg [[G2R2:!.*]]
+// CHECK: call void @llvm.memset{{.*}}, !dbg [[G2R1:!.*]], !annotation
+// CHECK: store ptr %1, ptr %b{{.*}}, !dbg [[G2R1:!.*]]
+    void *b = __builtin_alloca_with_align(4, 8);
----------------
OCHyams wrote:

No not changed in this patch, this is more to show that it "just works" with all the moving parts from the other patches. This is an assignment, so we already handle that. There's nothing special we need to do for the `__builtin_alloca_with_align` call itself.

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


More information about the cfe-commits mailing list