[LLVMdev] Problem in CodeExtractor::severSplitPHINodes()

Devang Patel dpatel at apple.com
Wed Nov 19 16:41:24 PST 2008

On Nov 19, 2008, at 7:41 AM, Jack Tzu-Han Hung wrote:

> Hi,
> I found a problem in CodeExtractor::severSplitPHINodes()  
> <CodeExtractor.cpp>.
> 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.
> if (DT)
>     DT->splitBlock(NewBB);
> 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.

DT->splitBlock() updates dominator information _after_ the block is  
split. The comments in header says,

   /// splitBlock - BB is split and now it has one successor. Update  
   /// frontier to reflect this change.
   void splitBlock(BasicBlock *BB);

Immediately after the split the NewBB can have only one successor.

> Could anyone tell me how to fix this please?
> Thanks a lot.
> Jack
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081119/3fc155ff/attachment.html>

More information about the llvm-dev mailing list