This is an archive of the discontinued LLVM Phabricator instance.

[LoopFlatten][LoopInfo] Use Loop to identify latch compare instruction
ClosedPublic

Authored by RosieSumpter on Jul 19 2021, 2:58 AM.

Details

Summary

Make getLatchCmpInst non-static and use it in LoopFlatten as a more
robust way of identifying the compare.

Diff Detail

Event Timeline

RosieSumpter created this revision.Jul 19 2021, 2:58 AM
RosieSumpter requested review of this revision.Jul 19 2021, 2:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2021, 2:58 AM
SjoerdMeijer added inline comments.
llvm/lib/Analysis/LoopInfo.cpp
175

Nit: do we need the this->?

300

Same

llvm/lib/Transforms/Scalar/LoopFlatten.cpp
113–114

I was expecting we could perhaps get rid of a bit more code. This check is performed in Loop::getLatchCmpInst, so do we need it here?

  • Remove this->
  • Remove checks on back branch
RosieSumpter marked 3 inline comments as done.Jul 19 2021, 6:12 AM
SjoerdMeijer accepted this revision.Jul 19 2021, 6:31 AM

I think exposing getLatchCmpInst is useful and makes sense.
The refactoring that this enables also LGTM.

Please wait with committing until tomorrow in case someone else want to have a look.

This revision is now accepted and ready to land.Jul 19 2021, 6:31 AM
This revision was landed with ongoing or failed builds.Jul 21 2021, 2:16 AM
This revision was automatically updated to reflect the committed changes.