[m-rev.] diff: disable `--optimize-duplicate-calls'

Simon Taylor stayl at cs.mu.OZ.AU
Mon Feb 17 15:24:56 AEDT 2003


Estimated hours taken: 0.25
Branches: main, release

compiler/options.m:
	Disable `--optimize-duplicate-calls'.
	While inst `array' is defined as `ground', we
	optimizing duplicate calls might combine
	calls to `array.init'.

tests/hard_coded/Mmakefile:
tests/hard_coded/uniq_duplicate_call.{m,exp}:
 	Test case.

Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.404
diff -u -u -r1.404 options.m
--- compiler/options.m	10 Feb 2003 09:39:24 -0000	1.404
+++ compiler/options.m	16 Feb 2003 13:28:23 -0000
@@ -2226,7 +2226,10 @@
 	common_struct		-	bool(yes),
 	user_guided_type_specialization
 				-	bool(yes),
-	optimize_duplicate_calls -	bool(yes),
+	% XXX While inst `array' is defined as `ground', we
+	% can't optimize duplicate calls (we might combine
+	% calls to `array.init').
+	% optimize_duplicate_calls -	bool(yes),
 	simple_neg		-	bool(yes),
 
 	optimize_rl		-	bool(yes),
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.187
diff -u -u -r1.187 Mmakefile
--- tests/hard_coded/Mmakefile	13 Feb 2003 01:36:46 -0000	1.187
+++ tests/hard_coded/Mmakefile	16 Feb 2003 14:20:26 -0000
@@ -158,6 +158,7 @@
 	unify_expression \
 	unify_typeinfo_bug \
 	unify_existq_cons \
+	uniq_duplicate_call \
 	unused_float_box_test \
 	user_compare \
 	user_defined_equality2 \
Index: tests/hard_coded/uniq_duplicate_call.m
===================================================================
RCS file: tests/hard_coded/uniq_duplicate_call.m
diff -N tests/hard_coded/uniq_duplicate_call.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/uniq_duplicate_call.m	16 Feb 2003 14:19:36 -0000
@@ -0,0 +1,25 @@
+:- module uniq_duplicate_call.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+:- import_module array.
+
+main -->
+	{ dup_call(1, 2, Array1, Array2) },
+	io__write_int(array__lookup(Array1, 0)),
+	io__nl,
+	io__write_int(array__lookup(Array2, 0)),
+	io__nl.
+
+:- pred dup_call(T::in, T::in, array(T)::out, array(T)::out) is det.
+
+dup_call(T, T2,
+	array__set(array__init(1, T), 0, T2),
+	array__init(1, T)).
+
Index: tests/hard_coded/uniq_duplicate_call.exp
===================================================================
RCS file: tests/hard_coded/uniq_duplicate_call.exp
diff -N tests/hard_coded/uniq_duplicate_call.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/uniq_duplicate_call.exp	16 Feb 2003 14:21:30 -0000
@@ -0,0 +1,2 @@
+2
+1
--------------------------------------------------------------------------
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