This is an archive of the discontinued LLVM Phabricator instance.

[simplifycfg][loop-simplify] Preserve loop metadata in 2 transformations.
ClosedPublic

Authored by fhahn on Nov 10 2016, 2:55 AM.

Details

Summary

insertUniqueBackedgeBlock in lib/Transforms/Utils/LoopSimplify.cpp now
propagates existing llvm.loop metadata to newly the added backedge.

llvm::TryToSimplifyUncondBranchFromEmptyBlock in lib/Transforms/Utils/Local.cpp
now propagates existing llvm.loop metadata to the branch instructions in the
predecessor blocks of the empty block that is removed.

Diff Detail

Event Timeline

fhahn updated this revision to Diff 77462.Nov 10 2016, 2:55 AM
fhahn retitled this revision from to [simplifycfg][loop-simplify] Preserve loop metadata in 2 transformations..
fhahn updated this object.
fhahn added reviewers: rnk, chandlerc.
fhahn added a subscriber: llvm-commits.
hfinkel accepted this revision.Nov 10 2016, 3:34 PM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

Some minor things about the tests, otherwise LGTM

test/Transforms/LoopSimplify/preserve-llvm-loop-metadata.ll
32

The code removes the metadata from the old backedges; please add some CHECK-NOT lines to verify that.

test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll
44

Shouldn't this be: !llvm.loop !0 here too.

This revision is now accepted and ready to land.Nov 10 2016, 3:34 PM
fhahn updated this revision to Diff 77798.Nov 14 2016, 5:56 AM
fhahn edited edge metadata.

Add check-not to test.

fhahn marked 2 inline comments as done.Nov 14 2016, 5:57 AM
This revision was automatically updated to reflect the committed changes.