[LLVMdev] Question about SSA-transformation

Fernando Magno Quintao Pereira fernando at CS.UCLA.EDU
Sat Feb 17 14:51:12 PST 2007


Dear LLVM'ers,

     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)

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:

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

Where one can remove the assignments that use 'V' by placing it directly 
in the phi function, like in:
V = 1000;
if(...) {
     A1 = 1;
     A2 = 2;
}
A3 = phi(V, A1);
A4 = phi(V, A2);

Thanks,

Fernando



More information about the llvm-dev mailing list