summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/code_placement_ignore_succ_in_inner_loop.ll
blob: b30aaea9024bd12bcd5f6a01d2f6100a16eca826 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux < %s | FileCheck %s

define void @foo() {
; Test that when determining the edge probability from a node in an inner loop
; to a node in an outer loop, the weights on edges in the inner loop should be
; ignored if we are building the chain for the outer loop.
;
; CHECK-LABEL: foo:
; CHECK: callq c
; CHECK: callq b

entry:
  %call = call zeroext i1 @a()
  br i1 %call, label %if.then, label %if.else, !prof !1

if.then:
  %call1 = call zeroext i1 @a()
  br i1 %call1, label %while.body, label %if.end.1, !prof !1

while.body:
  %call2 = call zeroext i1 @a()
  br i1 %call2, label %if.then.1, label %while.cond

if.then.1:
  call void @d()
  br label %while.cond

while.cond:
  %call3 = call zeroext i1 @a()
  br i1 %call3, label %while.body, label %if.end

if.end.1:
  call void @d()
  br label %if.end

if.else:
  call void @b()
  br label %if.end

if.end:
  call void @c()
  ret void
}

define void @bar() {
; Test that when determining the edge probability from a node in a loop to a
; node in its peer loop, the weights on edges in the first loop should be
; ignored.
;
; CHECK-LABEL: bar:
; CHECK: callq c
; CHECK: callq b

entry:
  %call = call zeroext i1 @a()
  br i1 %call, label %if.then, label %if.else, !prof !1

if.then:
  %call1 = call zeroext i1 @a()
  br i1 %call1, label %if.then, label %while.body, !prof !2

while.body:
  %call2 = call zeroext i1 @a()
  br i1 %call2, label %while.body, label %if.end, !prof !2

if.else:
  call void @b()
  br label %if.end

if.end:
  call void @c()
  ret void
}

define void @par() {
; Test that when determining the edge probability from a node in a loop to a
; node in its outer loop, the weights on edges in the outer loop should be
; ignored if we are building the chain for the inner loop.
;
; CHECK-LABEL: par:
; CHECK: callq c
; CHECK: callq d
; CHECK: callq b

entry:
  br label %if.cond

if.cond:
  %call = call zeroext i1 @a()
  br i1 %call, label %if.then, label %if.else, !prof !3

if.then:
  call void @b()
  br label %if.end

if.else:
  call void @c()
  %call1 = call zeroext i1 @a()
  br i1 %call1, label %if.end, label %exit, !prof !4

if.end:
  call void @d()
  %call2 = call zeroext i1 @a()
  br i1 %call2, label %if.cond, label %if.end.2, !prof !2

if.end.2:
  call void @e()
  br label %if.cond

exit:
  ret void
}

declare zeroext i1 @a()
declare void @b()
declare void @c()
declare void @d()
declare void @e()

!1 = !{!"branch_weights", i32 10, i32 1}
!2 = !{!"branch_weights", i32 100, i32 1}
!3 = !{!"branch_weights", i32 1, i32 100}
!4 = !{!"branch_weights", i32 1, i32 1}