From 3c1c53110cb8786dec6fd57b9784b684a520a0b5 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Sat, 21 Apr 1990 20:35:10 +0000
Subject: [PATCH] Fixed SPILL-AND-PACK-LOAD-TN to recognize uses of load TNs
 now that they are in the TN-REF-LOAD-TN. Changed EMIT-SAVES to run before
 PACK-LOAD-TNs.  This should have no effect on semantics, but lets the saved
 registers be used for load TNs without having to spill them again.  Probably
 not a real efficiency issue, but saving the same register twice looks silly.

---
 compiler/pack.lisp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/compiler/pack.lisp b/compiler/pack.lisp
index 6e449b14e..2c69765dd 100644
--- a/compiler/pack.lisp
+++ b/compiler/pack.lisp
@@ -819,8 +819,12 @@
 	      (let ((op (tn-ref-tn ref)))
 		(when (and (eq (sc-sb (tn-sc op)) sb)
 			   (eql (tn-offset op) loc))
+		  (return nil)))
+	      (let ((ltn (tn-ref-load-tn ref)))
+		(when (and ltn
+			   (eq (sc-sb (tn-sc ltn)) sb)
+			   (eql (tn-offset ltn) loc))
 		  (return nil))))
-	
 	(let ((victim (svref (finite-sb-live-tns sb) loc)))
 	  (assert victim)
 	  (save-complex-writer-tn victim vop)
@@ -983,7 +987,7 @@
 		(pack-tn tn nil)
 		(pack-targeting-tns tn)))))
 	
-	(pack-load-tns block)
-	(emit-saves block)))
+	(emit-saves block)
+	(pack-load-tns block)))
     
     (undefined-value)))
-- 
GitLab