From ab705efcc1d020c427e63349275388a972617385 Mon Sep 17 00:00:00 2001 From: Paul Khuong Date: Wed, 22 May 2013 14:12:17 -0400 Subject: [PATCH] Preserve types when swapping constant arguments and commute LOGTEST * Add a transform to ensure any constant argument to LOGTEST is in second position. * Commutative-arg-swap used to often cause suboptimal code: subsequent transforms fire before constraint propagation has tightened types back to their original value. Hack with TRULY-THE for now. A more general fix (e.g. by declaring the type of arguments in spliced-in lambda expressions) would be even better. --- src/compiler/srctran.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index 22d9f48..caed9bf 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -3081,11 +3081,11 @@ (if (and (constant-lvar-p x) (not (constant-lvar-p y))) `(,(lvar-fun-name (basic-combination-fun node)) - y + (truly-the ,(lvar-type y) y) ,(lvar-value x)) (give-up-ir1-transform))) -(dolist (x '(= char= + * logior logand logxor)) +(dolist (x '(= char= + * logior logand logxor logtest)) (%deftransform x '(function * *) #'commutative-arg-swap "place constant arg last")) -- 1.7.10.4