[m-rev.] post-commit diff: fix bug in dupelim.m
Peter Wang
wangp at students.cs.mu.OZ.AU
Thu May 4 18:45:19 AEST 2006
Discussed with Zoltan in person. It's possibly not a 100% fix
but committed it for now.
Estimated hours taken: 1.5
Branches: main, release
Fix a compiler abort when `--optimise-dups' detects some duplicate code
sequences in parallel conjunctions.
compiler/dupelim.m:
Allow `most_specific_instr' to generalise two `fork',
`init_sync_term', `join_and_continue' or `join_and_terminate'
instructions if they take exactly the same arguments.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/par_dupelim.m:
Add a test case.
Index: compiler/dupelim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dupelim.m,v
retrieving revision 1.78
diff -u -r1.78 dupelim.m
--- compiler/dupelim.m 26 Apr 2006 03:05:33 -0000 1.78
+++ compiler/dupelim.m 28 Apr 2006 08:25:41 -0000
@@ -756,6 +756,10 @@
; Instr1 = decr_sp(_)
; Instr1 = decr_sp_and_return(_)
; Instr1 = pragma_c(_, _, _, _, _, _, _, _, _)
+ ; Instr1 = fork(_, _, _)
+ ; Instr1 = init_sync_term(_, _)
+ ; Instr1 = join_and_continue(_, _)
+ ; Instr1 = join_and_terminate(_)
),
( Instr1 = Instr2 ->
MaybeInstr = yes(Instr1)
@@ -763,12 +767,7 @@
MaybeInstr = no
)
;
- ( Instr1 = comment(_)
- ; Instr1 = fork(_, _, _)
- ; Instr1 = init_sync_term(_, _)
- ; Instr1 = join_and_continue(_, _)
- ; Instr1 = join_and_terminate(_)
- ),
+ Instr1 = comment(_),
MaybeInstr = no
).
Index: tests/valid/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mercury.options,v
retrieving revision 1.31
diff -u -r1.31 Mercury.options
--- tests/valid/Mercury.options 28 Apr 2006 04:13:23 -0000 1.31
+++ tests/valid/Mercury.options 4 May 2006 04:10:13 -0000
@@ -93,6 +93,7 @@
MCFLAGS-mostly_uniq_mode_inf = --infer-all
MCFLAGS-mpj6 = --infer-all
MCFLAGS-no_warn_obsolete = --no-warn-obsolete
+MCFLAGS-par_dupelim = --optimize-dups
MCFLAGS-par_saved_const = -O3 --optimize-saved-vars-const
MCFLAGS-pred_with_no_modes = --infer-all
MCFLAGS-quantifier_warning = --halt-at-warn
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.173
diff -u -r1.173 Mmakefile
--- tests/valid/Mmakefile 20 Apr 2006 03:57:21 -0000 1.173
+++ tests/valid/Mmakefile 4 May 2006 04:06:16 -0000
@@ -228,7 +228,8 @@
# These tests only work in grades that support parallel conjunction.
#
PAR_CONJ_PROGS = \
- par_dummy
+ par_dummy \
+ par_dupelim
# The following programs require that num_tag_bits >= 1
RESERVE_TAG_PROGS = \
Index: tests/valid/par_dupelim.m
===================================================================
RCS file: tests/valid/par_dupelim.m
diff -N tests/valid/par_dupelim.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/valid/par_dupelim.m 4 May 2006 04:05:03 -0000
@@ -0,0 +1,25 @@
+% Uncaught Mercury exception:
+% Software Error: dupelim.m: Unexpected: blocks with same standard
+% form don't antiunify
+
+:- module par_dupelim.
+:- interface.
+
+:- type t ---> t1 ; t2.
+:- pred p(t::in, int::out) is det.
+
+:- implementation.
+
+p(T, X) :-
+ (
+ T = t1,
+ ( X = 1
+ & true
+ % This conjunct is the same as a later conjunct.
+ )
+ ;
+ T = t2,
+ ( X = 2
+ & true
+ )
+ ).
--------------------------------------------------------------------------
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