1; RUN: opt -S -simplifycfg < %s | FileCheck %s 2 3define zeroext i1 @test1(i32 %x) nounwind readnone ssp noredzone { 4entry: 5 switch i32 %x, label %lor.rhs [ 6 i32 2, label %lor.end 7 i32 1, label %lor.end 8 i32 3, label %lor.end 9 ] 10 11lor.rhs: 12 br label %lor.end 13 14lor.end: 15 %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ] 16 ret i1 %0 17 18; CHECK-LABEL: @test1( 19; CHECK: %x.off = add i32 %x, -1 20; CHECK: %switch = icmp ult i32 %x.off, 3 21} 22 23define zeroext i1 @test2(i32 %x) nounwind readnone ssp noredzone { 24entry: 25 switch i32 %x, label %lor.rhs [ 26 i32 0, label %lor.end 27 i32 1, label %lor.end 28 ] 29 30lor.rhs: 31 br label %lor.end 32 33lor.end: 34 %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ] 35 ret i1 %0 36 37; CHECK-LABEL: @test2( 38; CHECK: %switch = icmp ult i32 %x, 2 39} 40 41define i32 @test3(i1 %flag) { 42entry: 43 switch i1 %flag, label %bad [ 44 i1 true, label %good 45 i1 false, label %good 46 ] 47 48good: 49 ret i32 0 50 51bad: 52 ret i32 1 53 54; CHECK-LABEL: @test3( 55; CHECK: entry: 56; CHECK-NEXT: ret i32 0 57} 58