[PATCH] D41361: [SimplifyCFG] Avoid quadratic on a predecessors number behavior in instruction sinking.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 18:49:06 PST 2017


efriedma added a comment.

> test/CodeGen/AArch64/arm64-jumptable.ll - changes in this test mimic the changes that previous implementation of SimplifyCFG would do.

With your patch, what transform do we perform here instead of sinking?  As far as I can tell, SimplifyCFG doesn't make any other changes.



================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1657
 
-/// Given an unconditional branch that goes to BBEnd,
-/// check whether BBEnd has only two predecessors and the other predecessor
-/// ends with an unconditional branch. If it is true, sink any common code
-/// in the two predecessors to BBEnd.
-static bool SinkThenElseCodeToEnd(BranchInst *BI1) {
-  assert(BI1->isUnconditional());
-  BasicBlock *BBEnd = BI1->getSuccessor(0);
-
+/// Check whether BB's presecessors end with unconditional branches. If it is
+/// true, sink any common code from the predecessors to BB.
----------------
*predecessors


https://reviews.llvm.org/D41361





More information about the llvm-commits mailing list