https://github.com/mkovacevic99 updated 
https://github.com/llvm/llvm-project/pull/206749

>From e5648a3fc28807a54aa12617158e50460728cdbb Mon Sep 17 00:00:00 2001
From: Milica Kovacevic <[email protected]>
Date: Tue, 30 Jun 2026 17:15:16 +0200
Subject: [PATCH] [Clang] Add FileCheck lines to atomic-auto-type codegen test

Follow-up to #197874. The codegen test was missing FileCheck
lines, making it a no-op. Add checks that verify both __auto_type
_Atomic and _Atomic __auto_type produce correct allocas and stores.
---
 clang/test/CodeGen/atomic-auto-type.c | 43 ++++++++++++++++++++-------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/clang/test/CodeGen/atomic-auto-type.c 
b/clang/test/CodeGen/atomic-auto-type.c
index 0969f22596421..4825596cb19f4 100644
--- a/clang/test/CodeGen/atomic-auto-type.c
+++ b/clang/test/CodeGen/atomic-auto-type.c
@@ -1,10 +1,33 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s > /dev/null
-
-// This is a regression test for handling of __auto_type inside _Atomic.
-// Previously this could lead to an undeduced AutoType escaping into
-// ASTContext::getTypeInfoImpl and causing an assertion failure.
-
-void f(double x) {
-  __auto_type _Atomic xa = x;
-  _Atomic __auto_type ax = x;
-}
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c11 -emit-llvm -o - %s | 
FileCheck %s
+
+// This is a regression test for handling of __auto_type inside _Atomic.
+// Previously this could lead to an undeduced AutoType escaping into
+// ASTContext::getTypeInfoImpl and causing an assertion failure.
+
+// 24-byte struct exceeds the lock-free threshold on x86_64.
+struct Large { double a, b, c; };
+
+// _Atomic double is lock-free on x86_64: deduced type should lower to plain IR
+// stores with no __atomic libcalls.
+// CHECK-LABEL: @test_atomic_auto_type(
+// CHECK-NOT: __atomic
+// CHECK: ret void
+
+void test_atomic_auto_type(double x) {
+  __auto_type _Atomic xa = x;
+  _Atomic __auto_type ax = x;
+}
+
+// _Atomic struct Large is not lock-free, so assignments (which must be atomic)
+// call __atomic_store. Initialization of _Atomic is not required to be atomic.
+// CHECK-LABEL: @test_atomic_auto_type_lock(
+// CHECK: call void @__atomic_store
+// CHECK: call void @__atomic_store
+// CHECK: ret void
+
+void test_atomic_auto_type_lock(struct Large x) {
+  __auto_type _Atomic la = x;
+  _Atomic __auto_type al = x;
+  la = x;
+  al = x;
+}

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to