public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y
       [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/>
@ 2021-06-03  2:43 ` pinskia at gcc dot gnu.org
  2023-05-05  8:17 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-03  2:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2012-01-04 00:00:00         |2021-6-2

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed again.
So looking at the IR, it took until PHI-OPT4 to be able to convert it into:
  <bb 2> [local count: 1073741824]:
  if (x_3(D) != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870913]:
  _1 = x_3(D) & 85;
  _5 = _1 != 0;
  _6 = (int) _5;

  <bb 4> [local count: 1073741824]:
  # iftmp.0_2 = PHI <_6(3), 0(2)>

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

* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y
       [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/>
  2021-06-03  2:43 ` [Bug tree-optimization/27504] x && (x & y) not optimized to x & y pinskia at gcc dot gnu.org
@ 2023-05-05  8:17 ` pinskia at gcc dot gnu.org
  2023-10-12 17:56 ` pinskia at gcc dot gnu.org
  2023-10-12 18:00 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-05  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> Confirmed again.
> So looking at the IR, it took until PHI-OPT4 to be able to convert it into:
>   <bb 2> [local count: 1073741824]:
>   if (x_3(D) != 0)
>     goto <bb 3>; [50.00%]
>   else
>     goto <bb 4>; [50.00%]
> 
>   <bb 3> [local count: 536870913]:
>   _1 = x_3(D) & 85;
>   _5 = _1 != 0;
>   _6 = (int) _5;
> 
>   <bb 4> [local count: 1073741824]:
>   # iftmp.0_2 = PHI <_6(3), 0(2)>

In GCC 12+, phiopt2 is able to convert that into the above.

One thing that could be tried is to replace x_3 with 0 and see if _6 would
simplify down to 0 (other the phi argument). This could be part of phiopt but
would need a lot of work really.

Note VRP is able to handle the other way around already:
that is: `(x & 0x55) && x ` But that is simplier.

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

* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y
       [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/>
  2021-06-03  2:43 ` [Bug tree-optimization/27504] x && (x & y) not optimized to x & y pinskia at gcc dot gnu.org
  2023-05-05  8:17 ` pinskia at gcc dot gnu.org
@ 2023-10-12 17:56 ` pinskia at gcc dot gnu.org
  2023-10-12 18:00 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-12 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

Bug 88280 comment #5 fixes part of the issue. The secondary issue is ifcombine
does not do the combining to get that point.

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

* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y
       [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-10-12 17:56 ` pinskia at gcc dot gnu.org
@ 2023-10-12 18:00 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-12 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note also there are other bugs associated with similar ifcombine issue (besides
this one and PR 88280 ). I don't know if I will get to that part until next
year though.

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

* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y
  2006-05-08 19:28 [Bug tree-optimization/27504] New: " falk at debian dot org
  2006-05-09  6:20 ` [Bug tree-optimization/27504] " pinskia at gcc dot gnu dot org
@ 2006-05-09  8:36 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-09  8:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-05-09 08:36 -------
It get's a little complicated as fold gets

 (xD.1520 != 0) && ((xD.1520 & 85) != 0)

from the frontend.


-- 


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


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

* [Bug tree-optimization/27504] x && (x & y) not optimized to x & y
  2006-05-08 19:28 [Bug tree-optimization/27504] New: " falk at debian dot org
@ 2006-05-09  6:20 ` pinskia at gcc dot gnu dot org
  2006-05-09  8:36 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-09  6:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-05-09 06:20 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-09 06:20:01
               date|                            |


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


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

end of thread, other threads:[~2023-10-12 18:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-27504-4@http.gcc.gnu.org/bugzilla/>
2021-06-03  2:43 ` [Bug tree-optimization/27504] x && (x & y) not optimized to x & y pinskia at gcc dot gnu.org
2023-05-05  8:17 ` pinskia at gcc dot gnu.org
2023-10-12 17:56 ` pinskia at gcc dot gnu.org
2023-10-12 18:00 ` pinskia at gcc dot gnu.org
2006-05-08 19:28 [Bug tree-optimization/27504] New: " falk at debian dot org
2006-05-09  6:20 ` [Bug tree-optimization/27504] " pinskia at gcc dot gnu dot org
2006-05-09  8:36 ` rguenth 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).