This is an archive of the discontinued LLVM Phabricator instance.

[UnrollRuntime] Support multi-exiting blocks to LatchExit
AbandonedPublic

Authored by anna on Jan 8 2019, 12:41 PM.

Details

Summary

This patch implements runtime unrolling for multi-exit loops where
there are multiple exiting blocks that go to the latchExit.
This requires updating the ConnectProlog and ConnectEpilog code.

For this patch, the implementation is only for remainder code which is
prolog code. Added test cases for various scenarios.
No DT or LI changes required.

Diff Detail

Event Timeline

anna created this revision.Jan 8 2019, 12:41 PM
mkazantsev added inline comments.Jan 10 2019, 9:40 PM
lib/Transforms/Utils/LoopUnrollRuntime.cpp
105

Line too long.

121

Could you please add more comments on this piece of logic? I don't quite understand it. Why do we make difference between phi latch inputs that come from inside the loop and from outside the loop?

124

Maybe dyn_cast here and remove cast on line below?

137

That looks like it can go as a separate NFC.

142

Why can we expect that? Other usage in code accounts for nullptr case.

efriedma added inline comments.
lib/Transforms/Utils/LoopUnrollRuntime.cpp
508

I don't like the "!DT" check; if the domtree is required to unroll certain loops, we should just assert that the caller always passes a domtree. (I haven't reviewed the logic carefully to see if the dominates() check is strictly necessary.)

anna planned changes to this revision.Jan 22 2019, 5:39 AM

need to update comments and address review comments. moving out of queue for now.

anna abandoned this revision.Jan 28 2022, 7:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2022, 7:53 AM