1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00

* 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.
This commit is contained in:
Andrea Corallo 2020-12-22 22:53:05 +01:00
parent 672988e961
commit 96d4c70412

View File

@ -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."