help with phinode

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:

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.