diff options
| author | Quentin Carbonneaux <[email protected]> | 2019-02-05 11:48:20 +0100 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2019-02-05 11:59:23 +0100 |
| commit | 316b57e37eb10cc127526886f58f6cad24916bf1 (patch) | |
| tree | e26b277fcbb293787918c9649e4af8cf9ae6d4f1 /spill.c | |
| parent | f1c865f4bc7dff5a5d844049a73ad82463186e9f (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.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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 { |
