[m-rev.] diff: take into account pre-death sets in LFU analysis

Peter Wang novalazy at gmail.com
Tue Jan 15 11:02:04 AEDT 2008


Branches: main

compiler/structure_reuse.lfu.m:
	Take into account pre-death sets when calculating LFU (local forward
	use) information.  Previously, if a variable died in one branch of a
	goal but was alive in another branch of the same goal then in the
	former branch the variable wouldn't be noticed to be dead.

Index: compiler/structure_reuse.lfu.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_reuse.lfu.m,v
retrieving revision 1.8
diff -u -r1.8 structure_reuse.lfu.m
--- compiler/structure_reuse.lfu.m	30 Dec 2007 08:23:58 -0000	1.8
+++ compiler/structure_reuse.lfu.m	14 Jan 2008 23:55:24 -0000
@@ -66,10 +66,8 @@
     set(prog_var)::in, set(prog_var)::out) is det.
 
 forward_use_in_goal(VarTypes, !Goal, !InstantiatedVars, !DeadVars) :-
-    (
-        !.Goal = hlds_goal(GoalExpr0, GoalInfo0),
-        goal_is_atomic(GoalExpr0)
-    ->
+    !.Goal = hlds_goal(GoalExpr0, GoalInfo0),
+    ( goal_is_atomic(GoalExpr0) ->
         InstantiatedVars0 = !.InstantiatedVars,
         compute_instantiated_and_dead_vars(VarTypes, GoalInfo0,
             !InstantiatedVars, !DeadVars),
@@ -77,6 +75,8 @@
         goal_info_set_lfu(LFU, GoalInfo0, GoalInfo),
         !:Goal = hlds_goal(GoalExpr0, GoalInfo)
     ;
+        goal_info_get_pre_deaths(GoalInfo0, PreDeaths),
+        set.union(PreDeaths, !DeadVars),
         forward_use_in_composite_goal(VarTypes, !Goal,
             !InstantiatedVars, !DeadVars)
     ).

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