mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
More precise dead-after-use? for loop variables
* module/language/cps/dfg.scm (dead-after-use?): (dead-after-branch?): A symbol defined in the header block of a loop is still within the same loop.
This commit is contained in:
parent
b8da548fba
commit
649f6043de
1 changed files with 6 additions and 4 deletions
|
@ -721,8 +721,9 @@
|
|||
;; other ways for it to be dead, but this is an approximation.
|
||||
;; A better check would be if all successors post-dominate all
|
||||
;; uses.
|
||||
(and (eqv? (lookup-loop-header use-k blocks)
|
||||
(lookup-loop-header def blocks))
|
||||
(and (let ((loop (lookup-loop-header use-k blocks)))
|
||||
(or (eqv? def loop)
|
||||
(eqv? (lookup-loop-header def blocks) loop)))
|
||||
(and-map (cut dominates? <> use-k blocks) uses)))))))
|
||||
|
||||
;; A continuation is a "branch" if all of its predecessors are $kif
|
||||
|
@ -753,8 +754,9 @@
|
|||
(($ $use-map sym def uses)
|
||||
;; As in dead-after-use?, we don't kill the variable if it was
|
||||
;; defined outside the current loop.
|
||||
(and (eqv? (lookup-loop-header branch blocks)
|
||||
(lookup-loop-header def blocks))
|
||||
(and (let ((loop (lookup-loop-header branch blocks)))
|
||||
(or (eqv? def loop)
|
||||
(eqv? (lookup-loop-header def blocks) loop)))
|
||||
(and-map
|
||||
(lambda (use-k)
|
||||
;; A symbol is dead after a branch if at least one of the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue