mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 20:05:32 +02:00
Replace conservatively-dominates? with a precise dominator lookup
* module/language/cps/dfg.scm (dominates?): Use the dominator tree instead of the scope tree.
This commit is contained in:
parent
3aee6cfdd7
commit
238ef4cf44
1 changed files with 13 additions and 13 deletions
|
@ -486,15 +486,15 @@
|
||||||
uses))))))
|
uses))))))
|
||||||
|
|
||||||
;; Does k1 dominate k2?
|
;; Does k1 dominate k2?
|
||||||
;;
|
(define (dominates? k1 k2 blocks)
|
||||||
;; Note that this is a conservative predicate: a false return value does
|
(match (lookup-block k1 blocks)
|
||||||
;; not indicate that k1 _doesn't_ dominate k2. The reason for this is
|
(($ $block _ _ _ _ k1-idom k1-dom-level)
|
||||||
;; that we are using the scope tree as an approximation of the dominator
|
(match (lookup-block k2 blocks)
|
||||||
;; relationship. See
|
(($ $block _ _ _ _ k2-idom k2-dom-level)
|
||||||
;; http://mlton.org/pipermail/mlton/2003-January/023054.html for a
|
(cond
|
||||||
;; deeper discussion.
|
((> k1-dom-level k2-dom-level) #f)
|
||||||
(define (conservatively-dominates? k1 k2 blocks)
|
((< k1-dom-level k2-dom-level) (dominates? k1 k2-idom blocks))
|
||||||
(continuation-scope-contains? k1 k2 blocks))
|
((= k1-dom-level k2-dom-level) (eqv? k1 k2))))))))
|
||||||
|
|
||||||
(define (dead-after-def? sym dfg)
|
(define (dead-after-def? sym dfg)
|
||||||
(match dfg
|
(match dfg
|
||||||
|
@ -512,7 +512,7 @@
|
||||||
;; are other ways for it to be dead, but this is an
|
;; are other ways for it to be dead, but this is an
|
||||||
;; approximation. A better check would be if the successor
|
;; approximation. A better check would be if the successor
|
||||||
;; post-dominates all uses.
|
;; post-dominates all uses.
|
||||||
(and-map (cut conservatively-dominates? <> use-k blocks)
|
(and-map (cut dominates? <> use-k blocks)
|
||||||
uses))))))
|
uses))))))
|
||||||
|
|
||||||
;; A continuation is a "branch" if all of its predecessors are $kif
|
;; A continuation is a "branch" if all of its predecessors are $kif
|
||||||
|
@ -546,10 +546,10 @@
|
||||||
;; A symbol is dead after a branch if at least one of the
|
;; A symbol is dead after a branch if at least one of the
|
||||||
;; other branches dominates a use of the symbol, and all
|
;; other branches dominates a use of the symbol, and all
|
||||||
;; other uses of the symbol dominate the test.
|
;; other uses of the symbol dominate the test.
|
||||||
(if (or-map (cut conservatively-dominates? <> use-k blocks)
|
(if (or-map (cut dominates? <> use-k blocks)
|
||||||
other-branches)
|
other-branches)
|
||||||
(not (conservatively-dominates? branch use-k blocks))
|
(not (dominates? branch use-k blocks))
|
||||||
(conservatively-dominates? use-k branch blocks)))
|
(dominates? use-k branch blocks)))
|
||||||
uses))))))
|
uses))))))
|
||||||
|
|
||||||
(define (lookup-bound-syms k dfg)
|
(define (lookup-bound-syms k dfg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue