diff: disable duplicate call optimization
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Jun 22 11:05:21 AEST 1998
The following change addresses the bug that I recently reported to
mercury-bugs.
--------------------
compiler/options.m:
Disable duplicate call optimization, because it is buggy.
(Also add a comment about options for internal use only.)
tests/hard_coded/Mmakefile:
tests/hard_coded/dupcall_types_bug.m:
tests/hard_coded/dupcall_types_bug.exp:
Add a regression test for the bug in duplicate call optimization.
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.232
diff -u -r1.232 options.m
--- options.m 1998/06/09 02:14:13 1.232
+++ options.m 1998/06/22 00:55:13
@@ -142,8 +142,13 @@
% `--tags high' and doesn't specify
% `--num-tag-bits'.
; args
+ ; highlevel_c
+ ; unboxed_float
; sync_term_size % in words
; type_layout
+ % Options for internal use only
+ % (the values of these options are implied by the
+ % settings of other options)
% Stack layout information required to do
% a stack trace.
; basic_stack_layout
@@ -160,8 +165,6 @@
% where typeinfos are live for any live data
% the includes that type variable.
; typeinfo_liveness
- ; highlevel_c
- ; unboxed_float
% Code generation options
; low_level_debug
; trad_passes
@@ -1107,7 +1110,14 @@
inline_single_use - bool(yes),
inline_compound_threshold - int(10),
common_struct - bool(yes),
+/****
+% XXX optimize_duplicate_calls is broken --
+% it doesn't take type information into account.
+% See tests/hard_coded/dupcall_types_bug.m.
+% We should re-enable the optimization only
+% when we have fixed that bug.
optimize_duplicate_calls - bool(yes),
+****/
simple_neg - bool(yes)
]).
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.33
diff -u -r1.33 Mmakefile
--- Mmakefile 1998/06/12 07:05:43 1.33
+++ Mmakefile 1998/06/22 00:56:58
@@ -21,6 +21,7 @@
deep_copy_bug \
det_in_semidet_cntxt \
division_test \
+ dupcall_types_bug \
elim_special_pred \
eqv_type_bug \
error_func \
Index: tests/hard_coded/dupcall_types_bug.exp
===================================================================
RCS file: dupcall_types_bug.exp
diff -N dupcall_types_bug.exp
--- /dev/null Mon Jun 22 11:00:50 1998
+++ dupcall_types_bug.exp Mon Jun 22 11:00:31 1998
@@ -0,0 +1 @@
+Syntax error.
Index: tests/hard_coded/dupcall_types_bug.m
===================================================================
RCS file: dupcall_types_bug.m
diff -N dupcall_types_bug.m
--- /dev/null Mon Jun 22 11:00:50 1998
+++ dupcall_types_bug.m Mon Jun 22 10:58:54 1998
@@ -0,0 +1,26 @@
+% This is a regression test for a bug with duplicate call elimination
+% not taking types into account.
+
+:- module dupcall_types_bug.
+:- interface.
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+:- import_module string.
+
+main -->
+ { FileName = "string",
+ String = "1. ",
+ string__length(String, Len),
+ Posn0 = posn(1, 0, 0),
+ read_from_string(FileName, String, Len, Int, Posn0, _),
+ read_from_string(FileName, String, Len, Str, Posn0, _) },
+ ( { Int = ok(I), Str = ok(S) } ->
+ io__write_int(I),
+ io__write_string(S),
+ io__nl
+ ;
+ io__write_string("Syntax error.\n")
+ ).
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list