diff options
author | Richard Biener <rguenther@suse.de> | 2021-09-09 11:50:20 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-09-09 11:50:20 +0200 |
commit | 013cfc648405a8a118d07436f103e4d70224fe00 (patch) | |
tree | ca468ff6558e0211fbeda33517a6f71a7933d5b0 /gcc/tree-ssa-loop-im.c | |
parent | 6e27bc2b885207d51500b2c42f949ca5073dbe72 (diff) | |
download | gcc-013cfc648405a8a118d07436f103e4d70224fe00.zip gcc-013cfc648405a8a118d07436f103e4d70224fe00.tar.gz gcc-013cfc648405a8a118d07436f103e4d70224fe00.tar.bz2 |
Improve LIM fill_always_executed_in computation
Currently the DOM walk over a loop body does not walk into not
always executed subloops to avoid scalability issues since doing
so makes the walk quadratic in the loop depth. It turns out this
is not an issue in practice and even with a loop depth of 1800
this function is way off the radar.
So the following patch removes the limitation, replacing it with
a comment.
2021-09-09 Richard Biener <rguenther@suse.de>
* tree-ssa-loop-im.c (fill_always_executed_in_1): Walk
into all subloops.
* gcc.dg/tree-ssa/ssa-lim-17.c: New testcase.
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 5d68454..4b187c2 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -3074,15 +3074,13 @@ fill_always_executed_in_1 (class loop *loop, sbitmap contains_call) break; if (bb->loop_father->header == bb) - { - if (!dominated_by_p (CDI_DOMINATORS, loop->latch, bb)) - break; - - /* In a loop that is always entered we may proceed anyway. - But record that we entered it and stop once we leave it - since it might not be finite. */ - inn_loop = bb->loop_father; - } + /* Record that we enter into a subloop since it might not + be finite. */ + /* ??? Entering into a not always executed subloop makes + fill_always_executed_in quadratic in loop depth since + we walk those loops N times. This is not a problem + in practice though, see PR102253 for a worst-case testcase. */ + inn_loop = bb->loop_father; /* Walk the body of LOOP sorted by dominance relation. Additionally, if a basic block S dominates the latch, then only blocks dominated |