[LLVMdev] help with phinode

Devang Patel dpatel at apple.com
Mon Aug 7 09:33:29 PDT 2006


On Aug 4, 2006, at 5:30 PM, Jerry Hom wrote:

>
> I'm running into an error message about PHINode which I don't
> understand too well.  Hopefully I can explain this clearly.
>
> At a high level, I'm just trying to add a fprintf() statement at the
> end of functions to show me a timestamp.  However, I also add an
> if/then such that I can turn the printing on/off.  When using
> llvm-gcc, I've disabled linker and assembler optimizations in order to
> get a single exit basic block.  I use splitBasicBlock() to split this
> BB into 3 parts: 1) my if/then blocks; 2) endif target block whose
> only instruction is unconditional branch to last block; 3) essentially
> the original BB.
>
> I'm getting the following error message:
> ============================================================
> PHINode should have one entry for each predecessor of its parent  
> basic block!
>         %Count.0.1 = phi uint [ 0, %entry ], [ %inc.0, %no_exit ] ;  
> <uint> [#uses=1]
> Broken module found, compilation aborted!
> ============================================================
>
> Can someone explain what I'm doing wrong?  Thanks!

Do you know,  which basic block contains this phi node ?
This phi node has two arguments so its parent basic block must have  
exactly
two predecessors, one for each entry. The error messages says
that this is not the case.

-
Devang



More information about the llvm-dev mailing list