From 5bc08559e8f171eafc3c034232f8cfd9eaf89862 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sat, 27 Feb 2021 22:00:11 +0100 Subject: Don't treat '=' as simple equality emitting constraints (bug#46812) Extend assumes allowing the following form (assume dst (= src1 src2)) to caputure '=' semanting during fwprop handling float integer conversions. * lisp/emacs-lisp/comp.el (comp-equality-fun-p): Don't treat '=' as simple equality. (comp-arithm-cmp-fun-p, comp-negate-arithm-cmp-fun) (comp-reverse-arithm-fun): Rename and add '=' '!='. (comp-emit-assume, comp-add-cond-cstrs, comp-fwprop-insn): Update for new function nameing and to handle '='. * lisp/emacs-lisp/comp-cstr.el (comp-cstr-=): New function. * test/src/comp-tests.el (comp-tests-type-spec-tests): Add a bunch of '=' specific tests. --- lisp/emacs-lisp/comp-cstr.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lisp/emacs-lisp/comp-cstr.el') diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 89815f03b53..bd1e04fb0bb 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -859,6 +859,18 @@ Non memoized version of `comp-cstr-intersection-no-mem'." (null (neg cstr)) (equal (typeset cstr) '(cons))))) +(defun comp-cstr-= (dst old-dst src) + "Constraint DST being = SRC." + (with-comp-cstr-accessors + (comp-cstr-intersection dst old-dst src) + (cl-loop for v in (valset dst) + when (and (floatp v) + (= v (truncate v))) + do (push (cons (truncate v) (truncate v)) (range dst))) + (cl-loop for (l . h) in (range dst) + when (eql l h) + do (push (float l) (valset dst))))) + (defun comp-cstr-> (dst old-dst src) "Constraint DST being > than SRC. SRC can be either a comp-cstr or an integer." -- cgit v1.2.3