[LLVMdev] Mandatory duplicated incoming nodes on phis

Chris Lattner clattner at apple.com
Wed Aug 27 20:26:45 PDT 2008

On Aug 27, 2008, at 3:37 AM, Gary Benson wrote:

> Hi,
> I noticed that if you create a switch with multiple cases going to
> the same destination, then if that destination contains phis you
> need to add the incoming value an equivalent number of times.  The
> attached code seems wrong, but it compiles as correct, and removing
> the duplicated incoming node causes an error.  Is this expected?

Hi Gary,

I agree that this is somewhat annoying, but it is required to maintain  
the invariant that a phi node in a block has the same number of  
entries as the block has predecessors.


More information about the llvm-dev mailing list