This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Use LateSimplifyCFG after expanding atomic operations.
ClosedPublic

Authored by bmakam on Sep 25 2017, 2:32 PM.

Details

Summary

After r308422 we defer optimizations that can destroy loop canonical forms to
LateSimplifyCFG. Running LateSimplifyCFG after expanding atomic operations
can exploit more control-flow opportunities.

Diff Detail

Repository
rL LLVM

Event Timeline

bmakam created this revision.Sep 25 2017, 2:32 PM
efriedma edited edge metadata.Sep 25 2017, 2:58 PM

Looks reasonable... but missing testcase.

bmakam updated this revision to Diff 116996.Sep 28 2017, 8:15 AM

Added a testcase. Please take a look.

bmakam added a comment.Oct 2 2017, 1:27 PM

Kindly ping.

efriedma added inline comments.Oct 2 2017, 1:43 PM
test/CodeGen/AArch64/cmpxchg-idioms.ll
121 ↗(On Diff #116996)

This testcase looks weird because the loop isn't rotated like it normally would be... might not be guess it's not a big deal.

Please add a short explanation of which CHECK lines are important and why; I assume we're threading a branch somewhere, but it isn't obvious exactly which branch.

bmakam updated this revision to Diff 117575.Oct 3 2017, 1:25 PM

Added a comment in the test case to explain that the preheader is simplified during latesimplifycfg.

bmakam added inline comments.Oct 3 2017, 1:28 PM
test/CodeGen/AArch64/cmpxchg-idioms.ll
121 ↗(On Diff #116996)

The loop wasn't rotated to show the missing simplifyCFG opportunity. This opportunity will be lost when loop is rotated. The preheader block gets simplified after this change and we can elide a branch. Added more CHECK lines and a comment to make it clear.

efriedma accepted this revision.Oct 3 2017, 2:10 PM

LGTM

This revision is now accepted and ready to land.Oct 3 2017, 2:10 PM
This revision was automatically updated to reflect the committed changes.