xref: /aosp_15_r20/external/clang/test/Profile/c-unreachable-after-switch.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -O3 -triple x86_64-apple-macosx10.10 -main-file-name c-unreachable-after-switch.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li // CHECK: @[[C:__profc_foo]] = private global [3 x i64] zeroinitializer
4*67e74705SXin Li 
5*67e74705SXin Li // CHECK-LABEL: @foo()
6*67e74705SXin Li // CHECK: store {{.*}} @[[C]], i64 0, i64 0
foo()7*67e74705SXin Li void foo() {
8*67e74705SXin Li   // CHECK: store {{.*}} @[[C]], i64 0, i64 2
9*67e74705SXin Li   switch (0) {
10*67e74705SXin Li   default:
11*67e74705SXin Li     return;
12*67e74705SXin Li   }
13*67e74705SXin Li   // We shouldn't emit the unreachable counter. This used to crash in GlobalDCE.
14*67e74705SXin Li   // CHECK-NOT: store {{.*}} @[[SWC]], i64 0, i64 1}
15*67e74705SXin Li }
16