1 ; RUN: llc < %s -march=x86-64 -mcpu=corei7-avx -disable-lsr -pre-RA-sched=source -enable-misched -verify-machineinstrs | FileCheck %s
3 ; Verify that TEST+JE are scheduled together.
8 define void @test_je() {
13 %var = phi i32* [ null, %entry ], [ %next.load, %loop1 ], [ %var, %loop2 ]
14 %next.ptr = phi i32** [ null, %entry ], [ %next.ptr, %loop1 ], [ %gep, %loop2 ]
18 %cond = icmp eq i32* %var, null
19 %next.load = load i32** %next.ptr
20 br i1 %cond, label %loop, label %loop2
22 loop2: ; preds = %loop1
23 %gep = getelementptr inbounds i32** %next.ptr, i32 1
24 store i32* %next.load, i32** undef
28 ; Verify that DEC+JE are scheduled together.
33 define void @dec_je() {
38 %var = phi i32 [ 0, %entry ], [ %next.var, %loop1 ], [ %var2, %loop2 ]
39 %next.ptr = phi i32** [ null, %entry ], [ %next.ptr, %loop1 ], [ %gep, %loop2 ]
43 %var2 = sub i32 %var, 1
44 %cond = icmp eq i32 %var2, 0
45 %next.load = load i32** %next.ptr
46 %next.var = load i32* %next.load
47 br i1 %cond, label %loop, label %loop2
50 %gep = getelementptr inbounds i32** %next.ptr, i32 1
51 store i32* %next.load, i32** undef
55 ; DEC+JS should *not* be scheduled together.
61 define void @dec_js() {
65 loop2a: ; preds = %loop1, %body, %entry
66 %var = phi i32 [ 0, %entry ], [ %next.var, %loop1 ], [ %var2, %loop2b ]
67 %next.ptr = phi i32** [ null, %entry ], [ %next.ptr, %loop1 ], [ %gep, %loop2b ]
70 loop1: ; preds = %loop2a, %loop2b
71 %var2 = sub i32 %var, 1
72 %cond = icmp slt i32 %var2, 0
73 %next.load = load i32** %next.ptr
74 %next.var = load i32* %next.load
75 br i1 %cond, label %loop2a, label %loop2b
77 loop2b: ; preds = %loop1
78 %gep = getelementptr inbounds i32** %next.ptr, i32 1
79 store i32* %next.load, i32** undef
83 ; Verify that CMP+JB are scheduled together.
88 define void @cmp_jb(i32 %n) {
92 loop2a: ; preds = %loop1, %body, %entry
93 %var = phi i32 [ 0, %entry ], [ %next.var, %loop1 ], [ %var2, %loop2b ]
94 %next.ptr = phi i32** [ null, %entry ], [ %next.ptr, %loop1 ], [ %gep, %loop2b ]
97 loop1: ; preds = %loop2a, %loop2b
98 %var2 = sub i32 %var, 1
99 %cond = icmp ult i32 %var2, %n
100 %next.load = load i32** %next.ptr
101 %next.var = load i32* %next.load
102 br i1 %cond, label %loop2a, label %loop2b
104 loop2b: ; preds = %loop1
105 %gep = getelementptr inbounds i32** %next.ptr, i32 1
106 store i32* %next.load, i32** undef