This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnroll] Use Lazy strategy for DTU used for MergeBlockIntoPredecessor.
ClosedPublic

Authored by fhahn on Aug 28 2019, 4:11 PM.

Details

Summary

We do not access the DT in the loop, so we do not have to apply updates
eagerly. We can apply them lazyly and flush them after we are done
merging blocks.

As follow-up work, we might be able to use the DTU above as well,
instead of manually updating the DT.

This brings the example from PR43134 from ~100s to ~4s for a relase +
assertions build on my machine.

Diff Detail

Repository
rL LLVM

Event Timeline

fhahn created this revision.Aug 28 2019, 4:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2019, 4:11 PM
brzycki accepted this revision.Aug 28 2019, 4:15 PM
brzycki added a subscriber: brzycki.

LGTM. I'd still like to hear if @kuhar has any objections.

This revision is now accepted and ready to land.Aug 28 2019, 4:15 PM

Could you also make the same change in lib/Transforms/Utils/LoopUnrollAndJam.cpp:541?

brzycki added inline comments.Aug 28 2019, 4:22 PM
llvm/lib/Transforms/Utils/LoopUnroll.cpp
893 ↗(On Diff #217734)

Nit: possibly add a comment stating this flushes/synchronizes the state of DT?

kuhar accepted this revision.Aug 28 2019, 5:43 PM

Looks good. Thanks!

fhahn added a comment.Aug 28 2019, 6:06 PM

Could you also make the same change in lib/Transforms/Utils/LoopUnrollAndJam.cpp:541?

Done, in D66918

fhahn updated this revision to Diff 217752.Aug 28 2019, 6:07 PM

Add comment that DTU.getDomTree applies the updates to the DomTree.

fhahn marked an inline comment as done.Aug 28 2019, 6:07 PM
This revision was automatically updated to reflect the committed changes.