Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / std-byte.cpp
blob63f41e6f1e16a82ef0254c1554c8f3259392c2a8
1 // RUN: %clang_cc1 -std=c++1z -Werror -triple i386-unknown-unknown -emit-llvm -O1 -disable-llvm-passes -o - %s | FileCheck %s
3 // std::byte should be considered equivalent to char for aliasing.
5 namespace std {
6 enum byte : unsigned char {};
9 // CHECK-LABEL: define{{.*}} void @test0(
10 extern "C" void test0(std::byte *sb, int *i) {
11 // CHECK: store i8 0, ptr %{{.*}} !tbaa [[TAG_CHAR:!.*]]
12 *sb = std::byte{0};
14 // CHECK: store i32 1, ptr %{{.*}} !tbaa [[TAG_INT:!.*]]
15 *i = 1;
18 enum byte : unsigned char {};
19 namespace my {
20 enum byte : unsigned char {};
21 namespace std {
22 enum byte : unsigned char {};
23 } // namespace std
24 } // namespace my
26 // Make sure we don't get confused with other enums named 'byte'.
28 // CHECK-LABEL: define{{.*}} void @test1(
29 extern "C" void test1(::byte *b, ::my::byte *mb, ::my::std::byte *msb) {
30 *b = ::byte{0};
31 *mb = ::my::byte{0};
32 *msb = ::my::std::byte{0};
33 // CHECK-NOT: store i8 0, ptr %{{.*}} !tbaa [[TAG_CHAR]]
36 // CHECK: !"any pointer", [[TYPE_CHAR:!.*]],
37 // CHECK: [[TYPE_CHAR]] = !{!"omnipotent char", [[TAG_CXX_TBAA:!.*]],
38 // CHECK: [[TAG_CXX_TBAA]] = !{!"Simple C++ TBAA"}
39 // CHECK: [[TAG_CHAR]] = !{[[TYPE_CHAR:!.*]], [[TYPE_CHAR]], i64 0}
40 // CHECK: [[TAG_INT]] = !{[[TYPE_INT:!.*]], [[TYPE_INT]], i64 0}
41 // CHECK: [[TYPE_INT]] = !{!"int", [[TYPE_CHAR]]