This patch removes redundant calls to ScalarEvolution::forgetLoop when loop unrolling. For very high loop count loops this cuts the compile time (such as the one in the PR) by about a factor of two.
Details
Diff Detail
Event Timeline
lib/Transforms/Utils/LoopUnroll.cpp | ||
---|---|---|
438–439 | How do you know that LI->getLoopFor(Dest) returns the same Loop for all Dest in this loop? |
lib/Transforms/Utils/LoopUnroll.cpp | ||
---|---|---|
438–439 | Good point. Changed to using a pointer set to keep track of forgotten loops. |
LGTM. Thanks!
Also, can you add an explicit note in ScalarEvolution.h above the forgetLoop declaration warning that the call is potentially expensive.
On Wed, Jun 25, 2014 at 9:34 AM, Eli Bendersky <eliben@google.com> wrote:
Is this part of the code well covered by tests? Maybe some more targeted
tests can be crafted.
There are a few tests which require forgetting more than one loop (eg test/Transforms/LoopUnroll/pr11361.ll). One case where this can occur is if an inner loop is fully unrolled. In this case both the inner loop and the containing loop are forgotten.
On Mon, Jun 30, 2014 at 3:29 PM, hfinkel@anl.gov <hfinkel@anl.gov> wrote:
Also, can you add an explicit note in ScalarEvolution.h above the forgetLoop declaration warning that the call is potentially expensive.
Done.
How do you know that LI->getLoopFor(Dest) returns the same Loop for all Dest in this loop?