// Test instrumentation of C++ exception handling constructs.
// FIXME: Don't seek bb labels, like "if.else"
// REQUIRES: asserts
// RUN: %clang_cc1 -no-opaque-pointers %s -o - -emit-llvm -fprofile-instrument=clang -fexceptions -fcxx-exceptions -triple %itanium_abi_triple | FileCheck -check-prefix=PGOGEN %s
// RUN: %clang_cc1 -no-opaque-pointers %s -o - -emit-llvm -fprofile-instrument=clang -fexceptions -fcxx-exceptions -triple %itanium_abi_triple | FileCheck -check-prefix=PGOGEN-EXC %s
// RUN: llvm-profdata merge %S/Inputs/cxx-throws.proftext -o %t.profdata
// RUN: %clang_cc1 -no-opaque-pointers %s -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata -fexceptions -fcxx-exceptions -triple %itanium_abi_triple | FileCheck -check-prefix=PGOUSE %s
// RUN: %clang_cc1 -no-opaque-pointers %s -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata -fexceptions -fcxx-exceptions -triple %itanium_abi_triple | FileCheck -check-prefix=PGOUSE-EXC %s
// PGOGEN: @[[THC:__profc__Z6throwsv]] = {{(private|internal)}} global [9 x i64] zeroinitializer
// PGOGEN-EXC: @[[THC:__profc__Z6throwsv]] = {{(private|internal)}} global [9 x i64] zeroinitializer
// PGOGEN: @[[UNC:__profc__Z11unreachablei]] = {{(private|internal)}} global [3 x i64] zeroinitializer
// PGOGEN-LABEL: @_Z6throwsv()
// PGOUSE-LABEL: @_Z6throwsv()
// PGOGEN: store {{.*}} @[[THC]], i32 0, i32 0
void
// PGOGEN-LABEL: @_Z11unreachablei(i32
// PGOUSE-LABEL: @_Z11unreachablei(i32
// PGOGEN: store {{.*}} @[[UNC]], i32 0, i32 0
void
// PGOUSE-DAG: ![[TH1]] = !{!"branch_weights", i32 101, i32 2}
// PGOUSE-DAG: ![[TH2]] = !{!"branch_weights", i32 67, i32 35}
// PGOUSE-DAG: ![[TH3]] = !{!"branch_weights", i32 34, i32 34}
// PGOUSE-DAG: ![[TH4]] = !{!"branch_weights", i32 18, i32 18}
// PGOUSE-EXC: ![[TH5]] = !{!"branch_weights", i32 34, i32 18}
// PGOUSE-DAG: ![[TH6]] = !{!"branch_weights", i32 101, i32 1}
// PGOUSE-DAG: ![[UN1]] = !{!"branch_weights", i32 2, i32 1}
int