This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Global Value Numbering and dependence on SSA in GCC


Hi Kartik,

On Sun, 10 Feb 2013 15:41:17 +0530, Kartik Singhal <kartiksinghal@gmail.com> wrote:
Thanks Richard for pointing out tree-ssa-sccvn.c

On Wed, Feb 6, 2013 at 8:14 PM, Richard Biener
<richard.guenther@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".

Andrey




-- Kartik http://k4rtik.wordpress.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]