[LLVMdev] help with phinode

Jerry Hom jhom at cs.rutgers.edu
Fri Aug 4 17:30:39 PDT 2006


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!

-- 
Jerry Hom




More information about the llvm-dev mailing list