Simplify (- (- x)) for rationals
authorPaul Khuong <pvk@pvk.ca>
Wed, 22 May 2013 03:43:03 +0000 (23:43 -0400)
committerPaul Khuong <pvk@pvk.ca>
Wed, 22 May 2013 05:13:22 +0000 (01:13 -0400)
 The transform is trivial enough to execute without a real pattern
 matching framework, but we're close to the limit.

src/compiler/srctran.lisp

index 0d22154..ff0a51c 100644 (file)
   "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.