[m-rev.] for review: disable invariant hoisting with promise_impure

Julien Fischer juliensf at cs.mu.OZ.AU
Tue Aug 23 16:12:09 AEST 2005


For review by Ralph.

Estimated hours taken: 0.5
Branches: main

compiler/loop_inv.m:
	Don't try to hoist invariants inside promise_impure scopes.

Julien.

Index: compiler/loop_inv.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/loop_inv.m,v
retrieving revision 1.21
diff -u -r1.21 loop_inv.m
--- compiler/loop_inv.m	22 Jul 2005 12:31:56 -0000	1.21
+++ compiler/loop_inv.m	23 Aug 2005 06:08:07 -0000
@@ -383,8 +383,16 @@
     invariant_goal_candidates_keeping_path_candidates(PPId, NegatedGoal, IGCs).

 invariant_goal_candidates_2(PPId,
-        scope(_, QuantifiedGoal)                     - _GoalInfo, IGCs) =
-    invariant_goal_candidates_2(PPId, QuantifiedGoal, IGCs).
+        scope(Reason, QuantifiedGoal)                     - _GoalInfo, IGCs) =
+    %
+    % Atomic goals inside a promise_impure scope should not be candidates
+    % for invariant hoisting.
+    %
+    ( Reason \= promise_purity(_, (impure)) ->
+        invariant_goal_candidates_2(PPId, QuantifiedGoal, IGCs)
+    ;
+        IGCs
+    ).

 invariant_goal_candidates_2(PPId,
         if_then_else(_XVs, Cond, Then, Else)         - GoalInfo,  IGCs0)

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list