This is an archive of the discontinued LLVM Phabricator instance.

In LICM, don't create more than one copy of an instruction per loop exit block when sinking.
ClosedPublic

Authored by eugenis on Jun 23 2014, 2:59 AM.

Details

Reviewers
chandlerc
Summary

Fixes exponential compilation complexity in PR19835.

http://llvm.org/bugs/show_bug.cgi?id=19835

Diff Detail

Event Timeline

eugenis updated this revision to Diff 10743.Jun 23 2014, 2:59 AM
eugenis retitled this revision from to In LICM, don't create more than one copy of an instruction per loop exit block when sinking..
eugenis updated this object.
eugenis edited the test plan for this revision. (Show Details)
eugenis added a reviewer: chandlerc.
eugenis set the repository for this revision to rL LLVM.
eugenis added a subscriber: Unknown Object (MLST).

On the surface changes look OK to me, but obviously wait for someone else to review.

One thing about the test: AFAIK we've moved away from the convention of adding the dates to the names of tests.

eugenis updated this revision to Diff 10747.Jun 23 2014, 5:32 AM

Renamed the test.

Thanks.
There is ~14 tests starting with 2014-, but I agree it's a waste of space.

Please make sure that you include the explanation from the PR (starting with "The problem is in LICM::sink, which does not handle the following pattern well:") into the commit message. LGTM.

test/Transforms/LICM/extra-copies.ll
37

Please remove the extra metadata (like this one), and any unneeded attributes.

chandlerc accepted this revision.Jun 24 2014, 1:54 PM
chandlerc edited edge metadata.

What Hal said, plus one more request. =] Patch looks good otherwise.

lib/Transforms/Scalar/LICM.cpp
567–598

I would factor some part of this into a helper function, there is too much deeply nested conditional logic here. Maybe the right thing to do is to factor out the logic handling the build up a clone in the exit block?

(But do that in a separate patch either before or after landing th ebugfix)

This revision is now accepted and ready to land.Jun 24 2014, 1:54 PM
eugenis updated this revision to Diff 10821.Jun 25 2014, 12:58 AM
eugenis edited edge metadata.
eugenis added inline comments.
test/Transforms/LICM/extra-copies.ll
37

done

eugenis closed this revision.Jun 25 2014, 1:04 AM

Committed as r211673.
Thanks for the review!
I'll look into refactoring this code now.