[LLVMdev] Question about SSA-transformation

Chris Lattner sabre at nondot.org
Mon Feb 19 15:43:20 PST 2007


On Sat, 17 Feb 2007, Fernando Magno Quintao Pereira wrote:
>     I'm producing code for the PowerPC, and many often times it happens
> that the bytecodes generated by LLVM have phi-functions like:
>
> A4 = phi(A1, A2)
> A5 = phi(A1, A3)

ok

> Where the 'A1' parameter appears in two different phi-functions. Could
> someone give me an example in "pseudo-assembly" that would produce code
> like that after being transformed into SSA form? Does it happen because of
> some optimization, like in:

Right, SSA construction with copy propagation (which we do, because 
llvm has no copy instruction) can cause this.

> V = 1000;
> if(...) {
>     A1 = 1;
>     A2 = 2;
> } else {
>     A1 = V;
>     A2 = V;
> }
> use(A1);
> use(A2);

Yep, exactly.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list