Let switch detection handle deeper disjunctions.

compiler/switch_detection.m:
    The existing switch detection algorithm does a single forward
    traversal of the procedure body, doing only very limited lookahead.
    This prevents it from recognizing some switches. To fix this, add
    a new prepass that provides unlimited lookahead.

    Add one use of this lookahead information. Later diffs should add
    more uses.

compiler/print_help.m:
    Fix the code that served as motivation for this change.
    It was a block of unifications that was intended to supply
    the lookahead that the old algorithm needed but did not have,
    but it actually lied: it said that the the following disjunction
    covered cons_ids that it actually did not cover. The fact that
    the compiler did not diagnose this lie until now was a bug.
    (After this diff, the compiler now reports an error.)

deep_profiler/message.m:
    Avoid the limitation of the new algorithm that was discussed today
    on m-dev.

compiler/options.m:
    Add a way to test for the presence of this new capability
    in the installed compiler.

tests/warnings/help_text.err_exp:
    Expect the new option name.
This commit is contained in:
Zoltan Somogyi
2025-11-15 05:08:29 +11:00
parent 87d04f3428
commit c9e549996a
5 changed files with 1026 additions and 51 deletions

View File

@@ -5649,7 +5649,8 @@ optdb(oc_dev_ctrl, compiler_sufficiently_recent, bool(no),
"unused-statevar-warn-2025-05-16",
"allow-non-contig-for-2025-06-01",
"subtype-int2-2025-07-07",
"inrange-2025-10-01"], [
"inrange-2025-10-01",
"scout-disj-2025-11-15"], [
w("Is the compiler sufficiently recent to contain the new feature"),
w("or bugfix referred to by each name?")])).
% These options are provided for use by implementors who want to compare

View File

@@ -2161,10 +2161,6 @@ reflow_lines_loop_over_lines(Format, LineLen, Pieces, !CindexCord, !FindexCord,
; HeadPiece = var(_, _)
; HeadPiece = file_var(_, _)
; HeadPiece = file_var(_, _, _)
; HeadPiece = ref(_, _, _)
; HeadPiece = ref(_, _, _, _)
; HeadPiece = xref(_)
; HeadPiece = xref(_, _)
),
(
( HeadPiece = quote(Text), Suffix = ""

File diff suppressed because it is too large Load Diff

View File

@@ -312,18 +312,18 @@ message_type_to_string(MessageType) = Cord :-
MessageType = info_found_candidate_conjunction,
String = "Found candidate conjunction"
;
(
MessageType = info_found_conjs_above_callsite_threshold(Num),
MessageStr = "Found %d conjuncts above callsite threshold"
;
MessageType = info_found_n_conjunctions_with_positive_speedup(Num),
MessageStr = "Found %d conjunctions with a positive speedup due"
++ " to parallelisation"
;
MessageType = info_split_conjunction_into_partitions(Num),
MessageStr = "Split conjunction into %d partitions, "
++ "this may reduce parallelism"
),
MessageType = info_found_conjs_above_callsite_threshold(Num),
MessageStr = "Found %d conjuncts above callsite threshold",
string.format(MessageStr, [i(Num)], String)
;
MessageType = info_found_n_conjunctions_with_positive_speedup(Num),
MessageStr = "Found %d conjunctions with a positive speedup due"
++ " to parallelisation",
string.format(MessageStr, [i(Num)], String)
;
MessageType = info_split_conjunction_into_partitions(Num),
MessageStr = "Split conjunction into %d partitions, "
++ "this may reduce parallelism",
string.format(MessageStr, [i(Num)], String)
;
MessageType = info_found_pushed_conjs_above_callsite_threshold,
@@ -357,16 +357,15 @@ message_type_to_string(MessageType) = Cord :-
String = "Cannot compute procrep coverage annotation: " ++ Msg
++ "\n falling back to some other method"
;
(
MessageType =
warning_cannot_compute_cost_of_recursive_calls(WarnStr),
Template = "Cannot compute cost of recursive calls: %s"
;
MessageType =
warning_cannot_compute_first_use_time(WarnStr),
Template = "Cannot compute the production or consumption time "
++ "of a variable: %s"
),
MessageType =
warning_cannot_compute_cost_of_recursive_calls(WarnStr),
Template = "Cannot compute cost of recursive calls: %s",
string.format(Template, [s(WarnStr)], String)
;
MessageType =
warning_cannot_compute_first_use_time(WarnStr),
Template = "Cannot compute the production or consumption time "
++ "of a variable: %s",
string.format(Template, [s(WarnStr)], String)
;
MessageType = error_extra_proc_dynamics_in_clique_proc,

View File

@@ -3708,6 +3708,7 @@ Options for developers only
--allow-non-contig-for-2025-06-01
--subtype-int2-2025-07-07
--inrange-2025-10-01
--scout-disj-2025-11-15
Is the compiler sufficiently recent to contain the new feature or
bugfix referred to by each name?