1.0.9.52: copy propagation interfering with local calls
authorNikodemus Siivola <nikodemus@random-state.net>
Mon, 10 Sep 2007 12:36:59 +0000 (12:36 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 10 Sep 2007 12:36:59 +0000 (12:36 +0000)
* 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
src/compiler/copyprop.lisp
tests/compiler.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 2b62557..4241220 100644 (file)
--- 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.
index 5a4e941..10a1768 100644 (file)
          (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
index ebd0b72..f91feb3 100644 (file)
 
 (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
index 09f7b3a..6b789ce 100644 (file)
@@ -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"