[m-rev.] for review: loop hoist const goals
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Feb 10 05:10:24 AEDT 2004
Estimated hours taken: 1
Branches: main
Enable loop invariant hoisting for goals that have no input arguments.
compiler/loop_inv.m:
Delete the code which was explicitly disabling loop invariant
hoisting for "const goals", i.e. goals that have no input arguments.
(Why was this code there in the first place?)
tests/hard_coded/Mmakefile:
Enable loop_inv_test1, since we now pass it.
tests/hard_coded/loop_inv_test1.exp:
New file, containing the expected output for this test.
tests/hard_coded/loop_inv_test1.m:
Delete the comment which said that we don't pass this test.
Workspace: /home/jupiter/fjh/ws-jupiter/mercury
Index: compiler/loop_inv.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/loop_inv.m,v
retrieving revision 1.6
diff -u -d -r1.6 loop_inv.m
--- compiler/loop_inv.m 31 Oct 2003 03:27:24 -0000 1.6
+++ compiler/loop_inv.m 9 Feb 2004 06:18:18 -0000
@@ -601,7 +601,6 @@
( if
( const_construction(Goal)
; deconstruction(Goal)
- ; const_goal(MI, Goal)
; impure_goal(Goal)
)
then
@@ -634,16 +633,6 @@
deconstruction(GoalExpr - _GoalInfo) :-
GoalExpr ^ unify_kind = deconstruct(_, _, _, _, _, _).
-
-%------------------------------------------------------------------------------%
-
- % A const goal has no inputs.
- %
-:- pred const_goal(module_info, hlds_goal).
-:- mode const_goal(in, in) is semidet.
-
-const_goal(ModuleInfo, Goal) :-
- goal_inputs(ModuleInfo, Goal) = [].
%------------------------------------------------------------------------------%
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.221
diff -u -d -r1.221 Mmakefile
--- tests/hard_coded/Mmakefile 9 Feb 2004 08:32:58 -0000 1.221
+++ tests/hard_coded/Mmakefile 9 Feb 2004 08:33:59 -0000
@@ -101,6 +101,7 @@
intermod_type_qual \
join_list \
loop_inv_test \
+ loop_inv_test1 \
mapped_module \
merge_and_remove_dups \
minint_bug \
@@ -294,7 +295,7 @@
# floats in Mercury aren't consistent -- see the comments at the
# top of library/float.m.
#
-# XXX loop_inv_test0, loop_inv_test1, loop_inv_test2:
+# XXX loop_inv_test0, loop_inv_test2:
# These test cases test some more sophisticated cases of loop invariant
# optimization which are current loop_inv pass is not capable of
# optimizing.
Index: tests/hard_coded/loop_inv_test1.exp
===================================================================
RCS file: tests/hard_coded/loop_inv_test1.exp
diff -N tests/hard_coded/loop_inv_test1.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/loop_inv_test1.exp 9 Feb 2004 08:38:40 -0000
@@ -0,0 +1,3 @@
+enter two integers, one on each line
+R1 = 4233
+R2 = 5333
Index: tests/hard_coded/loop_inv_test1.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/loop_inv_test1.m,v
retrieving revision 1.2
diff -u -d -r1.2 loop_inv_test1.m
--- tests/hard_coded/loop_inv_test1.m 9 Feb 2004 08:32:59 -0000 1.2
+++ tests/hard_coded/loop_inv_test1.m 9 Feb 2004 08:38:15 -0000
@@ -11,11 +11,6 @@
% This test checks that we do loop invariant hoisting for
% invariant goals which have no input arguments.
-% XXX We do not yet pass this test case, because the loop invariant
-% pass has some code which explicitly disables the optimization
-% if there are no input arguments. (Why???)
-% This should be very easy to fix.
-
:- module loop_inv_test1.
:- interface.
:- import_module io.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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