public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111110] New: (A CMP B) != 0 and (A CMP B) == true patterns produce an extra (A CMP B) rather than reusing it
@ 2023-08-23  5:05 pinskia at gcc dot gnu.org
  2023-08-23  5:06 ` [Bug tree-optimization/111110] " pinskia at gcc dot gnu.org
  2023-08-23 23:16 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-23  5:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111110
           Summary: (A CMP B) != 0 and (A CMP B) == true patterns produce
                    an extra (A CMP B) rather than reusing it
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

(simplify
  (ne (cmp@2 @0 @1) integer_zerop)
  (if (types_match (type, TREE_TYPE (@2)))
   (cmp @0 @1)))
 (simplify
  (eq (cmp@2 @0 @1) integer_truep)
  (if (types_match (type, TREE_TYPE (@2)))
   (cmp @0 @1)))



Those (cmp @0 @1) results really should just be @2 ....

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

* [Bug tree-optimization/111110] (A CMP B) != 0 and (A CMP B) == true patterns produce an extra (A CMP B) rather than reusing it
  2023-08-23  5:05 [Bug tree-optimization/111110] New: (A CMP B) != 0 and (A CMP B) == true patterns produce an extra (A CMP B) rather than reusing it pinskia at gcc dot gnu.org
@ 2023-08-23  5:06 ` pinskia at gcc dot gnu.org
  2023-08-23 23:16 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-23  5:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-08-23
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine. Will test it in the next few days.

I had noticed some extra comparison expressions being made and I wonder if this
was the cause ...

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

* [Bug tree-optimization/111110] (A CMP B) != 0 and (A CMP B) == true patterns produce an extra (A CMP B) rather than reusing it
  2023-08-23  5:05 [Bug tree-optimization/111110] New: (A CMP B) != 0 and (A CMP B) == true patterns produce an extra (A CMP B) rather than reusing it pinskia at gcc dot gnu.org
  2023-08-23  5:06 ` [Bug tree-optimization/111110] " pinskia at gcc dot gnu.org
@ 2023-08-23 23:16 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-23 23:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So this won't work even though it is the right thing to do because when we are
folding `if (a != 1)` and a is defined by a comparison, we want to get back the
comparison.
Now you could say this is problem in how we fold GIMPLE_COND but it is what it
is right now.

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

end of thread, other threads:[~2023-08-23 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23  5:05 [Bug tree-optimization/111110] New: (A CMP B) != 0 and (A CMP B) == true patterns produce an extra (A CMP B) rather than reusing it pinskia at gcc dot gnu.org
2023-08-23  5:06 ` [Bug tree-optimization/111110] " pinskia at gcc dot gnu.org
2023-08-23 23:16 ` 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).