[PATCH] D31704: [BPI] NFC: reorder ifs to bail out earlier

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 14:19:11 PDT 2017


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

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



================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:208
   const TerminatorInst *TI = BB->getTerminator();
-  if (TI->getNumSuccessors() == 0)
+  assert(TI->getNumSuccessors() > 1);
+
----------------
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.


https://reviews.llvm.org/D31704





More information about the llvm-commits mailing list