Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / expr / p10-0x.cpp
blob02ba0d83b005fa778033e31f91fe528258999d05
1 // RUN: %clang_cc1 -emit-llvm -triple x86_64-pc-linux-gnu %s -o - -std=c++11 | FileCheck %s
3 volatile int g1;
4 struct S {
5 volatile int a;
6 } g2;
8 volatile int& refcall();
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, ptr
14 (*x);
15 // CHECK: load volatile i32, ptr
16 __extension__ g1;
17 // CHECK: load volatile i32, ptr
18 s->a;
19 // CHECK: load volatile i32, ptr
20 g2.a;
21 // CHECK: load volatile i32, ptr
22 s->*(&S::a);
23 // CHECK: load volatile i32, ptr
24 // CHECK: load volatile i32, ptr
25 x[0], 1 ? x[0] : *x;
27 // CHECK: load volatile i32, ptr
28 // CHECK: load volatile i32, ptr
29 // CHECK: load volatile i32, ptr
30 *x ?: *x;
32 // CHECK: load volatile i32, ptr
33 ({ *x; });
35 // CHECK-NOT: load volatile
36 // CHECK: ret
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;
48 // CHECK: define{{.*}} void @_Z2f3v()
49 // CHECK-NOT: load
50 // CHECK-NOT: memcpy
52 void f3(void) {
53 volatile char a[10];