1 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=sandybridge %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
2 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=ivybridge %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
3 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=haswell %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
4 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=broadwell %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
5 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=skylake %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
6 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=skx %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
7 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=NOTMERGE
9 define i32 @length2_1(i32) {
10 %2 = icmp slt i32 %0, 3
11 br i1 %2, label %3, label %5
14 %4 = tail call i32 (...) @f1()
18 %6 = icmp slt i32 %0, 40
19 br i1 %6, label %7, label %13
22 %8 = icmp eq i32 %0, 3
23 br i1 %8, label %9, label %11
26 %10 = tail call i32 (...) @f2()
30 %12 = tail call i32 (...) @f3() #2
36 ; MERGE-LABEL: length2_1
40 ; NOTMERGE-LABEL: length2_1
44 define i32 @length2_2(i32) {
45 %2 = icmp sle i32 %0, 2
46 br i1 %2, label %3, label %5
49 %4 = tail call i32 (...) @f1()
53 %6 = icmp slt i32 %0, 40
54 br i1 %6, label %7, label %13
57 %8 = icmp eq i32 %0, 3
58 br i1 %8, label %9, label %11
61 %10 = tail call i32 (...) @f2()
65 %12 = tail call i32 (...) @f3() #2
71 ; MERGE-LABEL: length2_2
75 ; NOTMERGE-LABEL: length2_2
79 define i32 @length2_3(i32) {
80 %2 = icmp sgt i32 %0, 3
81 br i1 %2, label %3, label %5
84 %4 = tail call i32 (...) @f1()
88 %6 = icmp sgt i32 %0, -40
89 br i1 %6, label %7, label %13
92 %8 = icmp eq i32 %0, 3
93 br i1 %8, label %9, label %11
96 %10 = tail call i32 (...) @f2()
100 %12 = tail call i32 (...) @f3() #2
106 ; MERGE-LABEL: length2_3
110 ; NOTMERGE-LABEL: length2_3
114 define i32 @length2_4(i32) {
115 %2 = icmp sge i32 %0, 4
116 br i1 %2, label %3, label %5
119 %4 = tail call i32 (...) @f1()
123 %6 = icmp sgt i32 %0, -40
124 br i1 %6, label %7, label %13
127 %8 = icmp eq i32 %0, 3
128 br i1 %8, label %9, label %11
131 %10 = tail call i32 (...) @f2()
135 %12 = tail call i32 (...) @f3() #2
141 ; MERGE-LABEL: length2_4
145 ; NOTMERGE-LABEL: length2_4
153 define i32 @length1_1(i32) {
154 %2 = icmp sgt i32 %0, 5
155 br i1 %2, label %3, label %5
158 %4 = tail call i32 (...) @f1()
162 %6 = icmp eq i32 %0, 5
163 br i1 %6, label %7, label %9
166 %8 = tail call i32 (...) @f2()
172 ; MERGE-LABEL: length1_1
176 ; NOTMERGE-LABEL: length1_1