From 57d7dd0f59b9df89feb1175b0efc449bb0b8d400 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Mon, 10 Sep 2007 12:36:59 +0000 Subject: [PATCH] 1.0.9.52: copy propagation interfering with local calls * Don't allow copy propagation to a local call argument, thus preserving parallel assignment semantics -- to judge by the comment above OK-COPY-REF, this is what it was ment to do in the first place. Reported by Paul Khuong on sbcl-devel. --- NEWS | 4 +++- src/compiler/copyprop.lisp | 10 +++++----- tests/compiler.impure.lisp | 14 ++++++++++++++ version.lisp-expr | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 2b62557..4241220 100644 --- a/NEWS +++ b/NEWS @@ -20,10 +20,12 @@ changes in sbcl-1.0.10 relative to sbcl-1.0.9: EQUALP. * enhancement: DEFINE-MODIFY-MACRO lambda-list information is now more readable in environments like Slime which display it. - (thanks to Tobias C. Rittweiler) + (thanks to Tobias C. Rittweiler) * bug fix: SB-EXT:COMPARE-AND-SWAP was non-atomic unless the compiler was able to infer the correct argument type for the object on which the CAS operation was being performed. + * bug fix: copy propagation interfered with parallel assignment + semantics in local calls. (reported by Paul Khuong) changes in sbcl-1.0.9 relative to sbcl-1.0.8: * minor incompatible change: SB-SYS:OUTPUT-RAW-BYTES is deprecated. diff --git a/src/compiler/copyprop.lisp b/src/compiler/copyprop.lisp index 5a4e941..10a1768 100644 --- a/src/compiler/copyprop.lisp +++ b/src/compiler/copyprop.lisp @@ -162,11 +162,11 @@ (unless (sset-member original in) (return nil))) (let ((info (vop-info vop))) - (not (and (eq (vop-info-move-args info) :local-call) - (>= (or (position-in #'tn-ref-across arg (vop-args vop) - :key #'tn-ref-tn) - (error "Couldn't find REF?")) - (length (template-arg-types info)))))))) + (not (or (eq (vop-info-move-args info) :local-call) + (>= (or (position-in #'tn-ref-across arg (vop-args vop) + :key #'tn-ref-tn) + (error "Couldn't find REF?")) + (length (template-arg-types info)))))))) ;;; Make use of the result of flow analysis to eliminate copies. We ;;; scan the VOPs in block, propagating copies and keeping our IN set diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index ebd0b72..f91feb3 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -1448,4 +1448,18 @@ (assert (default-values-bug-demo-main)) +;;; copy propagation bug reported by Paul Khuong + +(defun local-copy-prop-bug-with-move-arg (x) + (labels ((inner () + (values 1 0))) + (if x + (inner) + (multiple-value-bind (a b) + (inner) + (values b a))))) + +(assert (equal '(0 1) (multiple-value-list (local-copy-prop-bug-with-move-arg nil)))) +(assert (equal '(1 0) (multiple-value-list (local-copy-prop-bug-with-move-arg t)))) + ;;; success diff --git a/version.lisp-expr b/version.lisp-expr index 09f7b3a..6b789ce 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.9.51" +"1.0.9.52" -- 1.7.10.4