0.8.4.26
[sbcl.git] / src / compiler / ir1opt.lisp
index cb198bd..955f4c8 100644 (file)
@@ -21,6 +21,7 @@
 ;;; Return true for an LVAR whose sole use is a reference to a
 ;;; constant leaf.
 (defun constant-lvar-p (thing)
+  (declare (type (or lvar null) thing))
   (and (lvar-p thing)
        (let ((use (principal-lvar-use thing)))
          (and (ref-p use) (constant-p (ref-leaf use))))))
   (let ((result (return-result node)))
     (collect ((use-union *empty-type* values-type-union))
       (do-uses (use result)
-       (cond ((and (basic-combination-p use)
-                   (eq (basic-combination-kind use) :local))
-              (aver (eq (lambda-tail-set (node-home-lambda use))
-                        (lambda-tail-set (combination-lambda use))))
-              (when (combination-p use)
-                (when (nth-value 1 (maybe-convert-tail-local-call use))
-                  (return-from find-result-type (values)))))
-             (t
-              (use-union (node-derived-type use)))))
+        (let ((use-home (node-home-lambda use)))
+          (cond ((or (eq (functional-kind use-home) :deleted)
+                     (block-delete-p (node-block use))))
+                ((and (basic-combination-p use)
+                      (eq (basic-combination-kind use) :local))
+                 (aver (eq (lambda-tail-set use-home)
+                           (lambda-tail-set (combination-lambda use))))
+                 (when (combination-p use)
+                   (when (nth-value 1 (maybe-convert-tail-local-call use))
+                     (return-from find-result-type (values)))))
+                (t
+                 (use-union (node-derived-type use))))))
       (let ((int
              ;; (values-type-intersection
              ;; (continuation-asserted-type result) ; FIXME -- APD, 2002-01-26
              (use-union)
               ;; )
-            ))
+              ))
        (setf (return-result-type node) int))))
   (values))