[PATCH] D19550: [InstCombine] Determine the result of a select based on a dominating condition.

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 13:37:42 PDT 2016


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

LGTM w/optional minor comment.


================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:1219
@@ +1218,3 @@
+  BasicBlock *Parent = SI.getParent();
+  BasicBlock *Dom = Parent->getSinglePredecessor();
+  auto *PBI =
----------------
Minor, but this would be easier to read as:
if (BasicBlock *Dom = Parent->getSinglePredecessor()) {
  auto *PBI = dyn_cast<BranchInst>(Dom->getTerminator());
  if (PBI && PBI->isConditional() &&
      PBI->getSuccessor(0) != PBI->getSuccessor(1) &&
      (PBI->getSuccessor(0) == Parent || PBI->getSuccessor(1) == Parent)) {


http://reviews.llvm.org/D19550





More information about the llvm-commits mailing list