This is an archive of the discontinued LLVM Phabricator instance.

[SimpleLoopUnswitch] Preserve make.implicit in non-trivial unswitch if legal
ClosedPublic

Authored by mkazantsev on Jul 30 2020, 2:38 AM.

Details

Summary

We can preserve make.implicit metadata in the split block if it is
guaranteed that after following the branch we always reach the block
where processing of null case happens, which is equivalent to
"initial condition must execute if the loop is entered".

Diff Detail

Event Timeline

mkazantsev created this revision.Jul 30 2020, 2:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2020, 2:38 AM
asbirlea accepted this revision.Jul 30 2020, 8:14 AM

lgtm

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
2080

I'm wondering if there is a case where we'd rather always drop the metadata than incur the cost of computing loop safety info (i.e. if a flag should exist to have this option).

This revision is now accepted and ready to land.Jul 30 2020, 8:14 AM
mkazantsev added inline comments.Jul 30 2020, 9:36 PM
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
2080

I can add such flag as a follow-up. Thanks for idea!