[LLVMdev] indirectbr and phi instructions

Duncan Sands baldrick at free.fr
Wed Aug 4 03:55:02 PDT 2010


Hi Joshua,

> L4:
>     %ret = phi i8* [%ret1, L2], [%ret2, L3]
>     indirectbr i8* %ret, [label %L5, label %L6]
> L5:
>     %myval = phi i32 [0, %L2], [1, %L3] ; are both of these values
> required, even though the only *real* possible predecessor block is L2?

this phi is wrong because it has entries for L2 and L3 which are not
predecessors, while it has no entry for L4 which is a predecessor.  The
verifier should catch this.

>     ret i32 %myval
> L6:
>     %myval = phi i32 [0, %L2], [1, %L3] ; likewise
>     ret i32 %myval

Likewise.

Ciao,

Duncan.



More information about the llvm-dev mailing list