xref: /llvm-project/llvm/test/CodeGen/X86/2009-04-29-LinearScanBug.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc < %s -mtriple=i386-apple-darwin10
2; rdar://6837009
3
4	%0 = type { ptr, ptr, ptr, i32 }
5	%1 = type { %2 }
6	%2 = type { %struct.pf_addr, %struct.pf_addr }
7	%3 = type { %struct.in6_addr }
8	%4 = type { [4 x i32] }
9	%5 = type { ptr, [4 x i8] }
10	%6 = type { ptr, ptr }
11	%7 = type { ptr, ptr, ptr, i32 }
12	%8 = type { ptr }
13	%9 = type { ptr }
14	%10 = type { %11 }
15	%11 = type { ptr, ptr, ptr }
16	%12 = type { [2 x %struct.pf_rulequeue], %13, %13 }
17	%13 = type { ptr, ptr, i32, i32, i32 }
18	%14 = type { ptr, ptr, ptr, i32 }
19	%15 = type { ptr, ptr, ptr, i32 }
20	%16 = type { ptr, ptr }
21	%17 = type { %18 }
22	%18 = type { %struct.pkthdr, %19 }
23	%19 = type { %struct.m_ext, [176 x i8] }
24	%20 = type { ptr, ptr }
25	%21 = type { i32, %22 }
26	%22 = type { ptr, [4 x i8] }
27	%23 = type { ptr }
28	%24 = type { %struct.pf_ike_state }
29	%25 = type { ptr, ptr, ptr, i32 }
30	%26 = type { ptr, ptr, ptr, i32 }
31	%struct.anon = type { ptr, ptr }
32	%struct.au_mask_t = type { i32, i32 }
33	%struct.bpf_if = type opaque
34	%struct.dlil_threading_info = type opaque
35	%struct.ether_header = type { [6 x i8], [6 x i8], i16 }
36	%struct.ext_refsq = type { ptr, ptr }
37	%struct.hook_desc = type { %struct.hook_desc_head, ptr, ptr }
38	%struct.hook_desc_head = type { ptr, ptr }
39	%struct.if_data_internal = type { i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i32, i32, %struct.au_mask_t, i32, i32, i32 }
40	%struct.ifaddr = type { ptr, ptr, ptr, ptr, %struct.ifaddrhead, ptr, i32, i32, i32, ptr, ptr, i32 }
41	%struct.ifaddrhead = type { ptr, ptr }
42	%struct.ifmultiaddr = type { %20, ptr, ptr, ptr, i32, ptr, i32, ptr }
43	%struct.ifmultihead = type { ptr }
44	%struct.ifnet = type { ptr, ptr, %16, %struct.ifaddrhead, i32, ptr, i32, ptr, i16, i16, i16, i16, i32, ptr, i32, %struct.if_data_internal, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, %struct.ifnet_filter_head, i32, ptr, i32, %struct.ifmultihead, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.ifqueue, [1 x i32], i32, %struct.ifprefixhead, ptr, %21, i32, ptr, ptr, ptr, %struct.route }
45	%struct.ifnet_demux_desc = type { i32, ptr, i32 }
46	%struct.ifnet_filter = type opaque
47	%struct.ifnet_filter_head = type { ptr, ptr }
48	%struct.ifprefix = type { ptr, ptr, %struct.ifprefixhead, i8, i8 }
49	%struct.ifprefixhead = type { ptr, ptr }
50	%struct.ifqueue = type { ptr, ptr, i32, i32, i32 }
51	%struct.in6_addr = type { %4 }
52	%struct.in_addr = type { i32 }
53	%struct.kev_d_vectors = type { i32, ptr }
54	%struct.kev_msg = type { i32, i32, i32, i32, [5 x %struct.kev_d_vectors] }
55	%struct.lck_mtx_t = type { [3 x i32] }
56	%struct.lck_rw_t = type <{ [3 x i32] }>
57	%struct.m_ext = type { ptr, ptr, i32, ptr, %struct.ext_refsq, ptr }
58	%struct.m_hdr = type { ptr, ptr, i32, ptr, i16, i16 }
59	%struct.m_tag = type { %struct.packet_tags, i16, i16, i32 }
60	%struct.mbuf = type { %struct.m_hdr, %17 }
61	%struct.packet_tags = type { ptr }
62	%struct.pf_addr = type { %3 }
63	%struct.pf_addr_wrap = type <{ %1, %5, i8, i8, [6 x i8] }>
64	%struct.pf_anchor = type { %14, %14, ptr, %struct.pf_anchor_node, [64 x i8], [1024 x i8], %struct.pf_ruleset, i32, i32 }
65	%struct.pf_anchor_node = type { ptr }
66	%struct.pf_app_state = type { ptr, ptr, ptr, %24 }
67	%struct.pf_ike_state = type { i64 }
68	%struct.pf_mtag = type { ptr, i32, i32, i16, i8, i8 }
69	%struct.pf_palist = type { ptr, ptr }
70	%struct.pf_pdesc = type { %struct.pf_threshold, i64, %23, %struct.pf_addr, %struct.pf_addr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, i16, i8, i8, i8, i8 }
71	%struct.pf_pool = type { %struct.pf_palist, [2 x i32], ptr, [4 x i8], %struct.in6_addr, %struct.pf_addr, i32, [2 x i16], i8, i8, [1 x i32] }
72	%struct.pf_pooladdr = type <{ %struct.pf_addr_wrap, %struct.pf_palist, [2 x i32], [16 x i8], ptr, [1 x i32] }>
73	%struct.pf_rule = type <{ %struct.pf_rule_addr, %struct.pf_rule_addr, [8 x %struct.pf_rule_ptr], [64 x i8], [16 x i8], [64 x i8], [64 x i8], [64 x i8], [64 x i8], [32 x i8], %struct.pf_rulequeue, [2 x i32], %struct.pf_pool, i64, [2 x i64], [2 x i64], ptr, [4 x i8], ptr, [4 x i8], ptr, [4 x i8], i32, i32, [26 x i32], i32, i32, i32, i32, i32, i32, %struct.au_mask_t, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, [2 x i8], %struct.pf_rule_gid, %struct.pf_rule_gid, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [2 x i8] }>
74	%struct.pf_rule_addr = type <{ %struct.pf_addr_wrap, %struct.pf_rule_xport, i8, [7 x i8] }>
75	%struct.pf_rule_gid = type { [2 x i32], i8, [3 x i8] }
76	%struct.pf_rule_ptr = type { ptr, [4 x i8] }
77	%struct.pf_rule_xport = type { i32, [4 x i8] }
78	%struct.pf_rulequeue = type { ptr, ptr }
79	%struct.pf_ruleset = type { [5 x %12], ptr, i32, i32, i32 }
80	%struct.pf_src_node = type <{ %26, %struct.pf_addr, %struct.pf_addr, %struct.pf_rule_ptr, ptr, [2 x i64], [2 x i64], i32, i32, %struct.pf_threshold, i64, i64, i8, i8, [2 x i8] }>
81	%struct.pf_state = type <{ i64, i32, i32, %struct.anon, %struct.anon, %0, %struct.pf_state_peer, %struct.pf_state_peer, %struct.pf_rule_ptr, %struct.pf_rule_ptr, %struct.pf_rule_ptr, %struct.pf_addr, %struct.hook_desc_head, ptr, ptr, ptr, ptr, ptr, [2 x i64], [2 x i64], i64, i64, i64, i16, i8, i8, i8, i8, [6 x i8] }>
82	%struct.pf_state_host = type { %struct.pf_addr, %struct.in_addr }
83	%struct.pf_state_key = type { %struct.pf_state_host, %struct.pf_state_host, %struct.pf_state_host, i8, i8, i8, i8, ptr, %25, %25, %struct.anon, i16 }
84	%struct.pf_state_peer = type { i32, i32, i32, i16, i8, i8, i16, i8, ptr, [3 x i8] }
85	%struct.pf_state_scrub = type { %struct.au_mask_t, i32, i32, i32, i16, i8, i8, i32 }
86	%struct.pf_threshold = type { i32, i32, i32, i32 }
87	%struct.pfi_dynaddr = type { %6, %struct.pf_addr, %struct.pf_addr, %struct.pf_addr, %struct.pf_addr, ptr, ptr, ptr, i32, i32, i32, i8, i8 }
88	%struct.pfi_kif = type { [16 x i8], %15, [2 x [2 x [2 x i64]]], [2 x [2 x [2 x i64]]], i64, i32, ptr, ptr, i32, i32, %6 }
89	%struct.pfr_ktable = type { %struct.pfr_tstats, %7, %8, ptr, ptr, ptr, ptr, ptr, i64, i32 }
90	%struct.pfr_table = type { [1024 x i8], [32 x i8], i32, i8 }
91	%struct.pfr_tstats = type { %struct.pfr_table, [2 x [3 x i64]], [2 x [3 x i64]], i64, i64, i64, i32, [2 x i32] }
92	%struct.pkthdr = type { i32, ptr, ptr, i32, i32, i32, i16, i16, %struct.packet_tags }
93	%struct.proto_hash_entry = type opaque
94	%struct.radix_mask = type { i16, i8, i8, ptr, %9, i32 }
95	%struct.radix_node = type { ptr, ptr, i16, i8, i8, %10 }
96	%struct.radix_node_head = type { ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, [3 x %struct.radix_node], i32 }
97	%struct.route = type { ptr, i32, %struct.sockaddr }
98	%struct.rt_metrics = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32] }
99	%struct.rtentry = type { [2 x %struct.radix_node], ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, %struct.rt_metrics, ptr, ptr, i32, %struct.lck_mtx_t }
100	%struct.sockaddr = type { i8, i8, [14 x i8] }
101	%struct.tcphdr = type { i16, i16, i32, i32, i8, i8, i16, i16, i16 }
102	%struct.thread = type opaque
103@llvm.used = appending global [1 x ptr] [ptr @pf_state_compare_ext_gwy], section "llvm.metadata"		; <ptr> [#uses=0]
104
105define fastcc i32 @pf_state_compare_ext_gwy(ptr nocapture %a, ptr nocapture %b) nounwind optsize ssp {
106entry:
107	%0 = zext i8 0 to i32		; <i32> [#uses=2]
108	%1 = load i8, ptr null, align 1		; <i8> [#uses=2]
109	%2 = zext i8 %1 to i32		; <i32> [#uses=1]
110	%3 = sub i32 %0, %2		; <i32> [#uses=1]
111	%4 = icmp eq i8 0, %1		; <i1> [#uses=1]
112	br i1 %4, label %bb1, label %bb79
113
114bb1:		; preds = %entry
115	%5 = load i8, ptr null, align 4		; <i8> [#uses=2]
116	%6 = zext i8 %5 to i32		; <i32> [#uses=2]
117	%7 = getelementptr %struct.pf_state_key, ptr %b, i32 0, i32 3		; <ptr> [#uses=1]
118	%8 = load i8, ptr %7, align 4		; <i8> [#uses=2]
119	%9 = zext i8 %8 to i32		; <i32> [#uses=1]
120	%10 = sub i32 %6, %9		; <i32> [#uses=1]
121	%11 = icmp eq i8 %5, %8		; <i1> [#uses=1]
122	br i1 %11, label %bb3, label %bb79
123
124bb3:		; preds = %bb1
125	switch i32 %0, label %bb23 [
126		i32 1, label %bb4
127		i32 6, label %bb6
128		i32 17, label %bb10
129		i32 47, label %bb17
130		i32 50, label %bb21
131		i32 58, label %bb4
132	]
133
134bb4:		; preds = %bb3, %bb3
135	%12 = load i16, ptr null, align 4		; <i16> [#uses=1]
136	%13 = zext i16 %12 to i32		; <i32> [#uses=1]
137	%14 = sub i32 0, %13		; <i32> [#uses=1]
138	br i1 false, label %bb23, label %bb79
139
140bb6:		; preds = %bb3
141	%15 = load i16, ptr null, align 4		; <i16> [#uses=1]
142	%16 = zext i16 %15 to i32		; <i32> [#uses=1]
143	%17 = sub i32 0, %16		; <i32> [#uses=1]
144	ret i32 %17
145
146bb10:		; preds = %bb3
147	%18 = load i8, ptr null, align 1		; <i8> [#uses=2]
148	%19 = zext i8 %18 to i32		; <i32> [#uses=1]
149	%20 = sub i32 0, %19		; <i32> [#uses=1]
150	%21 = icmp eq i8 0, %18		; <i1> [#uses=1]
151	br i1 %21, label %bb12, label %bb79
152
153bb12:		; preds = %bb10
154	%22 = load i16, ptr null, align 4		; <i16> [#uses=1]
155	%23 = zext i16 %22 to i32		; <i32> [#uses=1]
156	%24 = sub i32 0, %23		; <i32> [#uses=1]
157	ret i32 %24
158
159bb17:		; preds = %bb3
160	%25 = load i8, ptr null, align 1		; <i8> [#uses=2]
161	%26 = icmp eq i8 %25, 1		; <i1> [#uses=1]
162	br i1 %26, label %bb18, label %bb23
163
164bb18:		; preds = %bb17
165	%27 = icmp eq i8 %25, 0		; <i1> [#uses=1]
166	br i1 %27, label %bb19, label %bb23
167
168bb19:		; preds = %bb18
169	%28 = load i16, ptr null, align 4		; <i16> [#uses=1]
170	%29 = zext i16 %28 to i32		; <i32> [#uses=1]
171	%30 = sub i32 0, %29		; <i32> [#uses=1]
172	br i1 false, label %bb23, label %bb79
173
174bb21:		; preds = %bb3
175	%31 = getelementptr %struct.pf_state_key, ptr %a, i32 0, i32 1, i32 1, i32 0		; <ptr> [#uses=1]
176	%32 = load i32, ptr %31, align 4		; <i32> [#uses=2]
177	%33 = getelementptr %struct.pf_state_key, ptr %b, i32 0, i32 1, i32 1, i32 0		; <ptr> [#uses=1]
178	%34 = load i32, ptr %33, align 4		; <i32> [#uses=2]
179	%35 = sub i32 %32, %34		; <i32> [#uses=1]
180	%36 = icmp eq i32 %32, %34		; <i1> [#uses=1]
181	br i1 %36, label %bb23, label %bb79
182
183bb23:		; preds = %bb21, %bb19, %bb18, %bb17, %bb4, %bb3
184	%cond = icmp eq i32 %6, 2		; <i1> [#uses=1]
185	br i1 %cond, label %bb24, label %bb70
186
187bb24:		; preds = %bb23
188	ret i32 1
189
190bb70:		; preds = %bb23
191	%37 = load ptr, ptr null, align 4		; <ptr> [#uses=3]
192	br i1 false, label %bb78, label %bb73
193
194bb73:		; preds = %bb70
195	%38 = load ptr, ptr null, align 4		; <ptr> [#uses=2]
196	%39 = icmp eq ptr %38, null		; <i1> [#uses=1]
197	br i1 %39, label %bb78, label %bb74
198
199bb74:		; preds = %bb73
200	%40 = ptrtoint ptr %37 to i32		; <i32> [#uses=1]
201	%41 = sub i32 0, %40		; <i32> [#uses=1]
202	%42 = icmp eq ptr %38, %37		; <i1> [#uses=1]
203	br i1 %42, label %bb76, label %bb79
204
205bb76:		; preds = %bb74
206	%43 = tail call i32 %37(ptr null, ptr null) nounwind		; <i32> [#uses=1]
207	ret i32 %43
208
209bb78:		; preds = %bb73, %bb70
210	ret i32 0
211
212bb79:		; preds = %bb74, %bb21, %bb19, %bb10, %bb4, %bb1, %entry
213	%.0 = phi i32 [ %3, %entry ], [ %10, %bb1 ], [ %14, %bb4 ], [ %20, %bb10 ], [ %30, %bb19 ], [ %35, %bb21 ], [ %41, %bb74 ]		; <i32> [#uses=1]
214	ret i32 %.0
215}
216