public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64450] New: Optimize   0>=p-q   to   q>=p   for char*p,*q;
@ 2014-12-30 20:58 gcc-bugzilla at contacts dot eelis.net
  2014-12-30 20:59 ` [Bug c++/64450] " ville.voutilainen at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gcc-bugzilla at contacts dot eelis.net @ 2014-12-30 20:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64450
           Summary: Optimize   0>=p-q   to   q>=p   for char*p,*q;
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugzilla at contacts dot eelis.net

Created attachment 34365
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34365&action=edit
Testcase

It was noticed that Boost's iterator_facade incurred a performance penalty
(while it should ideally be zero-overhead), which results from the fact that
GCC does not optimize   0>=p-q  to  q>=p  for char*p,*q;. See attachment.

This probably applies to > and < and <= as well.


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

* [Bug c++/64450] Optimize   0>=p-q   to   q>=p   for char*p,*q;
  2014-12-30 20:58 [Bug c++/64450] New: Optimize 0>=p-q to q>=p for char*p,*q; gcc-bugzilla at contacts dot eelis.net
@ 2014-12-30 20:59 ` ville.voutilainen at gmail dot com
  2014-12-30 21:36 ` [Bug tree-optimization/64450] " glisse at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-30 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-30
                 CC|                            |ville.voutilainen at gmail dot com
     Ever confirmed|0                           |1


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

* [Bug tree-optimization/64450] Optimize   0>=p-q   to   q>=p   for char*p,*q;
  2014-12-30 20:58 [Bug c++/64450] New: Optimize 0>=p-q to q>=p for char*p,*q; gcc-bugzilla at contacts dot eelis.net
  2014-12-30 20:59 ` [Bug c++/64450] " ville.voutilainen at gmail dot com
@ 2014-12-30 21:36 ` glisse at gcc dot gnu.org
  2014-12-30 21:38 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-12-30 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
See also PR61734, Eric already tried in May.


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

* [Bug tree-optimization/64450] Optimize   0>=p-q   to   q>=p   for char*p,*q;
  2014-12-30 20:58 [Bug c++/64450] New: Optimize 0>=p-q to q>=p for char*p,*q; gcc-bugzilla at contacts dot eelis.net
  2014-12-30 20:59 ` [Bug c++/64450] " ville.voutilainen at gmail dot com
  2014-12-30 21:36 ` [Bug tree-optimization/64450] " glisse at gcc dot gnu.org
@ 2014-12-30 21:38 ` pinskia at gcc dot gnu.org
  2023-05-14 23:20 ` pinskia at gcc dot gnu.org
  2023-10-23 15:20 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-12-30 21:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #1)
> See also PR61734, Eric already tried in May.

Maybe it is easier to handle now with simplify-and-match.


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

* [Bug tree-optimization/64450] Optimize   0>=p-q   to   q>=p   for char*p,*q;
  2014-12-30 20:58 [Bug c++/64450] New: Optimize 0>=p-q to q>=p for char*p,*q; gcc-bugzilla at contacts dot eelis.net
                   ` (2 preceding siblings ...)
  2014-12-30 21:38 ` pinskia at gcc dot gnu.org
@ 2023-05-14 23:20 ` pinskia at gcc dot gnu.org
  2023-10-23 15:20 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-14 23:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(for cmp (tcc_comparison)
 (simplify
  (cmp (pointer_diff @0 @1) integer_zero_p)
  (cmp @0 @1)))

Maybe ....

But we might also need handle the match patterns for too:
A CMP B ? A - B : -(A - B)
A CMP B ? A - B : B - A

(which is also on my todo list anyways).

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

* [Bug tree-optimization/64450] Optimize   0>=p-q   to   q>=p   for char*p,*q;
  2014-12-30 20:58 [Bug c++/64450] New: Optimize 0>=p-q to q>=p for char*p,*q; gcc-bugzilla at contacts dot eelis.net
                   ` (3 preceding siblings ...)
  2023-05-14 23:20 ` pinskia at gcc dot gnu.org
@ 2023-10-23 15:20 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-23 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine ...

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

end of thread, other threads:[~2023-10-23 15:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-30 20:58 [Bug c++/64450] New: Optimize 0>=p-q to q>=p for char*p,*q; gcc-bugzilla at contacts dot eelis.net
2014-12-30 20:59 ` [Bug c++/64450] " ville.voutilainen at gmail dot com
2014-12-30 21:36 ` [Bug tree-optimization/64450] " glisse at gcc dot gnu.org
2014-12-30 21:38 ` pinskia at gcc dot gnu.org
2023-05-14 23:20 ` pinskia at gcc dot gnu.org
2023-10-23 15:20 ` pinskia at gcc dot gnu.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).