Fix bug in reduce-component
authorDavid Vázquez <davazp@gmail.com>
Sat, 1 Jun 2013 11:47:17 +0000 (12:47 +0100)
committerDavid Vázquez <davazp@gmail.com>
Sat, 1 Jun 2013 11:47:17 +0000 (12:47 +0100)
experimental/compiler.lisp

index 7b757f7..6f6de91 100644 (file)
                    (block-pred block) pred)))))))
 
 (defun reduce-component (&optional (component *component*))
-  (let* ((list-blocks (component-blocks component))
+  (let* ((*component* component)
+         (list-blocks (component-blocks component))
          ;; A vector of the blocks in the component. Blocks are added
          ;; and deleted always at the fill pointer of the vector.
          (vector-blocks
                  (setf (block-succ pred) (remove block (block-succ pred)))
                  (dolist (succ (block-succ block))
                    (pushnew succ (block-succ pred))
-                   (setf (block-pred succ) (substitute pred block (block-pred succ)))))
+                   (setf (block-pred succ) (remove block (block-pred succ)))
+                   (pushnew pred (block-pred succ))))
                t))
            ;; This function duplicates the block in component for each input
            ;; edge. A technique useful to make a general flowgraph reducible.