• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux < %s | FileCheck %s
2; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -outline-optional-branches < %s | FileCheck %s -check-prefix=CHECK-OUTLINE
3
4define void @foo(i32 %t1, i32 %t2, i32 %t3) {
5; Test that we lift the call to 'c' up to immediately follow the call to 'b'
6; when we disable the cfg conflict check.
7;
8; CHECK-LABEL: foo:
9; CHECK: callq a
10; CHECK: callq a
11; CHECK: callq a
12; CHECK: callq a
13; CHECK: callq b
14; CHECK: callq c
15; CHECK: callq d
16; CHECK: callq e
17; CHECK: callq f
18;
19; CHECK-OUTLINE-LABEL: foo:
20; CHECK-OUTLINE: callq b
21; CHECK-OUTLINE: callq c
22; CHECK-OUTLINE: callq d
23; CHECK-OUTLINE: callq e
24; CHECK-OUTLINE: callq f
25; CHECK-OUTLINE: callq a
26; CHECK-OUTLINE: callq a
27; CHECK-OUTLINE: callq a
28; CHECK-OUTLINE: callq a
29
30entry:
31  %cmp = icmp eq i32 %t1, 0
32  br i1 %cmp, label %if.then, label %if.end
33
34if.then:
35  call void @a()
36  call void @a()
37  call void @a()
38  call void @a()
39  br label %if.end
40
41if.end:
42  call void @b()
43  br label %hotbranch
44
45hotbranch:
46  %cmp2 = icmp eq i32 %t2, 0
47  br i1 %cmp2, label %if.then2, label %if.end2, !prof !1
48
49if.then2:
50  call void @c()
51  br label %if.end2
52
53if.end2:
54  call void @d()
55  br label %shortbranch
56
57shortbranch:
58  %cmp3 = icmp eq i32 %t3, 0
59  br i1 %cmp3, label %if.then3, label %if.end3
60
61if.then3:
62  call void @e()
63  br label %if.end3
64
65if.end3:
66  call void @f()
67  ret void
68}
69
70declare void @a()
71declare void @b()
72declare void @c()
73declare void @d()
74declare void @e()
75declare void @f()
76
77!1 = !{!"branch_weights", i32 64, i32 4}
78