[m-rev.] For review: Loop invariant hoisting optimization

Simon Taylor stayl at cs.mu.OZ.AU
Fri Jul 26 16:14:23 AEST 2002


On 26-Jun-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Estimated hours taken: 900
> Branches: main
> 
> Added loop-invariant hoisting optimization.

+:- func list(T) `difference` list(T) = list(T).
+
+Xs `difference` Ys = list__filter(NotInYs, Xs) :-
+    NotInYs = ( pred(X::in) is semidet :- not list__member(X, Ys) ).

Use list__delete_elems.

+invariant_goal_candidates_handle_non_recursive_call(
+        Goal @ (_GoalExpr - GoalInfo), IGCs) =
+    ( if   not model_non(GoalInfo),
+           not ( goal_info_has_feature(GoalInfo, (impure) )
+               ; goal_info_has_feature(GoalInfo, (semipure) )
+               )

Use purity__goal_info_is_pure.

+:- pred dh(module_info, hlds_goal,
+            hlds_goals, hlds_goals, prog_vars, prog_vars).
+:- mode dh(in, in, in, out, in, out) is det.

Unabbreviate the predicate name.

+impure_goal(_GoalExpr - GoalInfo) :-
+    hlds_goal__goal_info_get_features(GoalInfo, Features),
+    (
+        Features `contains` (impure)
+    ;
+        Features `contains` (semipure)
+    ).

Use purity__goal_info_is_impure.

+    % We take an initial inst to be an input if it is fully ground
+    % and not unique.
+    %
+:- pred inst_is_input(inst_info, inst).
+:- mode inst_is_input(in, in) is semidet.
+
+inst_is_input({ModuleInfo, _InstMap}, Inst) :-
+    inst_match__inst_is_ground(ModuleInfo, Inst).

The code here doesn't match the documentation.
You need to call inst_match__inst_is_not_partly_unique
to check uniqueness.

To be continued.

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