From aa6afdf2ce50a0111a4b22e5a5cb85f90c98acc0 Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Fri, 13 Nov 1998 04:49:41 +0000
Subject: [PATCH] Cleanup of the transform folding (+ x 0) to 0.

---
 compiler/srctran.lisp | 42 ++++++++++++++----------------------------
 1 file changed, 14 insertions(+), 28 deletions(-)

diff --git a/compiler/srctran.lisp b/compiler/srctran.lisp
index 20b3d6225..785aabb53 100644
--- a/compiler/srctran.lisp
+++ b/compiler/srctran.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.89 1998/11/02 13:44:34 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.90 1998/11/13 04:49:41 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -2981,19 +2981,30 @@
       "fold identity operations"
       result)))
 
-;;; These are restricted to rationals, because (- 0 0.0) is 0.0, not -0.0, and
-;;; (* 0 -4.0) is -0.0.
+;;; Restricted to rationals, because (- 0 0.0) is 0.0, not -0.0.
 ;;;
 (deftransform - ((x y) ((constant-argument (member 0)) rational) *
 		 :when :both)
   "convert (- 0 x) to negate"
   '(%negate y))
+
+;;; Restricted to rationals, because (* 0 -4.0) is -0.0.
 ;;;
 (deftransform * ((x y) (rational (constant-argument (member 0))) *
 		 :when :both)
   "convert (* x 0) to 0."
   0)
 
+;;; Fold (+ x 0).
+;;;
+;;; Restricted to rationals, because (+ -0.0 0) is 0.0, not -0.0.
+;;;
+(deftransform + ((x y) (rational (constant-argument (member 0))) *
+		 :when :both)
+  "fold zero arg"
+  'x)
+
+
 ;;; Not-More-Contagious  --  Interface
 ;;;
 ;;;    Return T if in an arithmetic OP including continuations X and
@@ -3041,31 +3052,6 @@
 		(t
 		 (error "Unexpected types: ~s ~s~%" type1 type2)))))))
 
-;;; Fold (+ x 0).
-;;;
-;;;    If y is not constant, not zerop, or is contagious, or a positive
-;;; float +0.0 then give up because (+ -0.0 0.0) is 0.0 not -0.0.
-;;;
-#+nil
-(deftransform + ((x y) (t (constant-argument t)) * :when :both)
-  "fold zero arg"
-  (let ((val (continuation-value y)))
-    (unless (and (zerop val)
-		 (not (and (floatp val) (plusp (float-sign val))))
-		 (not-more-contagious y x))
-      (give-up)))
-  'x)
-
-;;; Fold (+ x 0).
-;;;
-;;; Restricted to rationals, because (+ -0.0 0) is 0.0, not -0.0.
-;;;
-(deftransform + ((x y) (rational (constant-argument (member 0))) *
-		 :when :both)
-  "fold zero arg"
-  'x)
-
-
 ;;; Fold (- x 0).
 ;;;
 ;;;    If y is not constant, not zerop, or is contagious, or a negative
-- 
GitLab