- ;; The documentation on TAIL-SET-INFO doesn't tell whether it
- ;; remains valid in this case, so we nuke it on the theory that
- ;; missing information is less dangerous than incorrect information.
- (setf (tail-set-info (lambda-tail-set fun)) nil)
+ ;; The documentation on TAIL-SET-INFO doesn't tell whether it could
+ ;; remain valid in this case, so we nuke it on the theory that
+ ;; missing information tends to be less dangerous than incorrect
+ ;; information.
+ (setf (tail-set-info (lambda-tail-set fun)) nil))
+
+;;; Handle the environment semantics of LET conversion. We add the
+;;; lambda and its LETs to LETs for the CALL's home function. We merge
+;;; the calls for FUN with the calls for the home function, removing
+;;; FUN in the process. We also merge the ENTRIES.
+;;;
+;;; We also unlink the function head from the component head and set
+;;; COMPONENT-REANALYZE to true to indicate that the DFO should be
+;;; recomputed.
+(defun merge-lets (fun call)
+
+ (declare (type clambda fun) (type basic-combination call))
+
+ (let ((component (block-component (node-block call))))
+ (unlink-blocks (component-head component) (node-block (lambda-bind fun)))
+ (setf (component-lambdas component)
+ (delete fun (component-lambdas component)))
+ (setf (component-reanalyze component) t))
+ (setf (lambda-call-lexenv fun) (node-lexenv call))
+
+ (depart-from-tail-set fun)