Hi Devang,<br><br>Thanks for your reply.<br><br>But if you look at the comment of BasicBlock::splitBasicBlock(), it says that "...an unconditional branch is added to the new BB, and the rest of the instructions in the BB are moved to the newBB, including the old terminator."<br>
<br>So, the terminator of the newBB is exactly the same as the terminator of the oldBB. IF the oldBB has multiple successors, then newBB will have multiple successors.<br><br>Actually there is an example for this (in "wc", the word count program):<br>
<br>for (gotsp = 1; len = read(fd, buf, MAXBSIZE);){<br> if (len == -1) {<br> perror(file);<br> exit(1);<br> }<br> // do other stuff<br>}<br><br>Compiled with llvm-gcc -O1, the loop header has three successors: one to inside the loop, one to outside the loop, and the third to a block that contains exit(1).<br>
<br>ExtractLoop() has problem with this this example.<br><br>Thanks a lot.<br><br>Jack<br><br><br><br><br><div class="gmail_quote">On Wed, Nov 19, 2008 at 7:41 PM, Devang Patel <span dir="ltr"><<a href="mailto:dpatel@apple.com">dpatel@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style=""><br><div><div><div></div><div class="Wj3C7c"><div>On Nov 19, 2008, at 7:41 AM, Jack Tzu-Han Hung wrote:</div>
<br><blockquote type="cite">Hi,<br><br>I found a problem in CodeExtractor::severSplitPHINodes() <CodeExtractor.cpp>.<br><br>The algorithm first separates the header block into two, one containing only PHI nodes and the other containing the remaining non-PHI nodes. The variable NewBB holds the pointer to the latter half block. Later, it tries to update DT information.<br>
<br>if (DT)<br> DT->splitBlock(NewBB);<br><br>In splitBlock, it checks if the NewBB has only one successor. I'm not sure why this is required, but it will fail on cases where NewBB has multiple successors, which are pretty common. For example, a switch or a conditional branch in NewBB can break this check.</blockquote>
<div><br></div></div></div>DT->splitBlock() updates dominator information _after_ the block is split. The comments in header says,</div><div><br></div><div><div> /// splitBlock - BB is split and now it has one successor. Update dominance </div>
<div> /// frontier to reflect this change. </div><div>
void splitBlock(BasicBlock *BB);</div><div><br></div><div>Immediately after the split the NewBB can have only one successor.</div><div><br></div><blockquote type="cite"><div class="Ih2E3d"><br> <br>Could anyone tell me how to fix this please?<br>
<br>Thanks a lot.<br><br>Jack<br><br></div> _______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br><div> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="">
<div>-</div><div>Devang</div><div><br></div></div></span><br> </div><br></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Jack Tzu-Han Hung<br><a href="http://www.cs.princeton.edu/~thhung">www.cs.princeton.edu/~thhung</a><br>