blob: 6ebb2f11fca5e2946844a353a07bdb95bf1aaf30 [file] [log] [blame]
John McCalla8f28da2010-08-25 02:50:31 +00001// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2
3// Check that IR gen doesn't try to do an lvalue-to-rvalue conversion
4// on a volatile reference result. rdar://problem/8338198
5namespace test0 {
6 struct A {
7 A(const A& t);
8 A& operator=(const A& t);
9 volatile A& operator=(const volatile A& t) volatile;
10 };
11
12 volatile A *array;
13
14 // CHECK: define void @_ZN5test04testENS_1AE(
15 void test(A t) {
16 // CHECK: [[ARR:%.*]] = load [[A:%.*]]** @_ZN5test05arrayE, align 8
17 // CHECK-NEXT: [[IDX:%.*]] = getelementptr inbounds [[A]]* [[ARR]], i64 0
18 // CHECK-NEXT: [[TMP:%.*]] = call [[A]]* @_ZNV5test01AaSERVKS0_([[A]]* [[IDX]], [[A]]* [[T:%.*]])
19 // CHECK-NEXT: ret void
20 array[0] = t;
21 }
22}
23
24namespace test1 {
25 volatile int *x;
26
27 // CHECK: define void @_ZN5test14testEv()
28 void test() {
29 // CHECK: [[TMP:%.*]] = load i32** @_ZN5test11xE, align 8
John McCalla8f28da2010-08-25 02:50:31 +000030 // CHECK-NEXT: ret void
31 *x;
32 }
33}