From e20cdf937e74ebcaa2c6dabb63be1c20a6ea44f6 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sun, 8 Nov 2020 20:45:43 +0100 Subject: [PATCH] * lisp/emacs-lisp/comp.el (comp-fwprop-insn): Fix phi function. --- lisp/emacs-lisp/comp.el | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index c837e020603..887a6a503ec 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2289,19 +2289,20 @@ Forward propagate immediate involed in assignments." (setf (comp-mvar-const-vld lval) t (comp-mvar-constant lval) v (comp-mvar-type lval) (comp-strict-type-of v))) - (`(phi (,lval . _) . ,rest) - ;; Forward const prop here. - (when-let* ((vld (cl-every #'comp-mvar-const-vld rest)) - (consts (mapcar #'comp-mvar-constant rest)) - (x (car consts)) - (equals (cl-every (lambda (y) (equal x y)) consts))) - (setf (comp-mvar-const-vld lval) t - (comp-mvar-constant lval) x)) - ;; Forward type propagation. - (when-let* ((types (mapcar #'comp-mvar-type rest)) - (non-empty (cl-notany #'null types)) - (x (comp-common-supertype types))) - (setf (comp-mvar-type lval) x))))) + (`(phi ,lval . ,rest) + (let ((rvals (mapcar #'car rest))) + ;; Forward const prop here. + (when-let* ((vld (cl-every #'comp-mvar-const-vld rvals)) + (consts (mapcar #'comp-mvar-constant rvals)) + (x (car consts)) + (equals (cl-every (lambda (y) (equal x y)) consts))) + (setf (comp-mvar-const-vld lval) t + (comp-mvar-constant lval) x)) + ;; Forward type propagation. + (when-let* ((types (mapcar #'comp-mvar-type rvals)) + (non-empty (cl-notany #'null types)) + (x (comp-common-supertype types))) + (setf (comp-mvar-type lval) x)))))) (defun comp-fwprop* () "Propagate for set* and phi operands. -- 2.39.5