home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,374 of 2,753   
   sandyasm@gmail.com to All   
   recognition and optimization of prefix c   
   17 Jun 08 01:34:20   
   
   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?   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca