recognition and optimization of prefix computation or variants in C/C++ compilers

sandyasm@gmail.com
Tue, 17 Jun 2008 01:34:20 -0700 (PDT)

          From comp.compilers

Related articles
recognition and optimization of prefix computation or variants in C/C+ sandyasm@gmail.com (2008-06-17)
Re: recognition and optimization of prefix computation or variants in gneuner2@comcast.net (George Neuner) (2008-06-18)
Re: recognition and optimization of prefix computation or variants in idbaxter@semdesigns.com (2008-06-21)
Re: recognition and optimization of prefix computation or variants in rcmetzger@grandecom.net (rcmetzger) (2008-06-23)
| List of all articles for this month |
From: sandyasm@gmail.com
Newsgroups: comp.compilers
Date: Tue, 17 Jun 2008 01:34:20 -0700 (PDT)
Organization: Compilers Central
Keywords: optimize, question
Posted-Date: 17 Jun 2008 19:22:16 EDT

Hi,


Does the current C/C++ compilers in industry recognize idioms of the
form of prefix computation and transform them? For instance, given


for (i = 0; i < n; i++)
      for (j = 0; j < i; j++)
                result[i] = result[i] + a[j];




---> transform this to


            result [0] = a[0];
            for (i = 1; i < n; i++)
                      result[i] = result[i-1] + a[i];


If so, under what class of optimizations do they do this?


In the general case, a similar prefix pattern can be identified and
seen in certain search/traversal algorithms also. Do the existing
compilers handle any of those as well?



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.