https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104950

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot 
gnu.org
             Status|NEW                         |ASSIGNED
         Depends on|                            |125896
          Component|rtl-optimization            |tree-optimization

--- Comment #7 from Drea Pinski <pinskia at gcc dot gnu.org> ---
-O2 we have:
```
  if (_51 < _52)
    goto <bb 7>; [50.00%]
  else
    goto <bb 6>; [50.00%]

  <bb 6> [local count: 536870912]:
  # VUSE <.MEM_8(D)>
  _49 = MEM[(const struct Node *)_57].l;
  goto <bb 8>; [100.00%]

  <bb 7> [local count: 536870912]:
  # VUSE <.MEM_8(D)>
  _50 = MEM[(const struct Node *)_57].r;

  <bb 8> [local count: 1073741824]:
  # _48 = PHI <_50(7), _49(6)>
```
-O3 is messed up do to split paths too.

Note in the reduced testcase in comment #1 we can hoist the loads too:
Hoisting adjacent loads from 4 and 3 into 2: 
# VUSE <.MEM_3(D)>
_5 = a_4(D)->l;
# VUSE <.MEM_3(D)>
_6 = a_4(D)->r;

So I need to look into why we can do it for that but not for the original case.

(In reply to Hongtao.liu from comment #4) 
> Not for this one
> 
> float
> foo (float a, float b, float *c, int i, int j)
> {
>     return a > b ? c[i] : c[j];
> }

That is handled on the trunk already.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125896
[Bug 125896] load common does not support non-only MEM_REF-refences

Reply via email to