1 ; RUN: opt -S -simplifycfg < %s | FileCheck %s
3 ; We're sign extending an 8-bit value.
4 ; The switch condition must be in the range [-128, 127], so any cases outside of that range must be dead.
5 ; Only the first case has a non-zero weight, but that gets eliminated. Note
6 ; that this shouldn't have been the case in the first place, but the test here
7 ; ensures that all-zero branch weights are not attached causing problems downstream.
9 define i1 @repeated_signbits(i8 %condition) {
10 ; CHECK-LABEL: @repeated_signbits(
12 ; CHECK-DAG: i32 -128, label %a
13 ; CHECK-DAG: i32 -1, label %a
14 ; CHECK-DAG: i32 0, label %a
15 ; CHECK-DAG: i32 127, label %a
20 %sext = sext i8 %condition to i32
21 switch i32 %sext, label %default [
22 i32 -2147483648, label %a
29 i32 2147483647, label %a
39 !1 = !{!"branch_weights", i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0}