PHI inst has two exact the same operands?

Dear there,

Is the following phi instruction valid?

%j_8 = phi i32 [ %j_100, %"<bb 13>" ], [ %j_9133, %"<bb 10>" ], [
%j_9133, %"<bb 9>" ]

Variable %j_9133 is in bb 9.

And also this one:

%D.1898_8.i = phi i32 [ %D.1898_27.i, %"<bb 18>.i" ], [ -1, %"<bb 23>" ],
[ %D.1776_193, %"<bb 4>], [ %D.1776_193, %"<bb 4>], [ %l_5.lcssa.i,
%"<bb 17>.i" ]

It has two identical operands.
Are they valid llvm instructions? I am hacking a infrastructure which
generates these IR. I was wondering if I should make my tool support
this or somehow manage to resolve this situation.


yes, this is valid assuming bb9 dominates bb10.
Not sure what you mean by “support this”, unless your tool doesn’t handle certain types of CFG’s

I guess my tool does not support this type of CFG at this point. Thanks Daniel.