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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |12.1.0
            Summary|store motion if-change flag |[13/14/15/16/17 Regression]
                   |causes if-conversion        |store motion if-change flag
                   |optimization can't be       |causes if-conversion
                   |taken.                      |optimization can't be
                   |                            |taken.
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |17.0
      Known to work|                            |11.4.0
         Resolution|---                         |FIXED

--- Comment #15 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Phiopt1 now creates (at -Ofast):

  atemp.0_5 = atemp;
  _8 = MIN_EXPR <_4, atemp.0_5>;
  MEM <double> [(void *)&atemp] = _8;


After
https://gcc.gnu.org/cgit/gcc/commit/?id=eb8011467d0ce70cae098a88569a0c8a5b7f5683
https://gcc.gnu.org/cgit/gcc/commit/?id=fd3e590360dc4f479e69142ed1bd6775c07213b6

lim2 gives:
```
  if (n_12(D) > 0)
    goto <bb 5>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 5> [local count: 105119324]:
  atemp__lsm.4_7 = MEM <double> [(void *)&atemp];

  <bb 3> [local count: 955630224]:
  # i_19 = PHI <i_16(6), 0(5)>
  # atemp__lsm.4_9 = PHI <atemp__lsm.4_18(6), atemp__lsm.4_7(5)>
  _1 = (long unsigned int) i_19;
  _2 = _1 * 8;
  _3 = a_15(D) + _2;
  _4 = *_3;
  atemp.0_5 = atemp__lsm.4_9;
  _6 = MIN_EXPR <_4, atemp.0_5>;
  atemp__lsm.4_18 = _6;
  i_16 = i_19 + 1;
  if (n_12(D) > i_16)
    goto <bb 6>; [89.00%]
  else
    goto <bb 7>; [11.00%]

  <bb 6> [local count: 850510900]:
  goto <bb 3>; [100.00%]

  <bb 7> [local count: 105119324]:
  # atemp__lsm.4_22 = PHI <atemp__lsm.4_18(3)>
  MEM <double> [(void *)&atemp] = atemp__lsm.4_22;

  <bb 4> [local count: 118111600]:
  bar (&atemp, n_12(D));
  atemp ={v} {CLOBBER(eos)};
  return;
```

This is now vectorized too. Which it was not before except pre GCC 12 when
CSELIM didn't handle the decl. 

So this was fixed by those 2 patches.  Basically the load before the condition
allows to reuse the value and lim2 can do store motion (for -Ofast).

Reply via email to