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

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 14:43:47 PDT 2016


hans added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1497
@@ +1496,3 @@
+  //
+  SmallVector<BasicBlock*,4> UnconditionalPreds, Preds;
+  Instruction *Cond = nullptr;
----------------
Actually, is Preds even used after it's been populated?

If not, maybe this is all we need:

  SmallVector<BasicBlock *, 4> UnconditionalPreds;
  Instruction *ConditionalPred = nullptr;

and the logic in the for loop could be simplified a little:

  if (T is unconditional)
    push to UnconditionalPreds
  else if (T is conditional && !ConditionalPred)
    set ConditionalPred
  else
    bail out


Repository:
  rL LLVM

https://reviews.llvm.org/D23912





More information about the llvm-commits mailing list