Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / may_alias.cpp
blobfbc4e22e731f7fad94ffbd482d3a1e7349959c4e
1 // RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -O2 -disable-llvm-passes -o - | FileCheck %s
2 // RUN: %clang_cc1 %s -triple %ms_abi_triple -emit-llvm -O2 -disable-llvm-passes -o - | FileCheck %s
4 enum class __attribute__((may_alias)) E {};
6 template<typename T> struct A {
7 using B __attribute__((may_alias)) = enum {};
8 };
10 template<typename T> using Alias = typename A<T>::B;
12 // CHECK-LABEL: define {{.*}}foo
13 // CHECK: load i{{[0-9]*}}, {{.*}}, !tbaa ![[MAY_ALIAS:[^ ,]*]]
14 auto foo(E &r) { return r; }
16 // CHECK-LABEL: define {{.*}}goo
17 // CHECK: load i{{[0-9]*}}, {{.*}}, !tbaa ![[MAY_ALIAS]]
18 auto goo(A<int>::B &r) { return r; }
20 // CHECK-LABEL: define {{.*}}hoo
21 // CHECK: load i{{[0-9]*}}, {{.*}}, !tbaa ![[MAY_ALIAS]]
22 auto hoo(Alias<int> &r) { return r; }
24 // CHECK: ![[CHAR:.*]] = !{!"omnipotent char", !{{.*}}, i64 0}
25 // CHECK: ![[MAY_ALIAS]] = !{![[CHAR]], ![[CHAR]], i64 0}