[PATCH] D23912: [SimplifyCFG] Handle tail-sinking of more than 2 incoming branches

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 16:28:28 PDT 2016


hans added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1463
@@ +1462,3 @@
+  //   if (a) x(1);
+  //   else if (b) x(2);
+  //
----------------
(Ultra nit: I think 'f' is a better name for a random function than 'x' which is more commonly used for variables.)

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1483
@@ +1482,3 @@
+  // phase below) we insert a common successor for all unconditional arcs and
+  // connect that to [end], to enable sinking:
+  //
----------------
Would this scale to larger if-else chains where some subset of them have similar instructions? I assume not because the order of the if-statements makes this hard even if it doesn't really matter for semantics.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1496
@@ +1495,3 @@
+  //
+  SmallVector<BasicBlock*,4> Blocks, AllBlocks;
+  Instruction *Cond = nullptr;
----------------
Maybe call these Predecessors and UnconditionalPredecessors?


Repository:
  rL LLVM

https://reviews.llvm.org/D23912





More information about the llvm-commits mailing list