convert-call-if-possible: inline maybe-inline functions from different components.

This commit is contained in:
Stas Boukarev 2023-07-29 22:24:36 +03:00
parent 137b4f664b
commit 81257e29e4
2 changed files with 19 additions and 1 deletions

View file

@ -510,7 +510,13 @@
original-fun))
(*compiler-error-context* call))
(when (and (eq (functional-inlinep fun) 'inline)
(when (and (or (eq (functional-inlinep fun) 'inline)
(and (and (neq (component-kind component) :initial)
(neq (node-component (lambda-bind (main-entry fun))) component))
;; If it's in a different component then inline it anyway,
;; othrewise it won't get any benefits of maybe-inline.
(eq (functional-inlinep fun) 'maybe-inline)))
(rest (leaf-refs original-fun))
;; Some REFs are already unused bot not yet deleted,
;; avoid unnecessary inlining

View file

@ -198,3 +198,15 @@
(funcall x 10)))
(defun component-xep-references.2 ()
(component-xep-references-i 1)))
(declaim (maybe-inline component-xep-references-mi))
(defun component-xep-references-mi (x)
x)
(let ((x 0))
(declare (optimize speed (space 0)))
(defun component-xep-references.3 ()
(incf x)
(let ((x #'component-xep-references-mi))
(funcall x 10)))
(defun component-xep-references.4 ()
(component-xep-references-mi 1)))