[Bug tree-optimization/89018] common subexpression present in both branches of condition is not factored out

2023-05-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89018
Bug 89018 depends on bug 59424, which changed state.

Bug 59424 Summary: Optimization issue on min/max
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59424

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

[Bug tree-optimization/89018] common subexpression present in both branches of condition is not factored out

2023-04-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89018

--- Comment #3 from Andrew Pinski  ---
I will be submitting a patch for negative_max in the next couple of days.

I get:
  _8 = MAX_EXPR ;
  iftmp.0_1 = -_8;


After phiopt1 after my patches.
The other two are harder though.

[Bug tree-optimization/89018] common subexpression present in both branches of condition is not factored out

2021-11-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89018

Andrew Pinski  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #2 from Andrew Pinski  ---
Mine, I think there are a few other bugs for the same thing.

[Bug tree-optimization/89018] common subexpression present in both branches of condition is not factored out

2019-01-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89018

Richard Biener  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-01-24
 CC||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
fold does/did some of these transforms (not for the call case).  There's
tail merging on GIMPLE and cross-jumping on RTL as well as ifcvt/phiopt
that in theory could handle all cases.

There's also code sinking that could be massaged (like I massaged it
to common stores).  It doesn't really fit very well anywhere though
(phiopt comes closest I think, as "pre"-pass to the other transforms,
emptying the middle blocks as much as possible).

   [local count: 1073741824]:
  if (a_2(D) >= b_3(D))
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 536870913]:
  iftmp.0_4 = -a_2(D);
  goto ; [100.00%]

   [local count: 536870913]:
  iftmp.0_5 = -b_3(D);

   [local count: 1073741824]:
  # iftmp.0_1 = PHI 
  return iftmp.0_1;

..

   [local count: 1073741824]:
  if (a_3(D) >= b_4(D))
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 536870913]:
  iftmp.2_7 = transform (a_3(D));
  goto ; [100.00%]

   [local count: 536870913]:
  iftmp.2_9 = transform (b_4(D));

   [local count: 1073741824]:
  # iftmp.2_1 = PHI 
  return iftmp.2_1;