comparison clang/test/Profile/cxx-stmt-initializers.cpp @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children 1f2b6ac9f198
comparison
equal deleted inserted replaced
232:70dce7da266c 236:c4bab56944e8
1 // Tests for instrumentation of C++17 statement initializers 1 // Tests for instrumentation of C++17 statement initializers
2 2
3 // RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-stmt-initializers.cpp -std=c++1z -o - -emit-llvm -fprofile-instrument=clang > %tgen 3 // RUN: %clang_cc1 -no-opaque-pointers -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-stmt-initializers.cpp -std=c++1z -o - -emit-llvm -fprofile-instrument=clang > %tgen
4 // RUN: FileCheck --input-file=%tgen -check-prefix=CHECK -check-prefix=PGOGEN %s 4 // RUN: FileCheck --input-file=%tgen -check-prefix=CHECK -check-prefix=PGOGEN %s
5 5
6 // PGOGEN: @[[SIC:__profc__Z11switch_initv]] = {{(private|internal)}} global [3 x i64] zeroinitializer 6 // PGOGEN: @[[SIC:__profc__Z11switch_initv]] = {{(private|internal)}} global [3 x i64] zeroinitializer
7 // PGOGEN: @[[IIC:__profc__Z7if_initv]] = {{(private|internal)}} global [3 x i64] zeroinitializer 7 // PGOGEN: @[[IIC:__profc__Z7if_initv]] = {{(private|internal)}} global [3 x i64] zeroinitializer
8 8
9 // Note: We expect counters for the function entry block, the condition in the 9 // Note: We expect counters for the function entry block, the condition in the
10 // switch initializer, and the switch successor block. 10 // switch initializer, and the switch successor block.
11 // 11 //
12 // CHECK-LABEL: define {{.*}}void @_Z11switch_initv() 12 // CHECK-LABEL: define {{.*}}void @_Z11switch_initv()
13 // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 0 13 // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 0
14 void switch_init() { 14 void switch_init() {
15 switch (int i = true ? 0 : 1; i) {} 15 switch (int i = true ? 0 : 1; i) {}
16 // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 2 16 // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 2
17 // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 1 17 // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 1
18 } 18 }
19 19
20 // Note: We expect counters for the function entry block, the condition in the 20 // Note: We expect counters for the function entry block, the condition in the
21 // if initializer, and the if successor block. 21 // if initializer, and the if successor block.
22 // 22 //
23 // CHECK-LABEL: define {{.*}}void @_Z7if_initv() 23 // CHECK-LABEL: define {{.*}}void @_Z7if_initv()
24 // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 0 24 // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 0
25 void if_init() { 25 void if_init() {
26 if (int i = true ? 0 : 1; i) {} 26 if (int i = true ? 0 : 1; i) {}
27 // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 2 27 // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 2
28 // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 1 28 // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 1
29 } 29 }