diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-04-12 20:42:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-04-12 20:42:30 +0000 |
commit | 47bfcca2d6972d98a1b25239cd1aa658b60680e2 (patch) | |
tree | 8732be18cb85fff8187b0b9538150fe2db78320b /test/CodeGenCXX/atomicinit.cpp | |
parent | 83748e2f41ea0ac7c954946feb5da9ccc6ab8bec (diff) |
Fix some i1/i8 confusion within _Atomic(bool) in IR generation, both
in general (such an atomic has boolean representation) and
specifically for IR generation of __c11_atomic_init. The latter also
means actually using initialization semantics for this initialization,
rather than just creating a store.
On a related note, make sure we actually put in non-atomic-to-atomic
conversions when performing an implicit conversion sequence. IR
generation is far too kind here, but we still want the ASTs to make
sense.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/atomicinit.cpp')
-rw-r--r-- | test/CodeGenCXX/atomicinit.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/CodeGenCXX/atomicinit.cpp b/test/CodeGenCXX/atomicinit.cpp index 20e46131df..38d012e6a9 100644 --- a/test/CodeGenCXX/atomicinit.cpp +++ b/test/CodeGenCXX/atomicinit.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -O1 -o - -triple=i686-apple-darwin9 | FileCheck %s struct A { _Atomic(int) i; A(int j); @@ -21,5 +21,28 @@ _Atomic(B) b; // CHECK: define void @_Z11atomic_initR1Ai void atomic_init(A& a, int i) { // CHECK-NOT: atomic + // CHECK: tail call void @_ZN1BC1Ei __c11_atomic_init(&b, B(i)); + // CHECK-NEXT: ret void } + +// CHECK: define void @_Z16atomic_init_boolPU7_Atomicbb +void atomic_init_bool(_Atomic(bool) *ab, bool b) { + // CHECK-NOT: atomic + // CHECK: {{zext i1.*to i8}} + // CHECK-NEXT: store i8 + __c11_atomic_init(ab, b); + // CHECK-NEXT: ret void +} + +struct AtomicBoolMember { + _Atomic(bool) ab; + AtomicBoolMember(bool b); +}; + +// CHECK: define void @_ZN16AtomicBoolMemberC2Eb +// CHECK: {{zext i1.*to i8}} +// CHECK-NEXT: store i8 +// CHECK-NEXT: ret void +AtomicBoolMember::AtomicBoolMember(bool b) : ab(b) { } + |