Skip to content

Commit

Permalink
1.0.9.52: copy propagation interfering with local calls
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
nikodemus committed Sep 10, 2007
1 parent 6256e84 commit 57d7dd0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
4 changes: 3 additions & 1 deletion NEWS
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions src/compiler/copyprop.lisp
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions tests/compiler.impure.lisp
Expand Up @@ -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
2 changes: 1 addition & 1 deletion version.lisp-expr
Expand Up @@ -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"

0 comments on commit 57d7dd0

Please sign in to comment.