================
@@ -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
----------------
erichkeane wrote:
I'd like more details to these check lines, these are checking way too little.
https://github.com/llvm/llvm-project/pull/206749
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits