On Sun, Feb 10, 2013 at 11:45 AM, Andrey Belevantsev <a...@ispras.ru> wrote: > Hi Kartik, > > > On Sun, 10 Feb 2013 15:41:17 +0530, Kartik Singhal <kartiksing...@gmail.com> > wrote: >> >> Thanks Richard for pointing out tree-ssa-sccvn.c >> >> On Wed, Feb 6, 2013 at 8:14 PM, Richard Biener >> <richard.guent...@gmail.com> wrote: >>> >>> >>> Well, to ignore SSA form simply treat each SSA name as separate variable. >>> You of course need to handle PHI nodes as copies on CFG edges then. >> >> >> I am not sure if I understood this correctly. >> >> Consider the following example: >> >> if (...) >> a_1 = 5; >> else if (...) >> a_2 = 2; >> else >> a_3 = 13; >> >> # a_4 = PHI <a_1, a_2, a_3> >> return a_4; >> >> Do you mean that I treat a_1, a_2 and a_3 as 3 different variables? In >> this approach, I lose the information that they are actually the same >> variables. >> >> Or should I write a mini lexer function to convert the SSA names into >> original variable names by removing _1, _2, etc. as suffix from each? >> >> Regarding PHI nodes, I think you mean, I should treat them as identity >> functions, but I am not clear exactly how in the first approach above. >> In second, I can just treat it as a=a. > > > Richard means that you can treat the above code as > > > if (...) { > a_1 = 5; > a_4 = a_1; > > } else if (...) { > a_2 = 2; > a_4 = a_2; > } else { > a_3 = 13; > a_4 = a_3; > } > return a_4; > > The extra code above is "copies on CFG edges".
Yes. And of course the various a_* are not "the same variable" - they may have overlapping lifetimes, so an assign to a_2 does not kill a_1. Richard. > Andrey > >> >> >> >> -- >> Kartik >> http://k4rtik.wordpress.com/