1 ; RUN: opt -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -switch-range-to-icmp < %s | FileCheck %s
3 define zeroext i1 @test1(i32 %x) nounwind readnone ssp noredzone {
5 switch i32 %x, label %lor.rhs [
15 %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ]
18 ; CHECK-LABEL: @test1(
19 ; CHECK: %x.off = add i32 %x, -1
20 ; CHECK: %switch = icmp ult i32 %x.off, 3
23 define zeroext i1 @test2(i32 %x) nounwind readnone ssp noredzone {
25 switch i32 %x, label %lor.rhs [
34 %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ]
37 ; CHECK-LABEL: @test2(
38 ; CHECK: %switch = icmp ult i32 %x, 2
41 define i32 @test3(i1 %flag) {
43 switch i1 %flag, label %bad [
54 ; CHECK-LABEL: @test3(
56 ; CHECK-NEXT: ret i32 0