[m-rev.] diff: fix bug with intermodule analysis and unused args opt

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jul 18 16:58:42 AEST 2006


On Tue, 18 Jul 2006, Julien Fischer wrote:

>
> On Tue, 18 Jul 2006, Peter Wang wrote:
>
>> On 2006-07-18, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>> 
>>> Estimated hours taken: 1
>>> Branches: main, release
>>> 
>>> Fix a bug with --intermodule-analysis and unused-argument optimization.
>>> 
>>> compiler/unused_args.m:
>>> 	Don't initially record sub-optimal answers for compiler generated
>>> 	unification and comparison predicates to the analysis registry.
>> 
>> Thanks.  A similar thing happens with trail usage analysis,
>
> That's a little odd - I'll take a look at it.
>

Here's a fix for that.  The restrictions on answers for predicates produced by
type-specialization could probably be removed (I think they stem from
limitations with --intermodule-optimization that no longer apply here), but
for now I've just made the analysis consistent w.r.t to the requests it makes
and the answers it provides.

Estimated hours taken: 0.5
Branches: main, release

Fix a bug with --intermodule-analysis and trail usage optimization.

compiler/trailing_analysis.m:
 	Don't make requests for answers that cannot (currently) be provided by
 	trail usage analysis.

Index: compiler/trailing_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trailing_analysis.m,v
retrieving revision 1.15
diff -u -r1.15 trailing_analysis.m
--- compiler/trailing_analysis.m	13 Jun 2006 04:16:15 -0000	1.15
+++ compiler/trailing_analysis.m	18 Jul 2006 06:09:50 -0000
@@ -1152,8 +1152,8 @@
  trailing_status_to_string(conditional, "conditional").

  :- pred search_analysis_status(pred_proc_id::in,
-        trailing_status::out, analysis_status::out, scc::in,
-        module_info::in, module_info::out, io::di, io::uo) is det.
+    trailing_status::out, analysis_status::out, scc::in,
+    module_info::in, module_info::out, io::di, io::uo) is det.

  search_analysis_status(PPId, Result, AnalysisStatus, CallerSCC,
          !ModuleInfo, !IO) :-
@@ -1163,8 +1163,8 @@
      module_info_set_analysis_info(AnalysisInfo, !ModuleInfo).

  :- pred search_analysis_status_2(module_info::in, pred_proc_id::in,
-        trailing_status::out, analysis_status::out, scc::in,
-        analysis_info::in, analysis_info::out, io::di, io::uo) is det.
+    trailing_status::out, analysis_status::out, scc::in,
+    analysis_info::in, analysis_info::out, io::di, io::uo) is det.

  search_analysis_status_2(ModuleInfo, PPId, Result, AnalysisStatus, CallerSCC,
          !AnalysisInfo, !IO) :-
@@ -1196,12 +1196,21 @@
              AnalysisStatus = suboptimal,
              (
                  MakeAnalysisRegistry = yes,
-                analysis.record_result(ModuleId, FuncId,
-                    Call, Answer, AnalysisStatus, !AnalysisInfo),
-                analysis.record_request(analysis_name, ModuleId, FuncId, Call,
-                    !AnalysisInfo),
-                record_dependencies(ModuleId, FuncId, Call,
-                    ModuleInfo, CallerSCC, !AnalysisInfo)
+                PPId = proc(PredId, _),
+                module_info_pred_info(ModuleInfo, PredId, PredInfo),
+                should_write_trailing_info(ModuleInfo, PredId, PredInfo,
+                    ShouldWrite),
+                (
+                    ShouldWrite = yes,
+                    analysis.record_result(ModuleId, FuncId,
+                        Call, Answer, AnalysisStatus, !AnalysisInfo),
+                    analysis.record_request(analysis_name, ModuleId, FuncId,
+                        Call, !AnalysisInfo),
+                    record_dependencies(ModuleId, FuncId, Call,
+                        ModuleInfo, CallerSCC, !AnalysisInfo)
+                ;
+                    ShouldWrite = no
+                )
              ;
                  MakeAnalysisRegistry = no
              )
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at csse.unimelb.edu.au
administrative address: owner-mercury-reviews at csse.unimelb.edu.au
unsubscribe: Address: mercury-reviews-request at csse.unimelb.edu.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at csse.unimelb.edu.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list