xref: /llvm-project/llvm/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll (revision 8979ae42769e529b0f6fce3268492ffb49bd54b9)
1; RUN: opt < %s -passes=gvn,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output
2; PR867
3
4target datalayout = "E-p:32:32"
5target triple = "powerpc-unknown-linux-gnu"
6	%struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
7	%struct.eh_status = type opaque
8	%struct.emit_status = type { i32, i32, ptr, ptr, ptr, i32, %struct.location_t, i32, ptr, ptr }
9	%struct.expr_status = type { i32, i32, i32, ptr, ptr, ptr }
10	%struct.function = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, %struct.CUMULATIVE_ARGS, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, ptr, i32, i32, ptr, ptr, i32, i32, i32, ptr, i32, i32, i8, i8, ptr, ptr, i32, i32, i32, i32, %struct.location_t, ptr, ptr, i8, i8, i8 }
11	%struct.initial_value_struct = type opaque
12	%struct.lang_decl = type opaque
13	%struct.lang_type = type opaque
14	%struct.language_function = type opaque
15	%struct.location_t = type { ptr, i32 }
16	%struct.machine_function = type { i32, i32, ptr, i32, i32 }
17	%struct.rtunion = type { i32 }
18	%struct.rtvec_def = type { i32, [1 x ptr] }
19	%struct.rtx_def = type { i16, i8, i8, %struct.u }
20	%struct.sequence_stack = type { ptr, ptr, ptr }
21	%struct.temp_slot = type opaque
22	%struct.tree_common = type { ptr, ptr, ptr, i8, i8, i8, i8, i8 }
23	%struct.tree_decl = type { %struct.tree_common, %struct.location_t, i32, ptr, i8, i8, i8, i8, i8, i8, i8, i8, i32, %struct.tree_decl_u1, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.tree_decl_u2, ptr, ptr, i64, ptr }
24	%struct.tree_decl_u1 = type { i64 }
25	%struct.tree_decl_u2 = type { ptr }
26	%struct.tree_node = type { %struct.tree_decl }
27	%struct.tree_type = type { %struct.tree_common, ptr, ptr, ptr, ptr, i32, i16, i8, i8, i32, ptr, ptr, %struct.rtunion, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr }
28	%struct.u = type { [1 x i64] }
29	%struct.var_refs_queue = type { ptr, i32, i32, ptr }
30	%struct.varasm_status = type opaque
31	%struct.varray_head_tag = type { i32, i32, i32, ptr, %struct.u }
32	%union.tree_ann_d = type opaque
33@mode_class = external global [35 x i8]		; <ptr> [#uses=3]
34
35define void @fold_builtin_classify() {
36entry:
37	%tmp63 = load i32, ptr null		; <i32> [#uses=1]
38	switch i32 %tmp63, label %bb276 [
39		 i32 414, label %bb145
40		 i32 417, label %bb
41	]
42bb:		; preds = %entry
43	ret void
44bb145:		; preds = %entry
45	%tmp146 = load ptr, ptr null		; <ptr> [#uses=1]
46	%tmp148 = getelementptr %struct.tree_node, ptr %tmp146, i32 0, i32 0, i32 0, i32 1		; <ptr> [#uses=1]
47	%tmp149 = load ptr, ptr %tmp148		; <ptr> [#uses=1]
48	%tmp151 = getelementptr %struct.tree_type, ptr %tmp149, i32 0, i32 6		; <ptr> [#uses=1]
49	%tmp152 = load i32, ptr %tmp151		; <i32> [#uses=1]
50	%tmp154 = lshr i32 %tmp152, 16		; <i32> [#uses=1]
51	%tmp154.mask = and i32 %tmp154, 127		; <i32> [#uses=1]
52	%gep.upgrd.2 = zext i32 %tmp154.mask to i64		; <i64> [#uses=1]
53	%tmp155 = getelementptr [35 x i8], ptr @mode_class, i32 0, i64 %gep.upgrd.2		; <ptr> [#uses=1]
54	%tmp156 = load i8, ptr %tmp155		; <i8> [#uses=1]
55	%tmp157 = icmp eq i8 %tmp156, 4		; <i1> [#uses=1]
56	br i1 %tmp157, label %cond_next241, label %cond_true158
57cond_true158:		; preds = %bb145
58	%tmp172 = load ptr, ptr null		; <ptr> [#uses=1]
59	%tmp174 = getelementptr %struct.tree_node, ptr %tmp172, i32 0, i32 0, i32 0, i32 1		; <ptr> [#uses=1]
60	%tmp175 = load ptr, ptr %tmp174		; <ptr> [#uses=1]
61	%tmp177 = getelementptr %struct.tree_type, ptr %tmp175, i32 0, i32 6		; <ptr> [#uses=1]
62	%tmp178 = load i32, ptr %tmp177		; <i32> [#uses=1]
63	%tmp180 = lshr i32 %tmp178, 16		; <i32> [#uses=1]
64	%tmp180.mask = and i32 %tmp180, 127		; <i32> [#uses=1]
65	%gep.upgrd.4 = zext i32 %tmp180.mask to i64		; <i64> [#uses=1]
66	%tmp181 = getelementptr [35 x i8], ptr @mode_class, i32 0, i64 %gep.upgrd.4		; <ptr> [#uses=1]
67	%tmp182 = load i8, ptr %tmp181		; <i8> [#uses=1]
68	%tmp183 = icmp eq i8 %tmp182, 8		; <i1> [#uses=1]
69	br i1 %tmp183, label %cond_next241, label %cond_true184
70cond_true184:		; preds = %cond_true158
71	%tmp185 = load ptr, ptr null		; <ptr> [#uses=1]
72	%tmp187 = getelementptr %struct.tree_node, ptr %tmp185, i32 0, i32 0, i32 0, i32 1		; <ptr> [#uses=1]
73	%tmp188 = load ptr, ptr %tmp187		; <ptr> [#uses=1]
74	%tmp190 = getelementptr %struct.tree_type, ptr %tmp188, i32 0, i32 6		; <ptr> [#uses=1]
75	%tmp191 = load i32, ptr %tmp190		; <i32> [#uses=1]
76	%tmp193 = lshr i32 %tmp191, 16		; <i32> [#uses=1]
77	%tmp193.mask = and i32 %tmp193, 127		; <i32> [#uses=1]
78	%gep.upgrd.6 = zext i32 %tmp193.mask to i64		; <i64> [#uses=1]
79	%tmp194 = getelementptr [35 x i8], ptr @mode_class, i32 0, i64 %gep.upgrd.6		; <ptr> [#uses=1]
80	%tmp195 = load i8, ptr %tmp194		; <i8> [#uses=1]
81	%tmp196 = icmp eq i8 %tmp195, 4		; <i1> [#uses=1]
82	br i1 %tmp196, label %cond_next241, label %cond_true197
83cond_true197:		; preds = %cond_true184
84	ret void
85cond_next241:		; preds = %cond_true184, %cond_true158, %bb145
86	%tmp245 = load i32, ptr null		; <i32> [#uses=0]
87	ret void
88bb276:		; preds = %entry
89	ret void
90}
91