[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 3540b1f 13/19: * Guarantee fwprop convergence and te
From: |
Andrea Corallo |
Subject: |
feature/native-comp 3540b1f 13/19: * Guarantee fwprop convergence and termination |
Date: |
Mon, 21 Dec 2020 14:52:40 -0500 (EST) |
branch: feature/native-comp
commit 3540b1f167d63e1a38ec0719f909dcda60c77ad3
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Guarantee fwprop convergence and termination
* lisp/emacs-lisp/comp.el (comp-emit-call-cstr): Have new-mvar as
LHS *and* RHS when constraining in and to ensure monotonicity and
fwprop convergence.
(comp-fwprop): Raise a warning for debug reasons in case fwprop
does not converge within 100 iterations.
---
lisp/emacs-lisp/comp.el | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 6f1ef26..5d2f8d4 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1982,9 +1982,11 @@ TARGET-BB-SYM is the symbol name of the target block."
(defun comp-emit-call-cstr (mvar call-cell cstr)
"Emit a constraint CSTR for MVAR after CALL-CELL."
- (let ((next-cell (cdr call-cell))
- (new-cell `((assume ,(make-comp-mvar :slot (comp-mvar-slot mvar))
- (and ,mvar ,cstr)))))
+ (let* ((next-cell (cdr call-cell))
+ (new-mvar (make-comp-mvar :slot (comp-mvar-slot mvar)))
+ ;; Have new-mvar as LHS *and* RHS to ensure monotonicity and
+ ;; fwprop convergence!!
+ (new-cell `((assume ,new-mvar (and ,new-mvar ,mvar ,cstr)))))
(setf (cdr call-cell) new-cell
(cdr new-cell) next-cell
(comp-func-ssa-status comp-func) 'dirty)))
@@ -2568,9 +2570,14 @@ Return t if something was changed."
(let ((comp-func f))
(comp-fwprop-prologue)
(cl-loop
- for i from 1
+ for i from 1 to 100
while (comp-fwprop*)
- finally (comp-log (format "Propagation run %d times\n" i) 2))
+ finally
+ (when (= i 100)
+ (display-warning
+ 'comp
+ (format "fwprop pass jammed into %s?" (comp-func-name
f))))
+ (comp-log (format "Propagation run %d times\n" i) 2))
(comp-log-func comp-func 3))))
(comp-ctxt-funcs-h comp-ctxt)))
- feature/native-comp e0f20da 14/19: Simplify correctly (or (integer 1 1) (not (integer 1 1))) as t, (continued)
- 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, 2020/12/21
- 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 <=