Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / drs / dr158.cpp
bloba0a8bd05baee3bb4533fca623d145288f905036a
1 // RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
3 // RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
4 // RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
6 // dr158: yes
8 // CHECK-LABEL: define {{.*}} @_Z1f
9 const int *f(const int * const *p, int **q) {
10 // CHECK: load ptr, {{.*}}, !tbaa ![[INTPTR_TBAA:[^,]*]]
11 const int *x = *p;
12 // CHECK: store ptr null, {{.*}}, !tbaa ![[INTPTR_TBAA]]
13 *q = 0;
14 return x;
17 struct A {};
19 // CHECK-LABEL: define {{.*}} @_Z1g
20 const int *(A::*const *g(const int *(A::* const **p)[3], int *(A::***q)[3]))[3] {
21 // CHECK: load ptr, {{.*}}, !tbaa ![[MEMPTR_TBAA:[^,]*]]
22 const int *(A::*const *x)[3] = *p;
23 // CHECK: store ptr null, {{.*}}, !tbaa ![[MEMPTR_TBAA]]
24 *q = 0;
25 return x;