[WebAssembly] Don't perform the returned-argument optimization on constants.
[oota-llvm.git] / test / CodeGen / Generic / 2006-08-30-CoalescerCrash.ll
1 ; RUN: llc < %s 
2 %struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
3         %struct.VEC_edge = type { i32, i32, [1 x %struct.edge_def*] }
4         %struct._obstack_chunk = type { i8*, %struct._obstack_chunk*, [4 x i8] }
5         %struct.basic_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.tree_node*, %struct.VEC_edge*, %struct.VEC_edge*, %struct.bitmap_head_def*, %struct.bitmap_head_def*, i8*, %struct.loop*, [2 x %struct.et_node*], %struct.basic_block_def*, %struct.basic_block_def*, %struct.reorder_block_def*, %struct.bb_ann_d*, i64, i32, i32, i32, i32 }
6         %struct.bb_ann_d = type { %struct.tree_node*, i8, %struct.edge_prediction* }
7         %struct.bitmap_element_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, i32, [4 x i32] }
8         %struct.bitmap_head_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, i32, %struct.bitmap_obstack* }
9         %struct.bitmap_obstack = type { %struct.bitmap_element_def*, %struct.bitmap_head_def*, %struct.obstack }
10         %struct.cost_pair = type { %struct.iv_cand*, i32, %struct.bitmap_head_def* }
11         %struct.dataflow_d = type { %struct.varray_head_tag*, [2 x %struct.tree_node*] }
12         %struct.def_operand_ptr = type { %struct.tree_node** }
13         %struct.def_optype_d = type { i32, [1 x %struct.def_operand_ptr] }
14         %struct.edge_def = type { %struct.basic_block_def*, %struct.basic_block_def*, %struct.edge_def_insns, i8*, %struct.location_t*, i32, i32, i64, i32 }
15         %struct.edge_def_insns = type { %struct.rtx_def* }
16         %struct.edge_prediction = type { %struct.edge_prediction*, %struct.edge_def*, i32, i32 }
17         %struct.eh_status = type opaque
18         %struct.emit_status = type { i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, i32, %struct.location_t, i32, i8*, %struct.rtx_def** }
19         %struct.et_node = type opaque
20         %struct.expr_status = type { i32, i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* }
21         %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.function*, i32, i32, i32, i32, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, i8, i32, i64, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.varray_head_tag*, %struct.temp_slot*, i32, %struct.var_refs_queue*, i32, i32, %struct.rtvec_def*, %struct.tree_node*, i32, i32, i32, %struct.machine_function*, i32, i32, i1, i1, %struct.language_function*, %struct.rtx_def*, i32, i32, i32, i32, %struct.location_t, %struct.varray_head_tag*, %struct.tree_node*, i8, i8, i8 }
22         %struct.htab = type { i32 (i8*)*, i32 (i8*, i8*)*, void (i8*)*, i8**, i32, i32, i32, i32, i32, i8* (i32, i32)*, void (i8*)*, i8*, i8* (i8*, i32, i32)*, void (i8*, i8*)*, i32 }
23         %struct.initial_value_struct = type opaque
24         %struct.iv = type { %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, i1, i1, i32 }
25         %struct.iv_cand = type { i32, i1, i32, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.iv*, i32 }
26         %struct.iv_use = type { i32, i32, %struct.iv*, %struct.tree_node*, %struct.tree_node**, %struct.bitmap_head_def*, i32, %struct.cost_pair*, %struct.iv_cand* }
27         %struct.ivopts_data = type { %struct.loop*, %struct.htab*, i32, %struct.version_info*, %struct.bitmap_head_def*, i32, %struct.varray_head_tag*, %struct.varray_head_tag*, %struct.bitmap_head_def*, i1 }
28         %struct.lang_decl = type opaque
29         %struct.language_function = type opaque
30         %struct.location_t = type { i8*, i32 }
31         %struct.loop = type { i32, %struct.basic_block_def*, %struct.basic_block_def*, %struct.basic_block_def*, %struct.lpt_decision, i32, i32, %struct.edge_def**, i32, %struct.basic_block_def*, %struct.basic_block_def*, i32, %struct.edge_def**, i32, %struct.edge_def**, i32, %struct.simple_bitmap_def*, i32, %struct.loop**, i32, %struct.loop*, %struct.loop*, %struct.loop*, %struct.loop*, i32, i8*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, i32, %struct.tree_node*, %struct.tree_node*, %struct.nb_iter_bound*, %struct.edge_def*, i1 }
32         %struct.lpt_decision = type { i32, i32 }
33         %struct.machine_function = type { %struct.stack_local_entry*, i8*, %struct.rtx_def*, i32, i32, i32, i32, i32 }
34         %struct.nb_iter_bound = type { %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.nb_iter_bound* }
35         %struct.obstack = type { i32, %struct._obstack_chunk*, i8*, i8*, i8*, i32, i32, %struct._obstack_chunk* (i8*, i32)*, void (i8*, %struct._obstack_chunk*)*, i8*, i8 }
36         %struct.reorder_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.basic_block_def*, %struct.basic_block_def*, %struct.basic_block_def*, i32, i32, i32 }
37         %struct.rtvec_def = type { i32, [1 x %struct.rtx_def*] }
38         %struct.rtx_def = type { i16, i8, i8, %struct.u }
39         %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* }
40         %struct.simple_bitmap_def = type { i32, i32, i32, [1 x i64] }
41         %struct.stack_local_entry = type opaque
42         %struct.stmt_ann_d = type { %struct.tree_ann_common_d, i8, %struct.basic_block_def*, %struct.stmt_operands_d, %struct.dataflow_d*, %struct.bitmap_head_def*, i32 }
43         %struct.stmt_operands_d = type { %struct.def_optype_d*, %struct.def_optype_d*, %struct.v_may_def_optype_d*, %struct.vuse_optype_d*, %struct.v_may_def_optype_d* }
44         %struct.temp_slot = type opaque
45         %struct.tree_ann_common_d = type { i32, i8*, %struct.tree_node* }
46         %struct.tree_ann_d = type { %struct.stmt_ann_d }
47         %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %struct.tree_ann_d*, i8, i8, i8, i8, i8 }
48         %struct.tree_decl = type { %struct.tree_common, %struct.location_t, i32, %struct.tree_node*, i8, i8, i8, i8, i8, i8, i8, i32, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, i32, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_decl* }
49         %struct.tree_decl_u1 = type { i64 }
50         %struct.tree_decl_u2 = type { %struct.function* }
51         %struct.tree_node = type { %struct.tree_decl }
52         %struct.u = type { [1 x i64] }
53         %struct.v_def_use_operand_type_t = type { %struct.tree_node*, %struct.tree_node* }
54         %struct.v_may_def_optype_d = type { i32, [1 x %struct.v_def_use_operand_type_t] }
55         %struct.var_refs_queue = type { %struct.rtx_def*, i32, i32, %struct.var_refs_queue* }
56         %struct.varasm_status = type opaque
57         %struct.varray_head_tag = type { i32, i32, i32, i8*, %struct.u }
58         %struct.version_info = type { %struct.tree_node*, %struct.iv*, i1, i32, i1 }
59         %struct.vuse_optype_d = type { i32, [1 x %struct.tree_node*] }
60
61 define i1 @determine_use_iv_cost(%struct.ivopts_data* %data, %struct.iv_use* %use, %struct.iv_cand* %cand) {
62 entry:
63         switch i32 0, label %bb91 [
64                  i32 0, label %bb
65                  i32 1, label %bb6
66                  i32 3, label %cond_next135
67         ]
68
69 bb:             ; preds = %entry
70         ret i1 false
71
72 bb6:            ; preds = %entry
73         br i1 false, label %bb87, label %cond_next27
74
75 cond_next27:            ; preds = %bb6
76         br i1 false, label %cond_true30, label %cond_next55
77
78 cond_true30:            ; preds = %cond_next27
79         br i1 false, label %cond_next41, label %cond_true35
80
81 cond_true35:            ; preds = %cond_true30
82         ret i1 false
83
84 cond_next41:            ; preds = %cond_true30
85         %tmp44 = call i32 @force_var_cost( %struct.ivopts_data* %data, %struct.tree_node* null, %struct.bitmap_head_def** null )                ; <i32> [#uses=2]
86         %tmp46 = udiv i32 %tmp44, 5             ; <i32> [#uses=1]
87         call void @set_use_iv_cost( %struct.ivopts_data* %data, %struct.iv_use* %use, %struct.iv_cand* %cand, i32 %tmp46, %struct.bitmap_head_def* null )
88         %tmp44.off = add i32 %tmp44, -50000000          ; <i32> [#uses=1]
89         %tmp52 = icmp ugt i32 %tmp44.off, 4             ; <i1> [#uses=1]
90         %tmp52.upgrd.1 = zext i1 %tmp52 to i32          ; <i32> [#uses=1]
91         br label %bb87
92
93 cond_next55:            ; preds = %cond_next27
94         ret i1 false
95
96 bb87:           ; preds = %cond_next41, %bb6
97         %tmp2.0 = phi i32 [ %tmp52.upgrd.1, %cond_next41 ], [ 1, %bb6 ]         ; <i32> [#uses=0]
98         ret i1 false
99
100 bb91:           ; preds = %entry
101         ret i1 false
102
103 cond_next135:           ; preds = %entry
104         %tmp193 = call i1 @determine_use_iv_cost_generic( %struct.ivopts_data* %data, %struct.iv_use* %use, %struct.iv_cand* %cand )            ; <i1> [#uses=0]
105         ret i1 false
106 }
107
108 declare void @set_use_iv_cost(%struct.ivopts_data*, %struct.iv_use*, %struct.iv_cand*, i32, %struct.bitmap_head_def*)
109
110 declare i32 @force_var_cost(%struct.ivopts_data*, %struct.tree_node*, %struct.bitmap_head_def**)
111
112 declare i1 @determine_use_iv_cost_generic(%struct.ivopts_data*, %struct.iv_use*, %struct.iv_cand*)