From 772658ba2d51c418609b08988ccfa9a14c7f136f Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Fri, 5 Oct 1990 19:50:00 +0000
Subject: [PATCH] Inhibit substitution of let variables whenever the arg
 variable type is not a subtype of the asserted type, not just when the arg
 *value* is nota subtype.  This is necessary to prevent representation
 selection from being defeated.

---
 compiler/ir1opt.lisp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/compiler/ir1opt.lisp b/compiler/ir1opt.lisp
index 3c2282eb7..7c786ae59 100644
--- a/compiler/ir1opt.lisp
+++ b/compiler/ir1opt.lisp
@@ -1057,10 +1057,10 @@
 ;;; variable, and also propagate derived-type information for the arg to all
 ;;; the Var's refs.
 ;;;
-;;;    Substitution is inhibited when the Ref's derived type isn't a subtype of
-;;; the argument's asserted type.  This prevents type checking from being
-;;; defeated, and also ensures that the best representation for the variable
-;;; can be used.
+;;;    Substitution is inhibited when the arg leaf's derived type isn't a
+;;; subtype of the argument's asserted type.  This prevents type checking from
+;;; being defeated, and also ensures that the best representation for the
+;;; variable can be used.
 ;;;
 ;;;    Note that we are responsible for clearing the Continuation-Reoptimize
 ;;; flags.
@@ -1079,7 +1079,7 @@
 		    (let ((leaf (ref-leaf use)))
 		      (when (and (constant-reference-p use)
 				 (values-subtypep
-				  (node-derived-type use)
+				  (leaf-type leaf)
 				  (continuation-asserted-type arg)))
 			(propagate-to-refs var (continuation-type arg))
 			(substitute-leaf leaf var)
-- 
GitLab