[LLVMdev] PHINode containing itself causes segfault when compiling Blender OpenCL kernel with R600 backend

John Criswell jtcriswel at gmail.com
Tue Sep 23 06:53:25 PDT 2014


On 9/23/14, 5:12 AM, Виталий Филиппов wrote:
> Thanks for the explanation... but does it satisfy SSA? It seems that 
> register gets overwritten more than 1 time when using itself as input? 
> Shouldn't SSA unroll such structures into ones that don't reference 
> itself?

SSA is short for Single *Static* Assignment.  SSA means that there is 
only one instruction that sets the value of a variable.  That 
instruction can be executed multiple times (e.g., it can be in a loop or 
in a function that is called multiple times), but when you look at the 
program statically, the variable is only defined once.

So, to answer your question, yes, the PHINode does satisfy the SSA 
requirements.

>
> And is it the same with LLVM's internal structures (PHINode)? I mean, 
> is PHINode a "register" or just an "expression"? If it's meant to be 
> an expression, then it still looks strange to be recursive, because 
> there's no "previous" value for it to reference...

As with all other LLVM instructions, the instruction ("expression" as 
you call it) and the virtual register it defines are one and the same.

I know it's a bit of a dense read, but you should really look at the 
paper I mentioned in the last email.  That paper explains what SSA is 
and how to put code into SSA form.  It also describes the phi-node in 
some detail.

Regards,

John Criswell

> -- 
> With best regards,
> Vitaliy Filippov 




More information about the llvm-dev mailing list