[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 96d4c70 6/9: * Fix logic for constraining block with
From: |
Andrea Corallo |
Subject: |
feature/native-comp 96d4c70 6/9: * Fix logic for constraining block with multiple predecessors |
Date: |
Thu, 24 Dec 2020 09:49:31 -0500 (EST) |
branch: feature/native-comp
commit 96d4c70412ee1f3f0f797d27cd7b8bc5532ba692
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Fix logic for constraining block with multiple predecessors
* lisp/emacs-lisp/comp.el (comp-limple-lock-keywords)
(comp-add-cond-cstrs-target-block): Logic update.
---
lisp/emacs-lisp/comp.el | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 297dabb..f73bd4b 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -662,7 +662,8 @@ Assume allocation class 'd-default as default."
(1 font-lock-variable-name-face))
(,(rx (group-n 1 (or "entry"
(seq (or "entry_" "entry_fallback_" "bb_")
- (1+ num) (? (or "_latch" "_cstrs"))))))
+ (1+ num) (? (or "_latch"
+ (seq "_cstrs_" (1+ num))))))))
(1 font-lock-constant-face))
(,(rx-to-string
`(seq "(" (group-n 1 (or ,@(mapcar #'symbol-name comp-limple-ops)))))
@@ -1943,15 +1944,23 @@ Keep on searching till EXIT-INSN is encountered."
"Return the appropriate basic block to add constraint assumptions into.
CURR-BB is the current basic block.
TARGET-BB-SYM is the symbol name of the target block."
- (let ((target-bb (gethash target-bb-sym
- (comp-func-blocks comp-func))))
- (if (= (length (comp-block-in-edges target-bb)) 1)
+ (let* ((target-bb (gethash target-bb-sym
+ (comp-func-blocks comp-func)))
+ (target-bb-in-edges (comp-block-in-edges target-bb)))
+ (cl-assert target-bb-in-edges)
+ (if (= (length target-bb-in-edges) 1)
;; If block has only one predecessor is already suitable for
;; adding constraint assumptions.
target-bb
- (comp-add-new-block-between (intern (concat (symbol-name target-bb-sym)
- "_cstrs"))
- curr-bb target-bb))))
+ (cl-loop
+ ;; Search for the first suitable basic block name.
+ for i from 0
+ for new-name = (intern (format "%s_cstrs_%d" (symbol-name target-bb-sym)
+ i))
+ until (null (gethash new-name (comp-func-blocks comp-func)))
+ finally
+ ;; Add it.
+ (cl-return (comp-add-new-block-between new-name curr-bb target-bb))))))
(defun comp-add-cond-cstrs-simple ()
"`comp-add-cstrs' worker function for each selected function."
- feature/native-comp updated (b99a474 -> b4ee13c), Andrea Corallo, 2020/12/24
- feature/native-comp 4deeb2f 1/9: Invert basic block argument order in LIMPLE cond-jump, Andrea Corallo, 2020/12/24
- feature/native-comp c07c9f6 2/9: Extend cstrs pass to match `when' like code, Andrea Corallo, 2020/12/24
- feature/native-comp 538f598 4/9: Extend cstrs pass to match `unless' like code, Andrea Corallo, 2020/12/24
- feature/native-comp 672988e 5/9: Symplify (not t) => nil and (not nil) => t, Andrea Corallo, 2020/12/24
- feature/native-comp 96d4c70 6/9: * Fix logic for constraining block with multiple predecessors,
Andrea Corallo <=
- feature/native-comp 715cac1 3/9: * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): Opencode byte-not., Andrea Corallo, 2020/12/24
- feature/native-comp 2327a98 8/9: * Constrain only mvars that are actually used, Andrea Corallo, 2020/12/24
- feature/native-comp b4ee13c 9/9: * Memoize `comp-subtype-p', Andrea Corallo, 2020/12/24
- feature/native-comp 2a6c6bf 7/9: * Use `comp-assign-op-p' into dead code elimination pass, Andrea Corallo, 2020/12/24