[PATCH] D48202: Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 16 15:08:06 PDT 2018


dmgreen added inline comments.


================
Comment at: lib/Transforms/Utils/BasicBlockUtils.cpp:146
   // Can't merge if there are multiple successors.
   if (!OnlySucc) return false;
 
----------------
This and the previous block is just (PredBB->getUniqueSuccessor() == BB)?


================
Comment at: lib/Transforms/Utils/BasicBlockUtils.cpp:173
+      // This successor of BB may already have PredBB as a predecessor.
+      if (llvm::find(predecessors(*I), PredBB) == pred_end(*I))
+        Updates.push_back({DominatorTree::Insert, PredBB, *I});
----------------
I see this comes from the other function, but PredBB should only have one successor (BB), if I am reading this correctly. So this should always be true.


Repository:
  rL LLVM

https://reviews.llvm.org/D48202





More information about the llvm-commits mailing list