blob: e9fa68041d9029adaf14e74ca5df988191b1d0e3 [file] [log] [blame]
Kyle Butt0846e562016-10-11 20:36:43 +00001; RUN: llc < %s -mtriple=aarch64-linux-gnuabi -O2 -tail-dup-placement=0 | FileCheck %s
2; -tail-dup-placement causes tail duplication during layout. This breaks the
3; assumptions of the test case as written (specifically, it creates an
4; additional cmp instruction, creating a false positive), so we pass
5; -tail-dup-placement=0 to restore the original behavior
Jiangning Liudd6e12d2014-08-11 05:17:19 +00006
7; marked as external to prevent possible optimizations
8@a = external global i32
9@b = external global i32
10@c = external global i32
11@d = external global i32
12@e = external global i32
13
14define void @combine-sign-comparisons-by-cse(i32 *%arg) {
15; CHECK: cmp
16; CHECK: b.ge
17; CHECK-NOT: cmp
18; CHECK: b.le
19
20entry:
David Blaikiea79ac142015-02-27 21:17:42 +000021 %a = load i32, i32* @a, align 4
22 %b = load i32, i32* @b, align 4
23 %c = load i32, i32* @c, align 4
24 %d = load i32, i32* @d, align 4
25 %e = load i32, i32* @e, align 4
Jiangning Liudd6e12d2014-08-11 05:17:19 +000026
27 %cmp = icmp slt i32 %a, %e
28 br i1 %cmp, label %land.lhs.true, label %lor.lhs.false
29
30land.lhs.true:
31 %cmp1 = icmp eq i32 %b, %c
32 br i1 %cmp1, label %return, label %if.end
33
34lor.lhs.false:
35 %cmp2 = icmp sgt i32 %a, %e
36 br i1 %cmp2, label %land.lhs.true3, label %if.end
37
38land.lhs.true3:
39 %cmp4 = icmp eq i32 %b, %d
40 br i1 %cmp4, label %return, label %if.end
41
42if.end:
43 br label %return
44
45return:
46 %retval.0 = phi i32 [ 0, %if.end ], [ 1, %land.lhs.true3 ], [ 1, %land.lhs.true ]
47 store i32 %a, i32 *%arg
48 ret void
49}