[PATCH] D43822: [CloneFunction] Support BB == PredBB in DuplicateInstructionsInSplit.

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 07:53:17 PST 2018

anna added inline comments.

Comment at: lib/Transforms/Utils/CloneFunction.cpp:814
   // mapping and using it to remap operands in the cloned instructions.
-  for (; StopAt != &*BI; ++BI) {
+  // Stop once we see the terminator too. This covers the case where BB's
+  // terminator gets replaced and StopAt == BB's terminator.
Basically, StopAt was pointing to the old terminator of BB before it was replaced. `SplitEdge` does not update BB's terminator. So, where exactly, is the update happening for BB's terminator now?

If PredBB == BB, then BB's terminator should be updated from "br i1 <cond> BB, otherBB" to "br i1 <cond> NewBB, otherBB".


More information about the llvm-commits mailing list