Exploit specialised VOPs for EQL of anything/constant fixnum
authorPaul Khuong <pvk@pvk.ca>
Mon, 20 May 2013 22:14:43 +0000 (18:14 -0400)
committerPaul Khuong <pvk@pvk.ca>
Tue, 21 May 2013 02:17:24 +0000 (22:17 -0400)
 By swapping constant arguments to the right ourselves before
 strength reducing EQL into EQ, rather than erroneously using
 commutative-arg-swap.

 Spotted by Douglas Katzman.

src/compiler/srctran.lisp

index d2b2246..0d22154 100644 (file)
         ((and (csubtypep x-type char-type)
               (csubtypep y-type char-type))
          '(char= x y))
-        ((or (fixnum-type-p x-type) (fixnum-type-p y-type))
-         (commutative-arg-swap node))
         ((or (eq-comparable-type-p x-type) (eq-comparable-type-p y-type))
-         '(eq x y))
+         (if (and (constant-lvar-p x) (not (constant-lvar-p y)))
+             '(eq y x)
+             '(eq x y)))
         ((and (not (constant-lvar-p y))
               (or (constant-lvar-p x)
                   (and (csubtypep x-type y-type)