From: Andrea Corallo Date: Sun, 8 Nov 2020 19:45:43 +0000 (+0100) Subject: * lisp/emacs-lisp/comp.el (comp-fwprop-insn): Fix phi function. X-Git-Tag: emacs-28.0.90~2727^2~339 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e20cdf937e74ebcaa2c6dabb63be1c20a6ea44f6;p=emacs.git * lisp/emacs-lisp/comp.el (comp-fwprop-insn): Fix phi function. --- 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.