X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=test%2FTransforms%2FSimplifyCFG%2Fswitch-range-to-icmp.ll;h=a109b317c7320a1fade6030a86e575ff0253f15a;hp=8bf2b04520b93e6911255eee95a172a3b6cfba51;hb=d5c2318adc7bde590d9f9369ef97fe7adde3f1a4;hpb=76b1313e75a594f3a5e128fff2c2fa1a1d339309 diff --git a/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll b/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll index 8bf2b04520b..a109b317c73 100644 --- a/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll +++ b/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll @@ -48,3 +48,30 @@ b: %1 = call i32 @f(i32 1) ret i32 %1 } + + +define i32 @unreachable2(i32 %x) { +; CHECK-LABEL: @unreachable2 +; CHECK: x.off = add i32 %x, -5 +; CHECK: %switch = icmp ult i32 %x.off, 3 +; CHECK: br i1 %switch, label %a, label %b + +entry: + ; Note: folding the most popular case destination into the default + ; would prevent switch-to-icmp here. + switch i32 %x, label %unreachable [ + i32 5, label %a + i32 6, label %a + i32 7, label %a + i32 10, label %b + i32 20, label %b + ] +unreachable: + unreachable +a: + %0 = call i32 @f(i32 0) + ret i32 %0 +b: + %1 = call i32 @f(i32 1) + ret i32 %1 +}