Open
Description
In the following block, >
gets specialized as single-float->
, but then, single-float->
does not get inlined,
(monomorphize)
(define (test)
(let ((arr (as (array:LispArray Single-Float) (make-list 4f0 3f0 2f0))))
(loops:besttimes (i 3 >) (array:aref arr i))))
However, it does inline when >
is replaced by (fn (x y) (> x y))
.
(monomorphize)
(define (test)
(let ((arr (as (array:LispArray Single-Float) (make-list 4f0 3f0 2f0))))
(loops:besttimes (i 3 (fn (x y) (> x y))) (array:aref arr i))))
besttimes
is defined like this:
(inline)
(declare ...)
(define (%besttimes n better? func)
... (if (better? candidate best) ...) ...)
I understand that this happens because we only inline functions when they are fully applied.
However, %besttimes
is inlined, so constant propagation should allow single-float->
to be inlined as well.
So, the request is for code like this:
(let ((f >))
(f x y))
to simplify to
(> x y)