Make use of `comp-cstr-shallow-copy'

* lisp/emacs-lisp/comp.el (comp-mvar-propagate): Remove.
(comp-fwprop-call, comp-fwprop-insn): Use `comp-cstr-shallow-copy'.

* lisp/emacs-lisp/comp-cstr.el (comp-cstr-set-cmp-range)
(comp-cstr-union-1-no-mem, comp-cstr-union-1)
(comp-cstr-intersection-no-mem, comp-cstr-intersection)
(comp-cstr-negation): Use `comp-cstr-shallow-copy'.
This commit is contained in:
Andrea Corallo 2021-12-01 15:01:55 +01:00
parent f3284d5acd
commit fd86829e66
2 changed files with 18 additions and 50 deletions

View file

@ -3086,13 +3086,6 @@ Forward propagate immediate involed in assignments." ; FIXME: Typo. Involved or
(`(setimm ,lval ,v)
(setf (comp-cstr-imm lval) v))))))
(defun comp-mvar-propagate (lval rval)
"Propagate into LVAL properties of RVAL."
(setf (comp-mvar-typeset lval) (comp-mvar-typeset rval)
(comp-mvar-valset lval) (comp-mvar-valset rval)
(comp-mvar-range lval) (comp-mvar-range rval)
(comp-mvar-neg lval) (comp-mvar-neg rval)))
(defun comp-function-foldable-p (f args)
"Given function F called with ARGS, return non-nil when optimizable."
(and (comp-function-pure-p f)
@ -3142,10 +3135,7 @@ Fold the call in case."
(when (comp-cstr-empty-p cstr)
;; Store it to be rewritten as non local exit.
(setf (comp-block-lap-non-ret-insn comp-block) insn))
(setf (comp-mvar-range lval) (comp-cstr-range cstr)
(comp-mvar-valset lval) (comp-cstr-valset cstr)
(comp-mvar-typeset lval) (comp-cstr-typeset cstr)
(comp-mvar-neg lval) (comp-cstr-neg cstr))))
(comp-cstr-shallow-copy lval cstr)))
(cl-case f
(+ (comp-cstr-add lval args))
(- (comp-cstr-sub lval args))
@ -3163,9 +3153,9 @@ Fold the call in case."
(let ((f (comp-func-name (gethash f (comp-ctxt-funcs-h comp-ctxt)))))
(comp-fwprop-call insn lval f args)))
(_
(comp-mvar-propagate lval rval))))
(comp-cstr-shallow-copy lval rval))))
(`(assume ,lval ,(and (pred comp-mvar-p) rval))
(comp-mvar-propagate lval rval))
(comp-cstr-shallow-copy lval rval))
(`(assume ,lval (,kind . ,operands))
(cl-case kind
(and