Mandatory duplicated incoming nodes on phis

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?

Cheers,
Gary

test.ll (486 Bytes)

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.

-Chris

Chris Lattner wrote: