aboutsummaryrefslogtreecommitdiff
path: root/ssa.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2019-03-01 15:08:58 +0100
committerQuentin Carbonneaux <[email protected]>2019-03-01 15:08:58 +0100
commita85fe6e2d955b0b34e0d17ca244a978489db4a00 (patch)
tree0ef488411cf266995d7d0714ab65df83537eb19d /ssa.c
parent60804c92a81cc4cba494b3b48d11151559269d9b (diff)
skip expensive ssa-building loop when possible
If a temporary is assigned exactly once (most are), there is no need to do any work to put it in ssa form. On an input file of ~35k loc, this makes the processing time go from 2.9 secs to 1.2 secs.
Diffstat (limited to 'ssa.c')
-rw-r--r--ssa.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ssa.c b/ssa.c
index f7dabb8..7ae8117 100644
--- a/ssa.c
+++ b/ssa.c
@@ -125,6 +125,8 @@ phiins(Fn *fn)
fn->tmp[t].visit = 0;
if (fn->tmp[t].phi != 0)
continue;
+ if (fn->tmp[t].ndef == 1)
+ continue;
bszero(u);
k = -1;
bp = be;
@@ -140,10 +142,7 @@ phiins(Fn *fn)
}
if (req(i->to, TMP(t))) {
if (!bshas(b->out, t)) {
- if (fn->tmp[t].ndef == 1)
- r = TMP(t);
- else
- r = refindex(t, fn);
+ r = refindex(t, fn);
i->to = r;
} else {
if (!bshas(u, b->id)) {