[m-rev.] for post-commit review: fix sanity check in string trie switches

Peter Wang novalazy at gmail.com
Fri Dec 9 10:37:49 AEDT 2022


On Thu, 08 Dec 2022 19:15:32 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> For review by anyone.
> 
> Zoltan.

> Fix a bug in string trie jump switches.
> 
> compiler/ml_string_switch.m:
>     Fix a too-strong sanity check. It insisted on a semidet switch
>     containing code to handle the failure of the switch, but a switch
>     on strings can be both semidet and cannot_fail if
>     
>     - the switched-on variable's inst is known to contain only the strings
>       handled by the arms of the switch, and
> 
>     - one or more of the switch arms containing semidet code.
> 

(s/containing/contains)

>     In that case, the switch does not need a default case, since it would be
>     unreachable.
> 
> compiler/options.m:
>     Provide a way to test for the presence of this fix.

That's fine, though.

Peter


More information about the reviews mailing list