[m-rev.] for review: liveness assertion failure with CTGC

Peter Wang novalazy at gmail.com
Thu Jan 31 10:57:35 AEDT 2008


On 2008-01-30, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
>  On Wed, 30 Jan 2008, Julien Fischer wrote:
> >
> > Rather than duplicating part of the functionality of simplify in the
> > liveness analysis, why not just add an extra invocation of simplify
> > before structure_reuse?  (this extra pass could be made
> > conditional on --structure-reuse, or whaever the appropriate options
> > are.)
> > IMO, there is a small maintainability issue here.  It will more
> > conrusing if tow separate parts  of the compiler are reponsible
> 
>  That should say: confusing if two ...

Ok, that's probably a better idea.


Estimated hours taken: 1
Branches: main

Avoid assertion failures in the liveness detection pass which is called as
part of computing in-use information for structure reuse.  The problem occurs
for procedures containing an if-then-else goal with an `erroneous' condition.
As written, liveness.m expects such goals to have been simplified beforehand.
This is not the case when structure reuse is enabled, as the structure reuse
analysis is run before simplification.

compiler/structure_sharing.analysis.m:
	Fix the problem by simplifying procedures before liveness detection.

--- compiler/structure_sharing.analysis.m	21 Jan 2008 05:23:32 -0000	1.26
+++ compiler/structure_sharing.analysis.m	30 Jan 2008 23:45:03 -0000
@@ -41,6 +41,7 @@
 
 :- implementation.
 
+:- import_module check_hlds.simplify.
 :- import_module hlds.hlds_goal.
 :- import_module hlds.passes_aux.
 :- import_module libs.compiler_util.
@@ -183,9 +184,24 @@
     io::uo) is det.
 
 annotate_liveness(!ModuleInfo, !IO) :-
-    process_all_nonimported_procs(update_proc_io(detect_liveness_proc),
+    process_all_nonimported_procs(
+        update_module_io(simplify_and_detect_liveness_proc),
         !ModuleInfo, !IO).
 
+:- pred simplify_and_detect_liveness_proc(pred_id::in, proc_id::in,
+    proc_info::in, proc_info::out, module_info::in, module_info::out, 
+    io::di, io::uo) is det.
+
+simplify_and_detect_liveness_proc(PredId, ProcId, !ProcInfo, !ModuleInfo,
+        !IO) :-
+    % Liveness annotation expects the procedure to have been simplified.  For
+    % example, an if-then-else with an `erroneous' condition will cause an
+    % assertion failure if it is not simplified away. 
+    Simplifications = list_to_simplifications([]),
+    simplify_proc(Simplifications, PredId, ProcId, !ModuleInfo, !ProcInfo,
+        !IO),
+    detect_liveness_proc(PredId, ProcId, !.ModuleInfo, !ProcInfo, !IO).
+
 %-----------------------------------------------------------------------------%
 
 :- pred sharing_analysis(module_info::in, module_info::out,

--------------------------------------------------------------------------
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