public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101815] New: unsigned + -1u > 3 is not optimzied to unsigned > 4 if unsigned range is known not to include 0
@ 2021-08-07 22:33 pinskia at gcc dot gnu.org
  2021-08-07 22:34 ` [Bug tree-optimization/101815] " pinskia at gcc dot gnu.org
  2021-08-07 22:38 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-07 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101815
           Summary: unsigned + -1u > 3 is not optimzied to unsigned > 4 if
                    unsigned range is known not to include 0
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
int f(unsigned int a)
{
  if (a == 0) return 0;
  unsigned int t = a;
  a += 4294967295;
  return a > 3u;
}
int g(unsigned int a)
{
  if (a == 0) __builtin_unreachable();
  unsigned int t = a;
  a += -1;
  return a > 3u;
}

Both of these should produce:
  _7 = a_3(D) > 4;
  # RANGE [0, 1] NONZERO 1
  _4 = (intD.6) _7;

But only f does.
f is able to be optimized in reassoc1.

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

* [Bug tree-optimization/101815] unsigned + -1u > 3 is not optimzied to unsigned > 4 if unsigned range is known not to include 0
  2021-08-07 22:33 [Bug tree-optimization/101815] New: unsigned + -1u > 3 is not optimzied to unsigned > 4 if unsigned range is known not to include 0 pinskia at gcc dot gnu.org
@ 2021-08-07 22:34 ` pinskia at gcc dot gnu.org
  2021-08-07 22:38 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-07 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=50756

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
And yes this actually shows up in real code, mostly with the autovectorizer,
see PR 50756.

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

* [Bug tree-optimization/101815] unsigned + -1u > 3 is not optimzied to unsigned > 4 if unsigned range is known not to include 0
  2021-08-07 22:33 [Bug tree-optimization/101815] New: unsigned + -1u > 3 is not optimzied to unsigned > 4 if unsigned range is known not to include 0 pinskia at gcc dot gnu.org
  2021-08-07 22:34 ` [Bug tree-optimization/101815] " pinskia at gcc dot gnu.org
@ 2021-08-07 22:38 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-07 22:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 27109 :).
This is what I get for not looking up on my own bugs too.

*** This bug has been marked as a duplicate of bug 27109 ***

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

end of thread, other threads:[~2021-08-07 22:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-07 22:33 [Bug tree-optimization/101815] New: unsigned + -1u > 3 is not optimzied to unsigned > 4 if unsigned range is known not to include 0 pinskia at gcc dot gnu.org
2021-08-07 22:34 ` [Bug tree-optimization/101815] " pinskia at gcc dot gnu.org
2021-08-07 22:38 ` 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).