Tighter floating-point type constraints in some cases
authorLutz Euler <lutz.euler@freenet.de>
Wed, 23 Nov 2011 19:31:09 +0000 (20:31 +0100)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 25 Nov 2011 08:59:37 +0000 (10:59 +0200)
commit0dda5090b6c16a641000b4eb2dcd479f39b784ca
tree5ac44861f95bddf95fa94fa23801fbd93ceb116c
parentaecefb5d1dfdab6b004796c8b0b48fd2ab6643df
Tighter floating-point type constraints in some cases

CONSTRAIN-FLOAT-TYPE used to return a closed bound in some cases where
the corresponding (tighter) open bound would have been derivable,
leading to missed optimisation opportunities. For example the compiler
did not derive that x is not zero in the following call to LOG:

(defun foo (x)
  (declare (type (single-float 0.0) x))
  (when (> x 0.0)
    (log x)))

Fix CONSTRAIN-FLOAT-TYPE so that it returns the tightest possible result
in all cases.

See lp#894498 for details.
src/compiler/constraint.lisp
tests/compiler.pure.lisp