aboutsummaryrefslogtreecommitdiff
path: root/spill.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2019-02-05 11:48:20 +0100
committerQuentin Carbonneaux <[email protected]>2019-02-05 11:59:23 +0100
commit316b57e37eb10cc127526886f58f6cad24916bf1 (patch)
treee26b277fcbb293787918c9649e4af8cf9ae6d4f1 /spill.c
parentf1c865f4bc7dff5a5d844049a73ad82463186e9f (diff)
new spiller heuristic for loops
If a variable is spilled in a loop, the spiller now tries to keep it spilled over the whole loop. Thanks to Michael Forney for sharing a test case exhibiting a pathological reload.
Diffstat (limited to 'spill.c')
-rw-r--r--spill.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/spill.c b/spill.c
index 77496f6..2f7ebb2 100644
--- a/spill.c
+++ b/spill.c
@@ -360,12 +360,17 @@ spill(Fn *fn)
bsunion(v, u);
}
} else if (s1) {
- liveon(v, b, s1);
+ /* avoid reloading temporaries
+ * in the middle of loops */
+ bszero(v);
+ liveon(w, b, s1);
+ if (s1->loop >= b->loop)
+ bsunion(v, w);
if (s2) {
liveon(u, b, s2);
- bscopy(w, u);
- bsinter(w, v);
- bsunion(v, u);
+ if (s2->loop >= b->loop)
+ bsunion(v, u);
+ bsinter(w, u);
}
limit2(v, 0, 0, w);
} else {