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: fwprop patch testing


The only big regression for fwprop on PPC is bzip2. I've distilled it to this small testcase:

   int f(int *);
   int verbosity;
   int *arr;
   int last;

   void g ()
   {
      int i;
      if (last < 4000) {
         if (verbosity >= 4) f(&verbosity);
         for (i = 0; i <= last; i++) arr[i] = i;
      }
   }

where CSE previously was performing load PRE. So, actually this regression is caused by -fno-cse-skip-blocks rather than deleting parts of fwprop. Note that this can be performed on the GIMPLE-level only to some extent. What we are looking for is the following pseudo-C:

   void g ()
   {
      int i;
      int *plast = &last;
      int mylast = *plast;
      if (mylast < 4000) {
        if (verbosity >= 4) f(&verbosity);
        i = 0;
        mylast = *plast;
        while (i <= mylast)
          {
             arr[i] = i;
             /* Note the unfortunate aliasing between arr and plast */
             mylast = *plast;
          }
      }
   }

And tree-based load PRE can only get to

   void g ()
   {
      int i;
      int *plast = &last;
      int mylast = *plast;
      if (mylast < 4000) {
        if (verbosity >= 4) f(&verbosity);
        i = 0;
        plast = &last;      /* redundant */
        mylast = *plast;
        while (i <= mylast)
          {
             arr[i] = i;
             plast = &last;    /* redundant, and very expensive! */
             mylast = *plast;
          }
      }
}

since the "plast" lowering is obviously happening during expand.

I have not yet looked at whether it is possible to teach fwprop about this case, but I am not sure it is possible (I'm more inclined to think that it is simply not fwprop's job). Right now, I am thinking more about shuffling the pass order. One possibility that comes to mind is GCSE+fwprop+CSE, where GCSE could work out the common code for loading the address, and fwprop/CSE could do the addressing mode selection properly.

On one hand, this may mean increasing the number of GCSE passes from 1 to 2. On the other hand, it may mean that the CSE pass at the hand of rest_of_handle_gcse could become redundant.

Paolo


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