1 // RUN: %clang_cc1 -emit-llvm -triple x86_64-pc-linux-gnu %s -o - -std=c++11 | FileCheck %s 2 3 volatile int g1; 4 struct S { 5 volatile int a; 6 } g2; 7 8 volatile int& refcall(); 9 10 // CHECK: define void @_Z2f1PViPV1S 11 void f1(volatile int *x, volatile S* s) { 12 // We should perform the load in these cases. 13 // CHECK: load volatile i32, i32* 14 (*x); 15 // CHECK: load volatile i32, i32* 16 __extension__ g1; 17 // CHECK: load volatile i32, i32* 18 s->a; 19 // CHECK: load volatile i32, i32* 20 g2.a; 21 // CHECK: load volatile i32, i32* 22 s->*(&S::a); 23 // CHECK: load volatile i32, i32* 24 // CHECK: load volatile i32, i32* 25 x[0], 1 ? x[0] : *x; 26 27 // CHECK: load volatile i32, i32* 28 // CHECK: load volatile i32, i32* 29 // CHECK: load volatile i32, i32* 30 *x ?: *x; 31 32 // CHECK: load volatile i32, i32* 33 ({ *x; }); 34 35 // CHECK-NOT: load volatile 36 // CHECK: ret 37 } 38 39 // CHECK: define void @_Z2f2PVi 40 // CHECK-NOT: load volatile 41 // CHECK: ret 42 void f2(volatile int *x) { 43 // We shouldn't perform the load in these cases. 44 refcall(); 45 1 ? refcall() : *x; 46 } 47