This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Prefer a simplification based on dominating conditions over merging a common destination.
ClosedPublic

Authored by mcrosier on Apr 29 2016, 2:03 PM.

Details

Summary

Often we can simplify the CFG based on dominating conditions. However, we miss opportunities when we merge blocks with a common destination.

For example, before this change we would need to run -simplifycfg -instcombine -simplifycfg on test4_no_fold to arrive at the code we can now generate after a single run of -simplifycfg. We didn't appear to have any test coverage when merging common destinations, so I went ahead and added test4_fold as an example.

I found a case in Spec2006/soplex where this further removed unreachable code. As expected, I found no cases where code size increased across Spec2000/Spec2006. As isImpliedCondition continues to expand in capabilities I expect more opportunities to be exposed.

Chad

Diff Detail

Repository
rL LLVM

Event Timeline

mcrosier updated this revision to Diff 55662.Apr 29 2016, 2:03 PM
mcrosier retitled this revision from to [SimplifyCFG] Prefer a simplification based on dominating conditions over merging a common destination..
mcrosier updated this object.
mcrosier added a subscriber: llvm-commits.
mcrosier updated this object.Apr 29 2016, 2:04 PM
mcrosier updated this object.May 1 2016, 8:33 AM
reames accepted this revision.May 5 2016, 6:11 PM
reames edited edge metadata.

LGTM

This revision is now accepted and ready to land.May 5 2016, 6:11 PM
This revision was automatically updated to reflect the committed changes.