I forgot to cc llvmdev.<br>Here is my original message.<br><br>I'm a bit confused on DominatorTreeBase::Split() (<a href="http://llvm.org/docs/doxygen/html/Dominators_8h_source.html#l00229" target="_blank">http://llvm.org/docs/doxygen/html/Dominators_8h_source.html#l00229</a>)<br>

If a basic block A splits into A->B, when I call Split(), which is NewBB? A or B?<br><br>The semantics shows that NewBB is the newly split basic block B.<br>But the assertion at line 229 doesn't seem right.<br><pre class="fragment">
00229     assert(std::distance(GraphT::child_begin(NewBB),<br><a name="l00230"></a>00230                          GraphT::child_end(NewBB)) == 1 &&<br><a name="l00231"></a>00231            <span class="stringliteral">"NewBB should have a single successor!"</span>);<br>
<br></pre>
If A has 2 successors C, D, after it split to A->NewBB, NewBB should have 2 successors.<br>Hope anyone could explain this to me.<br>Thanks,<br><font color="#888888">Vu</font><br><br><div class="gmail_quote">On Sat, Jan 22, 2011 at 10:28 PM, Vu Le <span dir="ltr"><<a href="mailto:vmle@ucdavis.edu">vmle@ucdavis.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Cameron,<br>I'm a bit confused on DominatorTreeBase::Split() (<a href="http://llvm.org/docs/doxygen/html/Dominators_8h_source.html#l00229" target="_blank">http://llvm.org/docs/doxygen/html/Dominators_8h_source.html#l00229</a>)<br>

If a basic block A splits into A->B, when I call Split(), which is NewBB?<br>A or B.<br>Thanks,<br><font color="#888888">Vu<br><br><br></font><div class="gmail_quote"><div class="im">On Mon, Jan 3, 2011 at 1:25 PM, Cameron Zwarich <span dir="ltr"><<a href="mailto:zwarich@apple.com" target="_blank">zwarich@apple.com</a>></span> wrote:<br>

</div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div>On Dec 31, 2010, at 11:20 AM, Vu Le wrote:<br>

<br>
> There might be a misuse of DominatorTree::splitBasicBlock in CodeExtractor.cpp, line 145.<br>
> Header is splited into two (OldPred->NewBB).<br>
><br>
> Line 145 updates the dominator tree by calling DT->splitBasicBlock(NewBB).<br>
> I think it should be DT->splitBasicBlock(OldPred).<br>
><br>
> When I tried to extract a code region whose header has 2 successors, my pass crashed.<br>
> It was because header (or OldPred) is the block that was splited, not NewBB.<br>
> DominatorTree::splitBasicBlock(BB) requires BB to have one successor.<br>
<br>
<br>
</div></div>The code in Dominator::splitBasicBlock() looks correct, but I think the comment and assert may not be. I was writing a patch where I hit the same issue.<br>
<font color="#888888"><br>
Cameron</font></blockquote></div></div></div><br>
</blockquote></div><br>