• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: @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: @test2
38; CHECK: %switch = icmp ult i32 %x, 2
39}
40