[Bug tree-optimization/85636] Tree if-conversion inserts redundant loads

2021-07-20 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85636

Richard Biener  changed:

   What|Removed |Added

  Known to work||9.1.0
 Resolution|--- |FIXED
  Known to fail||8.5.0
 Status|NEW |RESOLVED

--- Comment #3 from Richard Biener  ---
That's fixed since we run VN over the if-converted body which is GCC 9.

[Bug tree-optimization/85636] Tree if-conversion inserts redundant loads

2021-07-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85636

--- Comment #2 from Andrew Pinski  ---
I don't see this on the trunk:
  _1 = (long unsigned int) i_31;
  _2 = _1 * 4;
  _3 = c_11(D) + _2;
  v_12 = *_3;
  _6 = a_15(D) + _2;
  iftmp.1_8 = v_12 == 20 ? y_13(D) : x_14(D);
  _26 = v_12 != 20 ? y_13(D) : x_14(D);
  *_6 = _26;
  _5 = b_17(D) + _2;
  *_5 = iftmp.1_8;
  i_19 = i_31 + 1;
  ivtmp_28 = ivtmp_23 - 1;

[Bug tree-optimization/85636] Tree if-conversion inserts redundant loads

2018-05-04 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85636

Richard Biener  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-05-04
 CC||rguenth at gcc dot gnu.org
Version|unknown |9.0
Summary|Tree if-conversion inserts  |Tree if-conversion inserts
   |bogus loads |redundant loads
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
I think this is just a missed optimization from the fact that we have two
conditional stores to a[i] before if-conversion.  Those get introduced
by jump-threading which duplicates them when threading the v == 20
controlled paths through the dominated v != 20 condition.

Now - what if-conversion could recognize is that we are dealing with
the same store on each path and avoid the RMW transform it does.
Currently it translates

  if (v_12 == 20)
a[i] = x;
  else
a[i] = y;

as

  a[i] = v_12 == 20 ? x : a[i];
  a[i] = v_12 == 20 ? a[i] : y;

somehow "merging" those conditional stores where that is valid is missing.