[m-rev.] diff: fix intermodule opt bug
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu Sep 28 18:47:29 AEST 2006
I don't have a separate test case for this one as the bug is fairly sensitive
to a number of inlining parameters and extracting one from the standard
library (which was where it showed up) would be quite time consuming. I have
an upcoming change to the io module that won't compile without this diff, so
that will have to suffice.
Estimated hours taken: 3
Branches: main, release
Fix a bug with intermodule optimization and termination analysis. The problem
was that not all of the termination_info pragmas for all of the opt_exported
procedures were being written to the .opt file. In some cases where the
procedure was defined by a foreign clause, this lead to the termination
foreign code attributes conflicting with the analyser's default assumptions
about procedures without termination_info pragmas.
This diff fixes the bug in one direction: making sure that we always adjust
the import status of items written to .opt files. This is sufficient to get
the termination analyser to write out the missing termination_info pragmas.
(Previously we used to only do this if intermodule unused argument analysis
was enabled for some reason.)
I'm working on a separate fix in the other direction, i.e. making the
termination analyser a bit more robust with respect to missing information -
I'll post that as a separate diff. (In any case this change is useful in it's
own right - it should improve accuracy).
compiler/intermod.m:
Always adjust the import status of items written to .opt files.
Julien.
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.208
diff -u -r1.208 intermod.m
--- compiler/intermod.m 7 Sep 2006 05:50:55 -0000 1.208
+++ compiler/intermod.m 28 Sep 2006 08:20:08 -0000
@@ -164,7 +164,6 @@
globals.io_lookup_bool_option(deforestation, Deforestation, !IO),
globals.io_lookup_int_option(higher_order_size_limit,
HigherOrderSizeLimit, !IO),
- globals.io_lookup_bool_option(intermod_unused_args, UnusedArgs, !IO),
some [!IntermodInfo] (
init_intermod_info(!.ModuleInfo, !:IntermodInfo),
gather_preds(PredIds, yes, Threshold, HigherOrderSizeLimit,
@@ -175,12 +174,7 @@
intermod_info_get_module_info(!.IntermodInfo, !:ModuleInfo),
io.set_output_stream(OutputStream, _, !IO),
io.close_output(FileStream, !IO),
- (
- UnusedArgs = yes,
- do_adjust_pred_import_status(!.IntermodInfo, !ModuleInfo)
- ;
- UnusedArgs = no
- )
+ do_adjust_pred_import_status(!.IntermodInfo, !ModuleInfo)
)
),
%
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list