From: Paul Khuong Date: Wed, 22 May 2013 03:43:03 +0000 (-0400) Subject: Simplify (- (- x)) for rationals X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=11dc847696f9c5441c409ce5b7fdf77cf27746c5;p=sbcl.git Simplify (- (- x)) for rationals The transform is trivial enough to execute without a real pattern matching framework, but we're close to the limit. --- diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index 0d22154..ff0a51c 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -3344,6 +3344,11 @@ "convert (* x 0) to 0" 0) +(deftransform %negate ((x) (rational)) + "Eliminate %negate/%negate of rationals" + (splice-fun-args x '%negate 1) + '(the rational x)) + ;;; Return T if in an arithmetic op including lvars X and Y, the ;;; result type is not affected by the type of X. That is, Y is at ;;; least as contagious as X.