[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 6f3570c 16/19: Fix value type inference for doubly n
From: |
Andrea Corallo |
Subject: |
feature/native-comp 6f3570c 16/19: Fix value type inference for doubly negate constraints |
Date: |
Mon, 21 Dec 2020 14:52:41 -0500 (EST) |
branch: feature/native-comp
commit 6f3570cd4a615caa02c3d86320049a5631ab9b25
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
Fix value type inference for doubly negate constraints
* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Do not propagate in
case of double negation.
* test/src/comp-test-funcs.el (comp-test-assume-double-neg-f):
New function.
* test/src/comp-tests.el (assume-double-neg): New test.
---
lisp/emacs-lisp/comp.el | 4 +++-
test/src/comp-test-funcs.el | 10 ++++++++++
test/src/comp-tests.el | 4 ++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 5d2f8d4..895e1ac 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2530,7 +2530,9 @@ Fold the call in case."
(and
(apply #'comp-cstr-intersection lval operands))
(not
- (comp-cstr-negation lval (car operands)))))
+ ;; Prevent double negation!
+ (unless (comp-cstr-neg (car operands))
+ (comp-cstr-negation lval (car operands))))))
(`(setimm ,lval ,v)
(setf (comp-mvar-value lval) v))
(`(phi ,lval . ,rest)
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index 5fc032b..7f70fc2 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -395,6 +395,16 @@
(1 " ➊") (2 " ➋") (3 " ➌") (4 " ➍") (5 " ➎") (6 " ➏")
(7 " ➐") (8 " ➑") (9 " ➒") (10 " ➓") (_ "")))
+(defun comp-test-assume-double-neg-f (collection value)
+ ;; Reduced from `auth-source-search-collection'.
+ (when (atom collection)
+ (setq collection (list collection)))
+ (or (eq value t)
+ ;; value is (not (member t))
+ (eq collection value)
+ ;; collection is t, not (member t)!
+ (member value collection)))
+
;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 8e069fb..eeff599 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -401,6 +401,10 @@
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01771.html>"
(should (string= " ➊" (comp-test-45342-f 1))))
+(comp-deftest assume-double-neg ()
+ "In fwprop assumtions (not (not (member x))) /= (member x)."
+ (should-not (comp-test-assume-double-neg-f "bar" "foo")))
+
(defvar comp-test-primitive-advice)
(comp-deftest primitive-advice ()
"Test effectiveness of primitive advicing."
- feature/native-comp updated (5b10a03 -> 9676e4d), Andrea Corallo, 2020/12/21
- feature/native-comp 2a117ad 01/19: * Add mvar pretty print support when dumping LIMPLE, Andrea Corallo, 2020/12/21
- feature/native-comp bad18f5 02/19: * Improve comp-fwprop pass, Andrea Corallo, 2020/12/21
- feature/native-comp a0c0daf 03/19: * Fix a number of type specifier simplification tests, Andrea Corallo, 2020/12/21
- feature/native-comp 34c1d75 05/19: * Enumerate and split type specifier tests in comp-tests.el to ease debug, Andrea Corallo, 2020/12/21
- feature/native-comp 7074988 06/19: * Add a type specifier test to comp-cstr-tests.el, Andrea Corallo, 2020/12/21
- feature/native-comp 0255108 08/19: * Rename comp-cond-cstr into comp-add-cstrs, Andrea Corallo, 2020/12/21
- feature/native-comp 48d43f5 04/19: * Improve constraint simplification logic in comp-cstr.el, Andrea Corallo, 2020/12/21
- feature/native-comp 07b75de 10/19: Enhance type inference constraining function arguments, Andrea Corallo, 2020/12/21
- feature/native-comp e0f20da 14/19: Simplify correctly (or (integer 1 1) (not (integer 1 1))) as t, Andrea Corallo, 2020/12/21
- feature/native-comp 6f3570c 16/19: Fix value type inference for doubly negate constraints,
Andrea Corallo <=
- feature/native-comp d072ee9 07/19: * Two minors in comp.el, Andrea Corallo, 2020/12/21
- feature/native-comp 23791cf 09/19: * Allow for modifying insn-cell inside `comp-loop-insn-in-block', Andrea Corallo, 2020/12/21
- feature/native-comp 9bbe6ea 15/19: Fix native compiler tests when they are bytecompiled, Andrea Corallo, 2020/12/21
- feature/native-comp 8e816b0 11/19: Symplify type specifier (not t) as nil, Andrea Corallo, 2020/12/21
- feature/native-comp c70c080 12/19: * Allow for overlapping src and dst in cstr set operations, Andrea Corallo, 2020/12/21
- feature/native-comp 5376563 17/19: Fix `comp-add-call-cstr' and add a test, Andrea Corallo, 2020/12/21
- feature/native-comp ebf8963 18/19: * Fix a bunch of known type specifiers, Andrea Corallo, 2020/12/21
- feature/native-comp 9676e4d 19/19: * Fix a test in auth-source-tests.el, Andrea Corallo, 2020/12/21
- feature/native-comp 3540b1f 13/19: * Guarantee fwprop convergence and termination, Andrea Corallo, 2020/12/21