1 ; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
3 declare i32 @f(i32 %val)
5 ; Check that eliminating cases with unreachable branches keeps
6 ; prof branch_weights metadata consistent with switch instruction.
7 define i32 @test_switch_to_unreachable(i32 %val) {
8 ; CHECK-LABEL: test_switch_to_unreachable
10 ; CHECK-NOT: i32 0, label %on0
11 switch i32 %val, label %otherwise [
15 ], !prof !{!"branch_weights", i32 99, i32 0, i32 1, i32 2}
16 ; CHECK: !prof ![[MD0:[0-9]+]]
19 %result = call i32 @f(i32 -1)
27 %result1 = call i32 @f(i32 -2)
31 %result2 = call i32 @f(i32 -3)
35 ; CHECK: ![[MD0]] = !{!"branch_weights", i32 99, i32 2, i32 1}