In case PredBB == BB and StopAt == BB's terminator, StopAt != &*BI will
fail, because BB's terminator instruction gets replaced.
By using BB.getTerminator() we get the current terminator which we can use to compare.
Differential D43822
[CloneFunction] Support BB == PredBB in DuplicateInstructionsInSplit. fhahn on Feb 27 2018, 8:19 AM. Authored by
Details In case PredBB == BB and StopAt == BB's terminator, StopAt != &*BI will By using BB.getTerminator() we get the current terminator which we can use to compare.
Diff Detail Event TimelineComment Actions Just want to make sure if this is the only case where StopAt is changed in the middle ?
Comment Actions AFAIK this is the only case due to how SplitEdge behaves when BB == PredBB. The other instructions should not be moved around while splitting.
|
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".