public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/32226] Missed optimization caused by copy loop header (yes a weird case)
       [not found] <bug-32226-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-26  5:18 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26  5:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
To do this optimization (the reduced testcase works right now), you have to
simulate each statement until the end with "width_5 == 0" (the opposite range
of the initial condition) to see if get the other phi operand.

  if (width_5(D) != 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 3> [local count: 105119325]:
  _1 = (long unsigned int) dir_8(D);
  _3 = width_5(D) + 4294967295;
  _14 = (sizetype) _3;
  _6 = _14 + 1;
  _17 = _1 * _6;
  _18 = _17 * 2;
  errorptr_4 = errorptr_7(D) + _18;

  <bb 4> [local count: 118111601]:
  # errorptr_16 = PHI <errorptr_4(3), errorptr_7(D)(2)>


I don't know if this optimization is that important, even clang does not do it.
It should most likely be only done if the branch is highly predicted taken down
the route of the longer path.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/32226] Missed optimization caused by copy loop header (yes a weird case)
  2007-06-05 21:47 [Bug tree-optimization/32226] New: " pinskia at gcc dot gnu dot org
  2007-06-05 22:01 ` [Bug tree-optimization/32226] " rguenth at gcc dot gnu dot org
@ 2009-04-22 21:32 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-22 21:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-04-22 21:32 -------
Actually this comes down to:
int f(int a, int c)
{
  if (a) return a*c;
  return 0;
}

It might be faster to use the branch rather than the multiple, I don't know and
I think it depends on the target.


-- 


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/32226] Missed optimization caused by copy loop header (yes a weird case)
  2007-06-05 21:47 [Bug tree-optimization/32226] New: " pinskia at gcc dot gnu dot org
@ 2007-06-05 22:01 ` rguenth at gcc dot gnu dot org
  2009-04-22 21:32 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-06-05 22:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-06-05 22:01 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-05 22:01:22
               date|                            |


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-26  5:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-32226-4@http.gcc.gnu.org/bugzilla/>
2021-07-26  5:18 ` [Bug tree-optimization/32226] Missed optimization caused by copy loop header (yes a weird case) pinskia at gcc dot gnu.org
2007-06-05 21:47 [Bug tree-optimization/32226] New: " pinskia at gcc dot gnu dot org
2007-06-05 22:01 ` [Bug tree-optimization/32226] " rguenth at gcc dot gnu dot org
2009-04-22 21:32 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).