[LLVMdev] [LLVM, loop-unswitch tests] preserve-analyses.ll, strange PHI instruction.

Duncan Sands baldrick at free.fr
Wed Nov 9 00:24:55 PST 2011


Hi Stepan,

> Looking at test/Transforms/LoopUnswitch/preserve-analyses.ll, I found
> improper phi instruction  at string #122:
> %call.i25.lcssa48 = phi i8* [ %call.i25, %if.then31.i.i ], [ %call.i25,
> %if.then31.i.i ] ;<i8*>  [#uses=0]
> Is it trick or mistake?

if there are several edges from a basic block A to a basic block B (because for
example A ends in a conditional branch with both branches leading to B, or A
has a switch with several cases leading to B) then A should occur the same
number of times in any phi node in B, with the restriction that the value
associated with A should be the same each time.  In short, the phi node you
mention looks fine to me because there are two edges from the switch in
%if.then31.i.i to this basic block.

Ciao, Duncan.



More information about the llvm-dev mailing list