From: Chris Hanson Date: Fri, 3 Jun 1988 14:56:55 +0000 (+0000) Subject: (invalidate-memory-destination!) Optimize this -- if both class and X-Git-Tag: 20090517-FFI~12742 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=0c07901d729bde76164a87e4fa20647a8806e2b1;p=mit-scheme.git (invalidate-memory-destination!) Optimize this -- if both class and hash are not given, don't bother to insert the element in the hash table, because it will have no useful effect. --- diff --git a/v7/src/compiler/rtlopt/rcse2.scm b/v7/src/compiler/rtlopt/rcse2.scm index 710e799f6..5795faeb7 100644 --- a/v7/src/compiler/rtlopt/rcse2.scm +++ b/v7/src/compiler/rtlopt/rcse2.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlopt/rcse2.scm,v 4.6 1988/05/09 19:54:06 mhwu Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlopt/rcse2.scm,v 4.7 1988/06/03 14:56:55 cph Exp $ Copyright (c) 1987 Massachusetts Institute of Technology @@ -191,7 +191,12 @@ MIT in each case. |# (define (insert-memory-destination! expression element hash) (let ((class (element->class element))) (mention-registers! expression) - (set-element-in-memory?! (hash-table-insert! hash expression class) true))) + ;; Optimization: if class and hash are both false, hash-table-insert! + ;; makes an element which is not connected to the rest of the table. + ;; In that case, there is no need to make an element at all. + (if (or class hash) + (set-element-in-memory?! (hash-table-insert! hash expression class) + true)))) (define (mention-registers! expression) (if (rtl:register? expression)