This is an archive of the discontinued LLVM Phabricator instance.

[LoopPeeling] Add flag to disable support for peeling loops with non-latch exits
ClosedPublic

Authored by asbirlea on Oct 24 2022, 3:48 PM.

Diff Detail

Event Timeline

asbirlea created this revision.Oct 24 2022, 3:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 3:48 PM
asbirlea requested review of this revision.Oct 24 2022, 3:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 3:48 PM
tra added a comment.Oct 24 2022, 4:01 PM

Thank you, Alina!

llvm/lib/Transforms/Utils/LoopPeel.cpp
977

Style nit: no need for {} around if/else bodies here.

bgraur added a subscriber: bgraur.Oct 25 2022, 12:15 AM

Thanks a lot Alina!

nikic added inline comments.Oct 25 2022, 12:46 AM
llvm/lib/Transforms/Utils/LoopPeel.cpp
112

Is it possible to reduce these conditions to the ones relevant to the affected test case? Like, I doubt that the check for BranchInst is relevant, and it would be good to know whether for the problematic case having a non-latch exit is the issue, or the structure of other exits.

528

Why is all this code needed? I would have expected the change to be just in canPeel(). For the cases where canPeel() previously returned true, the new implementation should behave the same apart from minor differences in branch weights.

Does that mean that you see issues if you limit peeling, but use the new branch weight updating code? That would be quite surprising, and would point towards something there being broken.

Generally fine with a temporary option, as long as the code duplication introduced here is not actually necessary.

asbirlea updated this revision to Diff 470552.Oct 25 2022, 10:28 AM

Simplified to only the changes in canPeel.

asbirlea updated this revision to Diff 470590.Oct 25 2022, 12:16 PM

Simplify conditions in canPeel.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 25 2022, 12:19 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.