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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 01:37:04 PST 2018


fhahn added a comment.

In https://reviews.llvm.org/D43822#1020933, @junbuml wrote:

> Just want to make sure if this is the only case where StopAt is changed in the middle ?


AFAIK this is the only case due to how SplitEdge behaves when BB == PredBB. The other instructions should not be moved around while splitting.



================
Comment at: lib/Transforms/Utils/CloneFunction.cpp:816
+  // terminator gets replaced and StopAt == BB's terminator.
+  for (; StopAt != &*BI && BB->getTerminator() != &*BI; ++BI) {
     Instruction *New = BI->clone();
----------------
junbuml wrote:
> Since StopAt is Instruction*, this function cannot clone the terminator itself. We can clone up to one instruction before the terminator. Curious if this is what this function was initially intended.  
Not sure in which cases it would make sense to clone the terminator, as the New BB needs it's own terminator  to branch to BB.


https://reviews.llvm.org/D43822





More information about the llvm-commits mailing list