------- Comment #6 from dann at godzilla dot ics dot uci dot edu  2006-12-12 
06:07 -------
(In reply to comment #5)
> (In reply to comment #1)
> > Confirmed (but it's not PRE).
> > 

> The second is smaller, and no more or less efficient since the addition is
> calculated on both paths anyway.
> 
> Both are valid results, and what RTL does with them is it's business.
> 
> I don't believe you can claim they should generate identical assembly.
> 
> The actual thing this testcase is trying to test, that load-PRE is performed,
> has succeeded.
> Thus i am closing this bug as WORKSFORME.
> If you see something *actually wrong* with the result, rather than just
> disassembly, please feel free to reopen.

Here is a slightly modified example that shows that there's still a PRE
opportunity 

void motion_test22(int * data, int i)
{
  int j;
  if (data[1]) {
    data[data[2]] = 2;
    j = data[0] *   data[3];
    i = i *  j;
  }
  data[4] = data[0] * data[3];
  data[5] = i;
}

<L0>:;
  *((int *) ((unsigned int) *(data + 8B) * 4) + data) = 2;
  prephitmp.26 = *data;
  prephitmp.31 = *(data + 12B);
  i = prephitmp.26 * i * prephitmp.31;

<L1>:;
  *(data + 16B) = prephitmp.31 * prephitmp.26;
  *(data + 20B) = i;
  return;

There are 3 multiplications on the L0-L1 path. It should be possible
to only have 2 multiplications on that path.


-- 

dann at godzilla dot ics dot uci dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30105

Reply via email to