This is an archive of the discontinued LLVM Phabricator instance.

[BPI] NFC: reorder ifs to bail out earlier
ClosedPublic

Authored by skatkov on Apr 5 2017, 3:38 AM.

Details

Summary

This is non-functional change to re-order if statements to bail out earlier
from unreachable and ColdCall heuristics.

Diff Detail

Event Timeline

chandlerc added inline comments.Apr 5 2017, 10:59 AM
lib/Analysis/BranchProbabilityInfo.cpp
215–217

Sholud we even get here? should this be in the caller?

348–350

This seems like it should merge into the above if? But my comment about hoisting all of this to the caller still applies. I feel like thes eshould be able to assume there are interesting successor counts.

skatkov updated this revision to Diff 94652.Apr 10 2017, 1:58 AM
skatkov marked 2 inline comments as done.
chandlerc accepted this revision.Apr 10 2017, 2:19 PM

LGTM, seems like a clear improvement in this code. See one nit about the asserts below, but feel free to submit with that addressed.

lib/Analysis/BranchProbabilityInfo.cpp
208

Nit: add a message here and elsewhere. like "expected more than one successor!" to help confirm that the assert isn't a typo or something.

This revision is now accepted and ready to land.Apr 10 2017, 2:19 PM
skatkov updated this revision to Diff 95421.Apr 16 2017, 10:30 PM

Re-base + comment address, will land soon.

This revision was automatically updated to reflect the committed changes.