This is an archive of the discontinued LLVM Phabricator instance.

[runtimeunroll] Support multiple exits to latch exit w/prolog loop
ClosedPublic

Authored by reames on Aug 17 2021, 6:16 PM.

Details

Summary

This patch extends the runtime unrolling infrastructure to support unrolling a loop with multiple exiting blocks branching to the same exit block used by the latch. It intentionally does not include a cost model change to enable this functionality unless appropriate force flags are used.

This is the prolog companion to D107381. As it turned out, that change did cover all the prolog logic too, so this is just unblocking and updating tests.

As an aside, our prolog form leaves a lot of potential value on the floor when there is an invariant load or invariant condition in the loop being runtime unrolled. We should probably consider a "required prolog" heuristic.

Diff Detail

Event Timeline

reames created this revision.Aug 17 2021, 6:16 PM
reames requested review of this revision.Aug 17 2021, 6:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2021, 6:16 PM
nikic accepted this revision.Aug 18 2021, 11:39 AM

LGTM

This revision is now accepted and ready to land.Aug 18 2021, 11:39 AM
fhahn accepted this revision.Aug 18 2021, 12:44 PM

LGTM, thanks!