diff options
author | 2004-12-08 21:21:34 -0700 | |
---|---|---|
committer | 2005-04-07 21:05:44 -0700 | |
commit | 2aa587de0d2306bd67e2492069c3fdf112f699d4 (patch) | |
tree | 3e3fab70ece2237dbc45f8d1a68a9b29c3e0244a /liveness.c | |
parent | Remove phi source merging. (diff) | |
download | sparse-2aa587de0d2306bd67e2492069c3fdf112f699d4.tar.gz sparse-2aa587de0d2306bd67e2492069c3fdf112f699d4.tar.bz2 sparse-2aa587de0d2306bd67e2492069c3fdf112f699d4.zip |
Fix liveness analysis.
Let's not add the pseudos that the bb defines internally onto
the "needs" list. Rather than removign them later, just avoid
putting them there in the first place.
The special cases end up being argument pseudos (which aren't
really defined by the entry bb) and phi-nodes.
Diffstat (limited to 'liveness.c')
-rw-r--r-- | liveness.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -167,8 +167,11 @@ static inline int trackable_pseudo(pseudo_t pseudo) static void insn_uses(struct basic_block *bb, struct instruction *insn, pseudo_t pseudo) { - if (trackable_pseudo(pseudo)) - add_pseudo_exclusive(&bb->needs, pseudo); + if (trackable_pseudo(pseudo)) { + struct instruction *def = pseudo->def; + if (pseudo->type != PSEUDO_REG || def->bb != bb || def->opcode == OP_PHI) + add_pseudo_exclusive(&bb->needs, pseudo); + } } static void insn_defines(struct basic_block *bb, struct instruction *insn, pseudo_t pseudo) @@ -231,14 +234,6 @@ void track_pseudo_liveness(struct entrypoint *ep) } END_FOR_EACH_PTR(insn); } END_FOR_EACH_PTR(bb); - /* Remove the pseudos from the "need" list that are defined internally */ - FOR_EACH_PTR(ep->bbs, bb) { - pseudo_t def; - FOR_EACH_PTR(bb->defines, def) { - remove_pseudo(&bb->needs, def); - } END_FOR_EACH_PTR(def); - } END_FOR_EACH_PTR(bb); - /* Calculate liveness.. */ do { liveness_changed = 0; |