[m-dev.] diff: disable buggy double-negation optimization
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Feb 4 05:52:22 AEDT 2000
Estimated hours taken: 0.75
compiler/simplify.m:
Disable the double-negation elimination optimization,
since it doesn't always preserve mode-correctness.
In particular, if the goal has mode `mdi', then
moving it outside the double-negation can cause
a variable to be clobbered.
Workspace: /home/mercury0/fjh/mercury
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.74
diff -u -d -r1.74 simplify.m
--- simplify.m 1999/10/28 00:57:00 1.74
+++ simplify.m 2000/02/03 16:38:11
@@ -927,7 +927,15 @@
; CondSolns0 = at_most_zero ->
% Optimize away the condition and the `then' part.
det_negation_det(CondDetism0, MaybeNegDetism),
- ( Cond0 = not(NegCond) - _ ->
+ (
+ Cond0 = not(NegCond) - _,
+ % XXX BUG! This optimization is only safe if it
+ % preserves mode correctness, which means in particular
+ % that the the negated goal must not clobber any
+ % variables.
+ % For now I've just disabled the optimization.
+ semidet_fail
+ ->
Cond = NegCond
;
(
@@ -1050,7 +1058,12 @@
Info = Info3
;
% remove double negation
- Goal1 = not(SubGoal - SubGoalInfo) - _
+ Goal1 = not(SubGoal - SubGoalInfo) - _,
+ % XXX BUG! This optimization is only safe if it preserves
+ % mode correctness, which means in particular that the
+ % the negated goal must not clobber any variables.
+ % For now I've just disabled the optimization.
+ semidet_fail
->
simplify__maybe_wrap_goal(GoalInfo0, SubGoalInfo, SubGoal,
Goal, GoalInfo, Info3, Info)
--
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.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list