[m-rev.] diff: Delete unused imports.
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed Mar 30 10:01:12 AEDT 2022
On Wed, 30 Mar 2022 06:07:17 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> Indeed there was. The attached diff, which I am asking you to review,
> fixes two of them. I haven't had time yet to test whether it fixes the issue
> you reported, or whether that is a separate bug. Though it could also be
> a known limitation rather than a bug, for anyone who cares about
> the distinction :-)
Actually, the reason why the import of vartypes was flagged as unused
with --intermod-opt was a known limitation that we discussed in october:
the absence of a record of which modules expanded type equivalences
came from. Here is the diff from the HLDS dump of the generate_generic_call predicate
in call_gen.m without and with --intermod-opt:
--- NO_IMO 2022-03-30 09:34:24.727602291 +1100
+++ IMO 2022-03-30 09:35:34.267873128 +1100
@@ -33,7 +33,7 @@
% OutputArg_34 (number 34): term.var(parse_tree.prog_data.prog_var_type)
% ModuleInfo_35 (number 35): hlds.hlds_module.module_info
% ProcInfo_36 (number 36): hlds.hlds_pred.proc_info
-% VarTypes_37 (number 37): hlds.vartypes.vartypes
+% VarTypes_37 (number 37): tree234.tree234(term.var(parse_tree.prog_data.prog_var_type), parse_tree.prog_data.mer_type)
% Rval_38 (number 38): backend_libs.builtin_ops.simple_expr(term.var(parse_tree.prog_data.prog_var_type))
% STATE_VARIABLE_CI_0_39 (number 39): ll_backend.code_info.code_info
% STATE_VARIABLE_CI_40 (number 40): ll_backend.code_info.code_info
It just so happened that the type of the VarTypes variable was the
only reference to the vartypes module in call_gen.m. With intermodule optimization,
the compiler read in hlds.vartypes.opt, found the definition of the
"vartypes" type, which is an equivalence, expanded it, and then
promptly forgot that it expanded it :-(
That discussion on oct 8 was about a description of the problem I added
as a comment on an import in hlds_out_module.m, which exhibits
the same problem. Would people be ok with me fixing this problem
using the first approach outlined in that comment? The discussion
ended in october without a decision on that.
Zoltan.
More information about the reviews
mailing list