• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 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
5 namespace 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-LABEL: define void @_ZN5test04testENS_1AE(
test(A t)15   void test(A t) {
16     // CHECK:      [[ARR:%.*]] = load [[A:%.*]]*, [[A:%.*]]** @_ZN5test05arrayE, align 8
17     // CHECK-NEXT: [[IDX:%.*]] = getelementptr inbounds [[A]], [[A]]* [[ARR]], i64 0
18     // CHECK-NEXT: [[TMP:%.*]] = call dereferenceable({{[0-9]+}}) [[A]]* @_ZNV5test01AaSERVKS0_([[A]]* [[IDX]], [[A]]* dereferenceable({{[0-9]+}}) [[T:%.*]])
19     // CHECK-NEXT: ret void
20     array[0] = t;
21   }
22 }
23 
24 namespace test1 {
25   volatile int *x;
26 
27   // CHECK-LABEL: define void @_ZN5test14testEv()
test()28   void test() {
29     // CHECK:      [[TMP:%.*]] = load i32*, i32** @_ZN5test11xE, align 8
30     // CHECK-NEXT: ret void
31     *x;
32   }
33 }
34