This is an archive of the discontinued LLVM Phabricator instance.

Correctly report modified status for SimplifyCFG and LoopSimplify
ClosedPublic

Authored by serge-sans-paille on Jun 5 2020, 12:52 AM.

Details

Summary

Related to https://reviews.llvm.org/D80916

This required to modify the helper function FoldBranchToCommonDest, but it also has the surprising side effect to make the simplification more efficient in at least one tested case, thus the test update.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2020, 12:52 AM
foad added inline comments.Jun 5 2020, 6:28 AM
llvm/include/llvm/Transforms/Utils/Local.h
256–260 ↗(On Diff #268690)

Needs a comment to explain what's going on: "returns true on success, but note that even on failure we might have changed some IR, in which case *Modified is set to true" or similar.

Alternatively, rearrange things so that we don't make any changes until we know we're going to succeed.

Rework FoldBranchToCommonDest to correctly report status, so that we don't make its signature too complex.

foad added inline comments.Jun 10 2020, 1:48 AM
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
5957–5958

This change isn't needed. requestResimplift always returns true.

foad accepted this revision.Jun 10 2020, 1:51 AM

LGTM except for the minor comments inline.

llvm/lib/Transforms/Utils/SimplifyCFG.cpp
2767

This seems like an odd place to put this line. Maybe move it up, right next to the "FOLDING BRANCH TO COMMON DEST" message? That's when we know we're going to change something.

This revision is now accepted and ready to land.Jun 10 2020, 1:51 AM
This revision was automatically updated to reflect the committed changes.