1; RUN: llc < %s -mtriple=aarch64-linux-gnuabi -O2 | FileCheck %s
2
3; marked as external to prevent possible optimizations
4@a = external global i32
5@b = external global i32
6@c = external global i32
7@d = external global i32
8@e = external global i32
9
10define void @combine-sign-comparisons-by-cse(i32 *%arg) {
11; CHECK: cmp
12; CHECK: b.ge
13; CHECK-NOT: cmp
14; CHECK: b.le
15
16entry:
17  %a = load i32, i32* @a, align 4
18  %b = load i32, i32* @b, align 4
19  %c = load i32, i32* @c, align 4
20  %d = load i32, i32* @d, align 4
21  %e = load i32, i32* @e, align 4
22
23  %cmp = icmp slt i32 %a, %e
24  br i1 %cmp, label %land.lhs.true, label %lor.lhs.false
25
26land.lhs.true:
27  %cmp1 = icmp eq i32 %b, %c
28  br i1 %cmp1, label %return, label %if.end
29
30lor.lhs.false:
31  %cmp2 = icmp sgt i32 %a, %e
32  br i1 %cmp2, label %land.lhs.true3, label %if.end
33
34land.lhs.true3:
35  %cmp4 = icmp eq i32 %b, %d
36  br i1 %cmp4, label %return, label %if.end
37
38if.end:
39  br label %return
40
41return:
42  %retval.0 = phi i32 [ 0, %if.end ], [ 1, %land.lhs.true3 ], [ 1, %land.lhs.true ]
43  store i32 %a, i32 *%arg
44  ret void
45}
46