X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fir1opt.lisp;h=34117f5c42ed44b92fcd1fe53eaca96d93bf787a;hb=e67cc0f952040723f7d0f37ddb88fe895f4b1464;hp=731ccbfe62b47243d638ac1d8d90a01ad8d93745;hpb=0ae8180db142282924d16e1b7d1c54c72ed0d23c;p=sbcl.git diff --git a/src/compiler/ir1opt.lisp b/src/compiler/ir1opt.lisp index 731ccbf..34117f5 100644 --- a/src/compiler/ir1opt.lisp +++ b/src/compiler/ir1opt.lisp @@ -1210,33 +1210,42 @@ (when (and (numeric-type-p initial-type) (numeric-type-p step-type) (numeric-type-equal initial-type step-type)) - (multiple-value-bind (low high) - (cond ((csubtypep step-type (specifier-type '(real 0 *))) - (values (numeric-type-low initial-type) - (when (and (numeric-type-p set-type) - (numeric-type-equal set-type initial-type)) - (flet ((max* (i j) - (cond ((eq i nil) nil) - ((eq j nil) nil) - (t (max i j))))) + (labels ((leftmost (x y cmp cmp=) + (cond ((eq x nil) nil) + ((eq y nil) nil) + ((listp x) + (let ((x1 (first x))) + (cond ((listp y) + (let ((y1 (first y))) + (if (funcall cmp x1 y1) x y))) + (t + (if (funcall cmp x1 y) x y))))) + ((listp y) + (let ((y1 (first y))) + (if (funcall cmp= x y1) x y))) + (t (if (funcall cmp x y) x y)))) + (max* (x y) (leftmost x y #'> #'>=)) + (min* (x y) (leftmost x y #'< #'<=))) + (declare (inline compare)) + (multiple-value-bind (low high) + (cond ((csubtypep step-type (specifier-type '(real 0 *))) + (values (numeric-type-low initial-type) + (when (and (numeric-type-p set-type) + (numeric-type-equal set-type initial-type)) (max* (numeric-type-high initial-type) - (numeric-type-high set-type)))))) - ((csubtypep step-type (specifier-type '(real * 0))) - (values (when (and (numeric-type-p set-type) - (numeric-type-equal set-type initial-type)) - (flet ((min* (i j) - (cond ((eq i nil) nil) - ((eq j nil) nil) - (t (min i j))))) - (min* (numeric-type-low initial-type) - (numeric-type-low set-type)))) - (numeric-type-high initial-type))) - (t - (values nil nil))) - (modified-numeric-type initial-type - :low low - :high high - :enumerable nil))))) + (numeric-type-high set-type))))) + ((csubtypep step-type (specifier-type '(real * 0))) + (values (when (and (numeric-type-p set-type) + (numeric-type-equal set-type initial-type)) + (min* (numeric-type-low initial-type) + (numeric-type-low set-type))) + (numeric-type-high initial-type))) + (t + (values nil nil))) + (modified-numeric-type initial-type + :low low + :high high + :enumerable nil)))))) (deftransform + ((x y) * * :result result) "check for iteration variable reoptimization" (let ((dest (principal-lvar-end result))