public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109702] New: [14 Regression] Wrong code with if and __builtin_bswap and others
@ 2023-05-02 17:33 pinskia at gcc dot gnu.org
  2023-05-02 17:34 ` [Bug tree-optimization/109702] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-02 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109702
           Summary: [14 Regression] Wrong code with if and __builtin_bswap
                    and others
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

I totally messed up the match.pd patterns such that we start to transform:
```
unsigned f(unsigned t, unsigned t1)
{
  if (t != 0)
    return __builtin_bswap32(t1);
  return 0;
}
```
To just `return __builtin_bswap32(t1)` . I only noticed this after the review
of the patch for CLRSB
(https://gcc.gnu.org/pipermail/gcc-patches/2023-May/617228.html ) but the
review didn't fully notice how it was incorrect; just noticed there was an
unused capture.

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

* [Bug tree-optimization/109702] [14 Regression] Wrong code with if and __builtin_bswap and others
  2023-05-02 17:33 [Bug tree-optimization/109702] New: [14 Regression] Wrong code with if and __builtin_bswap and others pinskia at gcc dot gnu.org
@ 2023-05-02 17:34 ` pinskia at gcc dot gnu.org
  2023-05-02 21:47 ` cvs-commit at gcc dot gnu.org
  2023-05-02 22:05 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-02 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-05-02
   Target Milestone|---                         |14.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine, I am going to commit a patch to fix this obvious issue later today, just
filing it so I have a testcase of what goes wrong.

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

* [Bug tree-optimization/109702] [14 Regression] Wrong code with if and __builtin_bswap and others
  2023-05-02 17:33 [Bug tree-optimization/109702] New: [14 Regression] Wrong code with if and __builtin_bswap and others pinskia at gcc dot gnu.org
  2023-05-02 17:34 ` [Bug tree-optimization/109702] " pinskia at gcc dot gnu.org
@ 2023-05-02 21:47 ` cvs-commit at gcc dot gnu.org
  2023-05-02 22:05 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:8702ab1456eee07d07ac1a8bc005c690cf6dbcf0

commit r14-413-g8702ab1456eee07d07ac1a8bc005c690cf6dbcf0
Author: Andrew Pinski <apinski@marvell.com>
Date:   Tue May 2 11:03:02 2023 -0700

    tree-optimization: [PR109702] MATCH: Fix a ? func(a) : N patterns

    I accidently messed up these patterns so the comparison
    against 0 and the arguments was not matching up when they
    need to be.

    I committed this as obvious after a bootstrap/test on x86_64-linux-gnu

            PR tree-optimization/109702

    gcc/ChangeLog:

            * match.pd: Fix "a != 0 ? FUNC(a) : CST" patterns
            for FUNC of POPCOUNT BSWAP FFS PARITY CLZ and CTZ.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/phi-opt-25b.c: New test.

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

* [Bug tree-optimization/109702] [14 Regression] Wrong code with if and __builtin_bswap and others
  2023-05-02 17:33 [Bug tree-optimization/109702] New: [14 Regression] Wrong code with if and __builtin_bswap and others pinskia at gcc dot gnu.org
  2023-05-02 17:34 ` [Bug tree-optimization/109702] " pinskia at gcc dot gnu.org
  2023-05-02 21:47 ` cvs-commit at gcc dot gnu.org
@ 2023-05-02 22:05 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-02 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-05-02 22:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02 17:33 [Bug tree-optimization/109702] New: [14 Regression] Wrong code with if and __builtin_bswap and others pinskia at gcc dot gnu.org
2023-05-02 17:34 ` [Bug tree-optimization/109702] " pinskia at gcc dot gnu.org
2023-05-02 21:47 ` cvs-commit at gcc dot gnu.org
2023-05-02 22:05 ` 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).