The recent changes to handling of boxed constants indvertently cause them to
be duplicated when there was not immediate representation at all, and both an
unboxed and a boxed representaion would have been desirable.
;; However, in the case of USE-IMMED-P we can have the same TN for both
;; uses. The first two legs here take care of that by cross-pollinating the
;; cached values.
- ((and use-immed-p boxedp (leaf-info constant)))
- ((and use-immed-p (not boxedp) (constant-boxed-tn constant)))
+ ;;
+ ;; Similarly, when there is no immediate SC.
+ ((and (or use-immed-p (not immed)) boxedp (leaf-info constant)))
+ ((and (or use-immed-p (not immed)) (not boxedp) (constant-boxed-tn constant)))
(t
(let* ((component (component-info *component-being-compiled*))
(sc (svref *backend-sc-numbers*
(unknown-fun 1.0d0 (+ 1.0d0 x))))))
(assert (equal '(1.0d0) (ctu:find-code-constants fun :type 'double-float)))))
+(with-test (:name :only-one-boxed-constant-for-multiple-uses)
+ (let* ((big (1+ most-positive-fixnum))
+ (fun (compile nil
+ `(lambda (x)
+ (unknown-fun ,big (+ ,big x))))))
+ (assert (equal (list 0 (1+ most-positive-fixnum))
+ (ctu:find-code-constants fun :type t)))))
+
(with-test (:name :fixnum+float-coerces-fixnum
:skipped-on :x86)
(let ((fun (compile nil