xref: /llvm-project/llvm/test/CodeGen/X86/2007-02-16-BranchFold.ll (revision b980841652c1b178b41a9a7b0e7dec06aa058e0b)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -enable-tail-merge=0 | FileCheck %s
3; PR 1200
4; ModuleID = '<stdin>'
5target datalayout = "e-p:32:32"
6target triple = "i686-apple-darwin8"
7	%struct.FILE = type { ptr, i32, i32, i16, i16, %struct.__sbuf, i32, ptr, ptr, ptr, ptr, ptr, %struct.__sbuf, ptr, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
8	%struct.Index_Map = type { i32, ptr }
9	%struct.Item = type { [4 x i16], ptr }
10	%struct.__sFILEX = type opaque
11	%struct.__sbuf = type { ptr, i32 }
12	%struct.dimension = type { ptr, %struct.Index_Map, ptr, i32, ptr }
13	%struct.item_set = type { i32, i32, ptr, [2 x ptr], ptr, ptr, ptr, ptr }
14	%struct.list = type { ptr, ptr }
15	%struct.mapping = type { ptr, i32, i32, i32, ptr }
16	%struct.nonterminal = type { ptr, i32, i32, i32, ptr, ptr }
17	%struct.operator = type { ptr, i8, i32, i32, i32, i32, ptr }
18	%struct.pattern = type { ptr, ptr, [2 x ptr] }
19	%struct.plank = type { ptr, ptr, i32 }
20	%struct.plankMap = type { ptr, i32, ptr }
21	%struct.rule = type { [4 x i16], i32, i32, i32, ptr, ptr, i8 }
22	%struct.stateMap = type { ptr, ptr, i32, ptr }
23	%struct.table = type { ptr, ptr, ptr, [2 x ptr], ptr }
24@outfile = external global ptr		; <ptr> [#uses=1]
25@str1 = external global [11 x i8]		; <ptr> [#uses=1]
26
27declare i32 @fprintf(ptr, ptr, ...)
28
29define i16 @main_bb_2E_i9_2E_i_2E_i932_2E_ce(ptr %l_addr.01.0.i2.i.i929, ptr %tmp66.i62.i.out) {
30; CHECK-LABEL: main_bb_2E_i9_2E_i_2E_i932_2E_ce:
31; CHECK:       ## %bb.0: ## %newFuncRoot
32; CHECK-NEXT:    pushl %edi
33; CHECK-NEXT:    .cfi_def_cfa_offset 8
34; CHECK-NEXT:    pushl %esi
35; CHECK-NEXT:    .cfi_def_cfa_offset 12
36; CHECK-NEXT:    subl $20, %esp
37; CHECK-NEXT:    .cfi_def_cfa_offset 32
38; CHECK-NEXT:    .cfi_offset %esi, -12
39; CHECK-NEXT:    .cfi_offset %edi, -8
40; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %esi
41; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
42; CHECK-NEXT:    movl (%eax), %edi
43; CHECK-NEXT:    movl 8(%edi), %eax
44; CHECK-NEXT:    movl L_outfile$non_lazy_ptr, %ecx
45; CHECK-NEXT:    movl (%ecx), %ecx
46; CHECK-NEXT:    movl %eax, {{[0-9]+}}(%esp)
47; CHECK-NEXT:    movl L_str1$non_lazy_ptr, %eax
48; CHECK-NEXT:    movl %eax, {{[0-9]+}}(%esp)
49; CHECK-NEXT:    movl %ecx, (%esp)
50; CHECK-NEXT:    calll _fprintf
51; CHECK-NEXT:    movl 20(%edi), %eax
52; CHECK-NEXT:    testl %eax, %eax
53; CHECK-NEXT:    jle LBB0_6
54; CHECK-NEXT:  ## %bb.1: ## %NodeBlock4
55; CHECK-NEXT:    cmpl $2, %eax
56; CHECK-NEXT:    jge LBB0_2
57; CHECK-NEXT:  ## %bb.4: ## %LeafBlock2
58; CHECK-NEXT:    cmpl $1, %eax
59; CHECK-NEXT:    jne LBB0_3
60; CHECK-NEXT:  ## %bb.5: ## %bb20.i.i937.exitStub
61; CHECK-NEXT:    movl %edi, (%esi)
62; CHECK-NEXT:    movw $3, %ax
63; CHECK-NEXT:    addl $20, %esp
64; CHECK-NEXT:    popl %esi
65; CHECK-NEXT:    popl %edi
66; CHECK-NEXT:    retl
67; CHECK-NEXT:  LBB0_6: ## %NodeBlock
68; CHECK-NEXT:    js LBB0_9
69; CHECK-NEXT:  ## %bb.7: ## %LeafBlock1
70; CHECK-NEXT:    jne LBB0_3
71; CHECK-NEXT:  ## %bb.8: ## %bb12.i.i935.exitStub
72; CHECK-NEXT:    movl %edi, (%esi)
73; CHECK-NEXT:    movw $2, %ax
74; CHECK-NEXT:    addl $20, %esp
75; CHECK-NEXT:    popl %esi
76; CHECK-NEXT:    popl %edi
77; CHECK-NEXT:    retl
78; CHECK-NEXT:  LBB0_2: ## %LeafBlock3
79; CHECK-NEXT:    jne LBB0_3
80; CHECK-NEXT:  ## %bb.11: ## %bb28.i.i938.exitStub
81; CHECK-NEXT:    movl %edi, (%esi)
82; CHECK-NEXT:    movw $4, %ax
83; CHECK-NEXT:    addl $20, %esp
84; CHECK-NEXT:    popl %esi
85; CHECK-NEXT:    popl %edi
86; CHECK-NEXT:    retl
87; CHECK-NEXT:  LBB0_9: ## %LeafBlock
88; CHECK-NEXT:    cmpl $-1, %eax
89; CHECK-NEXT:    je LBB0_10
90; CHECK-NEXT:  LBB0_3: ## %NewDefault
91; CHECK-NEXT:    movl %edi, (%esi)
92; CHECK-NEXT:    xorl %eax, %eax
93; CHECK-NEXT:    addl $20, %esp
94; CHECK-NEXT:    popl %esi
95; CHECK-NEXT:    popl %edi
96; CHECK-NEXT:    retl
97; CHECK-NEXT:  LBB0_10: ## %bb.i14.i.exitStub
98; CHECK-NEXT:    movl %edi, (%esi)
99; CHECK-NEXT:    movw $1, %ax
100; CHECK-NEXT:    addl $20, %esp
101; CHECK-NEXT:    popl %esi
102; CHECK-NEXT:    popl %edi
103; CHECK-NEXT:    retl
104newFuncRoot:
105	br label %bb.i9.i.i932.ce
106
107NewDefault:		; preds = %LeafBlock, %LeafBlock1, %LeafBlock2, %LeafBlock3
108	br label %bb36.i.i.exitStub
109
110bb36.i.i.exitStub:		; preds = %NewDefault
111	store ptr %tmp2.i4.i.i931, ptr %tmp66.i62.i.out
112	ret i16 0
113
114bb.i14.i.exitStub:		; preds = %LeafBlock
115	store ptr %tmp2.i4.i.i931, ptr %tmp66.i62.i.out
116	ret i16 1
117
118bb12.i.i935.exitStub:		; preds = %LeafBlock1
119	store ptr %tmp2.i4.i.i931, ptr %tmp66.i62.i.out
120	ret i16 2
121
122bb20.i.i937.exitStub:		; preds = %LeafBlock2
123	store ptr %tmp2.i4.i.i931, ptr %tmp66.i62.i.out
124	ret i16 3
125
126bb28.i.i938.exitStub:		; preds = %LeafBlock3
127	store ptr %tmp2.i4.i.i931, ptr %tmp66.i62.i.out
128	ret i16 4
129
130bb.i9.i.i932.ce:		; preds = %newFuncRoot
131	%tmp1.i3.i.i930 = getelementptr %struct.list, ptr %l_addr.01.0.i2.i.i929, i32 0, i32 0		; <ptr> [#uses=1]
132	%tmp2.i4.i.i931 = load ptr, ptr %tmp1.i3.i.i930		; <ptr> [#uses=1]
133	%tmp1.i6.i = getelementptr %struct.operator, ptr %tmp2.i4.i.i931, i32 0, i32 2		; <ptr> [#uses=1]
134	%tmp2.i7.i = load i32, ptr %tmp1.i6.i		; <i32> [#uses=1]
135	%tmp3.i8.i = load ptr, ptr @outfile		; <ptr> [#uses=1]
136	%tmp5.i9.i = call i32 (ptr, ptr, ...) @fprintf( ptr %tmp3.i8.i, ptr @str1, i32 %tmp2.i7.i )		; <i32> [#uses=0]
137	%tmp7.i10.i = getelementptr %struct.operator, ptr %tmp2.i4.i.i931, i32 0, i32 5		; <ptr> [#uses=1]
138	%tmp8.i11.i = load i32, ptr %tmp7.i10.i		; <i32> [#uses=7]
139	br label %NodeBlock5
140
141NodeBlock5:		; preds = %bb.i9.i.i932.ce
142	icmp slt i32 %tmp8.i11.i, 1		; <i1>:0 [#uses=1]
143	br i1 %0, label %NodeBlock, label %NodeBlock4
144
145NodeBlock4:		; preds = %NodeBlock5
146	icmp slt i32 %tmp8.i11.i, 2		; <i1>:1 [#uses=1]
147	br i1 %1, label %LeafBlock2, label %LeafBlock3
148
149LeafBlock3:		; preds = %NodeBlock4
150	icmp eq i32 %tmp8.i11.i, 2		; <i1>:2 [#uses=1]
151	br i1 %2, label %bb28.i.i938.exitStub, label %NewDefault
152
153LeafBlock2:		; preds = %NodeBlock4
154	icmp eq i32 %tmp8.i11.i, 1		; <i1>:3 [#uses=1]
155	br i1 %3, label %bb20.i.i937.exitStub, label %NewDefault
156
157NodeBlock:		; preds = %NodeBlock5
158	icmp slt i32 %tmp8.i11.i, 0		; <i1>:4 [#uses=1]
159	br i1 %4, label %LeafBlock, label %LeafBlock1
160
161LeafBlock1:		; preds = %NodeBlock
162	icmp eq i32 %tmp8.i11.i, 0		; <i1>:5 [#uses=1]
163	br i1 %5, label %bb12.i.i935.exitStub, label %NewDefault
164
165LeafBlock:		; preds = %NodeBlock
166	icmp eq i32 %tmp8.i11.i, -1		; <i1>:6 [#uses=1]
167	br i1 %6, label %bb.i14.i.exitStub, label %NewDefault
168}
169