diff --git a/compiler/dense_switch.m b/compiler/dense_switch.m index 15949fad6..23c3640c5 100644 --- a/compiler/dense_switch.m +++ b/compiler/dense_switch.m @@ -155,8 +155,8 @@ dense_switch__generate(Cases, StartVal, EndVal, Var, CodeModel, CanFail, { RangeCheck = empty } ), % Now generate the jump table and the cases - dense_switch__generate_cases(Cases, StartVal, EndVal, CodeModel, EndLabel, - Labels, CasesCode, no, MLiveness), + dense_switch__generate_cases(Cases, StartVal, EndVal, CodeModel, + EndLabel, Labels, CasesCode, no, MLiveness), % We keep track of what variables are supposed to be % live at the end of cases. We have to do this explicitly % because generating a `fail' slot last would yield the diff --git a/compiler/labelopt.m b/compiler/labelopt.m index f55107bd7..66e2f43f2 100644 --- a/compiler/labelopt.m +++ b/compiler/labelopt.m @@ -53,48 +53,14 @@ labelopt__build_useset(Instrs, Useset) :- labelopt__build_useset_2(Instrs, Useset0, Useset). :- pred labelopt__build_useset_2(list(instruction), set(label), set(label)). -:- mode labelopt__build_useset_2(in, di, uo) is det. +:- mode labelopt__build_useset_2(in, in, out) is det. labelopt__build_useset_2([], Useset, Useset). labelopt__build_useset_2([Instr | Instructions], Useset0, Useset) :- Instr = Uinstr - _Comment, - opt_util__instr_labels(Uinstr, Labels, CodeAddresses), - labelopt__label_list_build_useset(Labels, Useset0, Useset1), - labelopt__code_addr_list_build_useset(CodeAddresses, Useset1, Useset2), - labelopt__build_useset_2(Instructions, Useset2, Useset). - -:- pred labelopt__code_addr_list_build_useset(list(code_addr), - set(label), set(label)). -:- mode labelopt__code_addr_list_build_useset(in, di, uo) is det. - - % build a list and then use set__insert_list which is - % O(NlgN) rather than doing N insertions which is O(N^2) -labelopt__code_addr_list_build_useset(CodeAddrs, Useset0, Useset) :- - labelopt__code_addr_list_build_useset_2(CodeAddrs, [], UseList), - set__insert_list(Useset0, UseList, Useset1), - copy(Useset1, Useset). - -:- pred labelopt__code_addr_list_build_useset_2(list(code_addr), - list(label), list(label)). -:- mode labelopt__code_addr_list_build_useset_2(in, in, out) is det. - - % We are not interested in code addresses that are not labels. - -labelopt__code_addr_list_build_useset_2([], UseList, UseList). -labelopt__code_addr_list_build_useset_2([CodeAddr | Rest], UseList0, UseList) :- - ( CodeAddr = label(Label) -> - UseList1 = [Label|UseList0] - ; - UseList1 = UseList0 - ), - labelopt__code_addr_list_build_useset_2(Rest, UseList1, UseList). - -:- pred labelopt__label_list_build_useset(list(label), set(label), set(label)). -:- mode labelopt__label_list_build_useset(in, di, uo) is det. - -labelopt__label_list_build_useset(Labels, Useset0, Useset) :- + opt_util__instr_labels(Uinstr, Labels, _CodeAddresses), set__insert_list(Useset0, Labels, Useset1), - copy(Useset1, Useset). + labelopt__build_useset_2(Instructions, Useset1, Useset). %-----------------------------------------------------------------------------% diff --git a/compiler/opt_util.m b/compiler/opt_util.m index e02cca576..bc5a50e6d 100644 --- a/compiler/opt_util.m +++ b/compiler/opt_util.m @@ -207,7 +207,8 @@ :- mode opt_util__livevals_addr(in, out) is det. % Determine all the labels and code addresses which are referenced - % by an instruction. + % by an instruction. The code addresses that are labels are returned + % in both output arguments. :- pred opt_util__instr_labels(instr, list(label), list(code_addr)). :- mode opt_util__instr_labels(in, out, out) is det. @@ -1046,12 +1047,28 @@ opt_util__can_use_livevals(pragma_c(_, _, _, _), no). % determine all the labels and code_addresses that are referenced by Instr opt_util__instr_labels(Instr, Labels, CodeAddrs) :- - opt_util__instr_labels_2(Instr, Labels, CodeAddrs1), + opt_util__instr_labels_2(Instr, Labels0, CodeAddrs1), opt_util__instr_rvals_and_lvals(Instr, Rvals, Lvals), exprn_aux__rval_list_addrs(Rvals, CodeAddrs2, _), exprn_aux__lval_list_addrs(Lvals, CodeAddrs3, _), list__append(CodeAddrs1, CodeAddrs2, CodeAddrs12), - list__append(CodeAddrs12, CodeAddrs3, CodeAddrs). + list__append(CodeAddrs12, CodeAddrs3, CodeAddrs), + opt_util__find_label_code_addrs(CodeAddrs, Labels0, Labels). + +:- pred opt_util__find_label_code_addrs(list(code_addr), + list(label), list(label)). +:- mode opt_util__find_label_code_addrs(in, in, out) is det. + + % Find out which code addresses are also labels. + +opt_util__find_label_code_addrs([], Labels, Labels). +opt_util__find_label_code_addrs([CodeAddr | Rest], Labels0, Labels) :- + ( CodeAddr = label(Label) -> + Labels1 = [Label | Labels0] + ; + Labels1 = Labels0 + ), + opt_util__find_label_code_addrs(Rest, Labels1, Labels). :- pred opt_util__instr_labels_2(instr, list(label), list(code_addr)). :- mode opt_util__instr_labels_2(in, out, out) is det. diff --git a/compiler/value_number.m b/compiler/value_number.m index 4fa71a4f3..3a7b6a0ce 100644 --- a/compiler/value_number.m +++ b/compiler/value_number.m @@ -264,13 +264,36 @@ value_number__procedure(Instrs0, LiveMap, UseSet, AllocSet, BreakSet, vn_debug__dump_instrs(OptInstrs1), { globals__lookup_bool_option(Globals, pred_value_number, PredVn) }, ( { PredVn = yes } -> - { list__reverse(RevTuples, Tuples) }, - value_number__process_parallel_tuples(Tuples, OptBlocks0, - LiveMap, Params, OptBlocks), - { list__condense([Comments | OptBlocks], OptInstrs2) }, - { opt_util__propagate_livevals(OptInstrs2, OptInstrs) }, - vn_debug__cost_header_msg("procedure after parallels"), - vn_debug__dump_instrs(OptInstrs) + % Predicate wide value numbering tries to delete assignments + % to variables when the target location already contains the + % right value. However, if this assignment is in a loop, + % then this eliminated assignment may be exactly what put the + % right value in the right location. For example, we can't + % delete the assignment to r1 in the following code: + % + % L1: + % r1 = r2 + % goto L1 + % + % If opt_util__propagate_livevals changes any livevals + % instructions, we also can't apply predicate wide value + % numbering, since its input (OptBlocks) contains the + % old livevals sets. + ( + { value_number__has_no_backward_branches(Instrs0) }, + { OptInstrs1 = OptInstrs0 } + -> + { list__reverse(RevTuples, Tuples) }, + value_number__process_parallel_tuples(Tuples, + OptBlocks0, LiveMap, Params, OptBlocks), + { list__condense([Comments | OptBlocks], OptInstrs2) }, + { opt_util__propagate_livevals(OptInstrs2, OptInstrs) }, + vn_debug__cost_header_msg("procedure after parallels"), + vn_debug__dump_instrs(OptInstrs) + ; + vn_debug__cost_header_msg("parallels do not apply"), + { OptInstrs = OptInstrs0 } + ) ; { OptInstrs = OptInstrs0 } ). @@ -1049,6 +1072,39 @@ value_number__boundary_instr(incr_sp(_, _), yes). value_number__boundary_instr(decr_sp(_), yes). value_number__boundary_instr(pragma_c(_, _, _, _), yes). +%-----------------------------------------------------------------------------% + +:- pred value_number__has_no_backward_branches(list(instruction)). +:- mode value_number__has_no_backward_branches(in) is semidet. + +value_number__has_no_backward_branches(Instrs) :- + set__init(Labels), + value_number__has_no_backward_branches_2(Instrs, Labels). + +:- pred value_number__has_no_backward_branches_2(list(instruction), set(label)). +:- mode value_number__has_no_backward_branches_2(in, in) is semidet. + +value_number__has_no_backward_branches_2([], _). +value_number__has_no_backward_branches_2([Instr - _ | Instrs], SoFar0) :- + ( + Instr = label(Label) + -> + set__insert(SoFar0, Label, SoFar) + ; + opt_util__instr_labels(Instr, LabelRefs, _), + value_number__no_old_labels(LabelRefs, SoFar0), + SoFar = SoFar0 + ), + value_number__has_no_backward_branches_2(Instrs, SoFar). + +:- pred value_number__no_old_labels(list(label), set(label)). +:- mode value_number__no_old_labels(in, in) is semidet. + +value_number__no_old_labels([], _SoFar). +value_number__no_old_labels([Label | Labels], SoFar) :- + \+ set__member(Label, SoFar), + value_number__no_old_labels(Labels, SoFar). + %-----------------------------------------------------------------------------% %-----------------------------------------------------------------------------% diff --git a/compiler/vn_block.m b/compiler/vn_block.m index 9dc243e23..8ac95bc8f 100644 --- a/compiler/vn_block.m +++ b/compiler/vn_block.m @@ -94,14 +94,13 @@ vn_block__build_block_info(Instrs, Livemap, Params, ParEntries, LabelNo0, VnTables, Liveset, SeenIncr, Tuple) :- vn_table__init_tables(VnTables0), vn_block__build_from_parallel(ParEntries, VnTables0, VnTables1), - set__init(LabelsSoFar0), set__init(Liveset0), map__init(Ctrlmap0), map__init(Flushmap0), map__init(Parmap0), Tuple0 = tuple(0, Ctrlmap0, Flushmap0, LabelNo0, Parmap0), vn_block__handle_instrs(Instrs, Livemap, Params, VnTables1, VnTables, - Liveset0, Liveset, LabelsSoFar0, no, SeenIncr, Tuple0, Tuple). + Liveset0, Liveset, no, SeenIncr, Tuple0, Tuple). :- pred vn_block__build_from_parallel(list(parentry), vn_tables, vn_tables). % :- mode vn_block__build_from_parallel(in, di, uo) is det. @@ -162,48 +161,45 @@ vn_block__build_from_fake_rval(Lval, [Cheap | Cheaps], VnTables0, VnTables) :- %-----------------------------------------------------------------------------% :- pred vn_block__handle_instrs(list(instruction), livemap, vn_params, - vn_tables, vn_tables, vnlvalset, vnlvalset, set(label), - bool, bool, vn_ctrl_tuple, vn_ctrl_tuple). -:- mode vn_block__handle_instrs(in, in, in, in, out, in, out, in, in, out, + vn_tables, vn_tables, vnlvalset, vnlvalset, + bool, bool, vn_ctrl_tuple, vn_ctrl_tuple). +:- mode vn_block__handle_instrs(in, in, in, in, out, in, out, in, out, in, out) is det. vn_block__handle_instrs([], _Livemap, _Params, VnTables, VnTables, - Liveset, Liveset, _, SeenIncr, SeenIncr, Tuple, Tuple). + Liveset, Liveset, SeenIncr, SeenIncr, Tuple, Tuple). vn_block__handle_instrs([Uinstr0 - _ | Instrs], Livemap, Params, - VnTables0, VnTables, Liveset0, Liveset, LabelsSoFar0, + VnTables0, VnTables, Liveset0, Liveset, SeenIncr0, SeenIncr, Tuple0, Tuple) :- vn_block__handle_instr(Uinstr0, Livemap, Params, VnTables0, VnTables1, - Liveset0, Liveset1, LabelsSoFar0, LabelsSoFar1, - SeenIncr0, SeenIncr1, Tuple0, Tuple1), + Liveset0, Liveset1, SeenIncr0, SeenIncr1, Tuple0, Tuple1), vn_block__handle_instrs(Instrs, Livemap, Params, VnTables1, VnTables, - Liveset1, Liveset, LabelsSoFar1, - SeenIncr1, SeenIncr, Tuple1, Tuple). + Liveset1, Liveset, SeenIncr1, SeenIncr, Tuple1, Tuple). % If you change vn_block__handle_instr, you may also have to change % vn_block__is_ctrl_instr. :- pred vn_block__handle_instr(instr, livemap, vn_params, vn_tables, vn_tables, - vnlvalset, vnlvalset, set(label), set(label), - bool, bool, vn_ctrl_tuple, vn_ctrl_tuple). -:- mode vn_block__handle_instr(in, in, in, in, out, in, out, in, out, in, out, + vnlvalset, vnlvalset, bool, bool, vn_ctrl_tuple, vn_ctrl_tuple). +:- mode vn_block__handle_instr(in, in, in, in, out, in, out, in, out, in, out) is det. vn_block__handle_instr(comment(_), _Livemap, _Params, VnTables, VnTables, Liveset, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple, Tuple). + SeenIncr, SeenIncr, Tuple, Tuple). vn_block__handle_instr(livevals(Livevals), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_block__new_ctrl_node(vn_livevals(Livevals), Livemap, - Params, LabelsSoFar, VnTables0, VnTables, + Params, VnTables0, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(block(_, _, _), _Livemap, _Params, VnTables, VnTables, Liveset, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple, Tuple) :- + SeenIncr, SeenIncr, Tuple, Tuple) :- error("block should not be found in vn_block__handle_instr"). vn_block__handle_instr(assign(Lval, Rval), _Livemap, _Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple, Tuple) :- + SeenIncr, SeenIncr, Tuple, Tuple) :- vn_util__rval_to_vn(Rval, Vn, VnTables0, VnTables1), vn_util__lval_to_vnlval(Lval, Vnlval, VnTables1, VnTables2), vn_table__set_desired_value(Vnlval, Vn, VnTables2, VnTables), @@ -211,59 +207,58 @@ vn_block__handle_instr(assign(Lval, Rval), set__insert_list(Liveset0, Specials, Liveset). vn_block__handle_instr(call(Proc, Return, Info, CallModel), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_block__new_ctrl_node(vn_call(Proc, Return, Info, CallModel), Livemap, - Params, LabelsSoFar, VnTables0, VnTables, + Params, VnTables0, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(mkframe(Name, Size, Redoip), Livemap, Params, - VnTables0, VnTables, Liveset0, Liveset, LabelsSoFar0, - LabelsSoFar, SeenIncr0, SeenIncr, Tuple0, Tuple) :- + VnTables0, VnTables, Liveset0, Liveset, + SeenIncr0, SeenIncr, Tuple0, Tuple) :- vn_block__new_ctrl_node(vn_mkframe(Name, Size, Redoip), - Livemap, Params, LabelsSoFar0, VnTables0, VnTables1, + Livemap, Params, VnTables0, VnTables1, Liveset0, Liveset1, Tuple0, Tuple1), vn_block__handle_instr(assign(redoip(lval(maxfr)), const(code_addr_const(Redoip))), Livemap, Params, VnTables1, VnTables, Liveset1, Liveset, - LabelsSoFar0, LabelsSoFar, SeenIncr0, SeenIncr, Tuple1, Tuple). + SeenIncr0, SeenIncr, Tuple1, Tuple). vn_block__handle_instr(modframe(Redoip), Livemap, Params, - VnTables0, VnTables, Liveset0, Liveset, LabelsSoFar0, - LabelsSoFar, SeenIncr0, SeenIncr, Tuple0, Tuple) :- + VnTables0, VnTables, Liveset0, Liveset, + SeenIncr0, SeenIncr, Tuple0, Tuple) :- vn_block__handle_instr(assign(redoip(lval(curfr)), const(code_addr_const(Redoip))), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar0, LabelsSoFar, SeenIncr0, SeenIncr, Tuple0, Tuple). + SeenIncr0, SeenIncr, Tuple0, Tuple). vn_block__handle_instr(label(Label), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar0, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- - set__insert(LabelsSoFar0, Label, LabelsSoFar), - vn_block__new_ctrl_node(vn_label(Label), Livemap, Params, LabelsSoFar, + SeenIncr, SeenIncr, Tuple0, Tuple) :- + vn_block__new_ctrl_node(vn_label(Label), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(goto(Target), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- - vn_block__new_ctrl_node(vn_goto(Target), Livemap, Params, LabelsSoFar, + SeenIncr, SeenIncr, Tuple0, Tuple) :- + vn_block__new_ctrl_node(vn_goto(Target), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(computed_goto(Rval, Labels), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_util__rval_to_vn(Rval, Vn, VnTables0, VnTables1), vn_block__new_ctrl_node(vn_computed_goto(Vn, Labels), Livemap, - Params, LabelsSoFar, VnTables1, VnTables, + Params, VnTables1, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(c_code(_), _Livemap, _Params, VnTables, VnTables, Liveset, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple, Tuple) :- + SeenIncr, SeenIncr, Tuple, Tuple) :- error("c_code should not be found in handle_instr"). vn_block__handle_instr(if_val(Rval, Target), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_util__rval_to_vn(Rval, Vn, VnTables0, VnTables1), vn_block__new_ctrl_node(vn_if_val(Vn, Target), Livemap, - Params, LabelsSoFar, VnTables1, VnTables, + Params, VnTables1, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(incr_hp(Lval, MaybeTag, Rval), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar0, LabelsSoFar, _SeenIncr, SeenIncr, Tuple0, Tuple) :- + _SeenIncr, SeenIncr, Tuple0, Tuple) :- ( MaybeTag = no, StoreInstr = assign(Lval, lval(hp)) @@ -276,71 +271,71 @@ vn_block__handle_instr(incr_hp(Lval, MaybeTag, Rval), binop((*), Rval, const(int_const(BytesPerWord))))), vn_block__handle_instr(StoreInstr, Livemap, Params, VnTables0, VnTables1, Liveset0, Liveset1, - LabelsSoFar0, LabelsSoFar1, yes, SeenIncr1, Tuple0, Tuple1), + yes, SeenIncr1, Tuple0, Tuple1), vn_block__handle_instr(IncrInstr, Livemap, Params, VnTables1, VnTables, Liveset1, Liveset, - LabelsSoFar1, LabelsSoFar, SeenIncr1, SeenIncr, Tuple1, Tuple). + SeenIncr1, SeenIncr, Tuple1, Tuple). vn_block__handle_instr(mark_hp(Lval), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_util__lval_to_vnlval(Lval, Vnlval, VnTables0, VnTables1), vn_block__new_ctrl_node(vn_mark_hp(Vnlval), Livemap, - Params, LabelsSoFar, VnTables1, VnTables, + Params, VnTables1, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(restore_hp(Rval), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_util__rval_to_vn(Rval, Vn, VnTables0, VnTables1), vn_block__new_ctrl_node(vn_restore_hp(Vn), Livemap, - Params, LabelsSoFar, VnTables1, VnTables, + Params, VnTables1, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(store_ticket(Lval), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_util__lval_to_vnlval(Lval, Vnlval, VnTables0, VnTables1), vn_block__new_ctrl_node(vn_store_ticket(Vnlval), Livemap, - Params, LabelsSoFar, VnTables1, VnTables, + Params, VnTables1, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(restore_ticket(Rval), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_util__rval_to_vn(Rval, Vn, VnTables0, VnTables1), vn_block__new_ctrl_node(vn_restore_ticket(Vn), Livemap, - Params, LabelsSoFar, VnTables1, VnTables, + Params, VnTables1, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(discard_ticket, Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_block__new_ctrl_node(vn_discard_ticket, Livemap, - Params, LabelsSoFar, VnTables0, VnTables, + Params, VnTables0, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(incr_sp(N, Msg), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_block__new_ctrl_node(vn_incr_sp(N, Msg), Livemap, - Params, LabelsSoFar, VnTables0, VnTables, + Params, VnTables0, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(decr_sp(N), Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple0, Tuple) :- + SeenIncr, SeenIncr, Tuple0, Tuple) :- vn_block__new_ctrl_node(vn_decr_sp(N), Livemap, - Params, LabelsSoFar, VnTables0, VnTables, + Params, VnTables0, VnTables, Liveset0, Liveset, Tuple0, Tuple). vn_block__handle_instr(pragma_c(_, _, _, _), _Livemap, _Params, VnTables, VnTables, Liveset, Liveset, - LabelsSoFar, LabelsSoFar, SeenIncr, SeenIncr, Tuple, Tuple) :- + SeenIncr, SeenIncr, Tuple, Tuple) :- error("value numbering not supported for pragma_c"). %-----------------------------------------------------------------------------% %-----------------------------------------------------------------------------% -:- pred vn_block__new_ctrl_node(vn_instr, livemap, vn_params, set(label), +:- pred vn_block__new_ctrl_node(vn_instr, livemap, vn_params, vn_tables, vn_tables, vnlvalset, vnlvalset, vn_ctrl_tuple, vn_ctrl_tuple). -:- mode vn_block__new_ctrl_node(in, in, in, in, in, out, in, out, in, out) +:- mode vn_block__new_ctrl_node(in, in, in, in, out, in, out, in, out) is det. -vn_block__new_ctrl_node(VnInstr, Livemap, Params, LabelsSoFar, +vn_block__new_ctrl_node(VnInstr, Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, tuple(Ctrl0, Ctrlmap0, Flushmap0, LabelNo0, Parmap0), tuple(Ctrl, Ctrlmap, Flushmap, LabelNo, Parmap)) :- @@ -384,11 +379,7 @@ vn_block__new_ctrl_node(VnInstr, Livemap, Params, LabelsSoFar, VnTables0, VnTables, Liveset0, Liveset, FlushEntry0, FlushEntry, LabelNo0, LabelNo, Parallels1), - ( set__member(Label, LabelsSoFar) -> - Parallels = [] - ; - Parallels = Parallels1 - ) + Parallels = Parallels1 ; vn_block__record_at_call(VnTables0, VnTables, Liveset0, Liveset, FlushEntry0, FlushEntry), @@ -400,27 +391,13 @@ vn_block__new_ctrl_node(VnInstr, Livemap, Params, LabelsSoFar, vn_block__record_several_labels(Labels, Livemap, Params, VnTables0, VnTables, Liveset0, Liveset, FlushEntry0, FlushEntry, LabelNo0, LabelNo, Parallels1), - ( - list__member(Label, Labels), - set__member(Label, LabelsSoFar) - -> - Parallels = [] - ; - Parallels = Parallels1 - ) + Parallels = Parallels1 ; VnInstr = vn_if_val(_, TargetAddr), vn_block__new_if_node(TargetAddr, Livemap, Params, Ctrlmap0, Ctrl0, VnTables0, VnTables, Liveset0, Liveset, FlushEntry0, FlushEntry, LabelNo0, LabelNo, Parallels1), - ( - TargetAddr = label(Label), - set__member(Label, LabelsSoFar) - -> - Parallels = [] - ; - Parallels = Parallels1 - ) + Parallels = Parallels1 ; VnInstr = vn_mark_hp(Vnlval), vn_util__rval_to_vn(lval(hp), Vn, VnTables0, VnTables1),