public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113187] New: `(X & C1) | C2` Simplifies to `A & (C1 | C2)` iff `(A & C2) == C2`
@ 2024-01-01 9:15 pinskia at gcc dot gnu.org
2024-01-01 9:16 ` [Bug tree-optimization/113187] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-01 9:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113187
Bug ID: 113187
Summary: `(X & C1) | C2` Simplifies to `A & (C1 | C2)` iff `(A
& C2) == C2`
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
int f(int X)
{
int C1 = 0x1;
int C2 = 0x2;
if ((X & C2) != C2)
__builtin_unreachable();
return (X & C1) | C2;
}
```
This should be optimized to just `return X & 3;` as `X&0x2` is known to be
already 0x2.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/113187] `(X & C1) | C2` Simplifies to `A & (C1 | C2)` iff `(A & C2) == C2`
2024-01-01 9:15 [Bug tree-optimization/113187] New: `(X & C1) | C2` Simplifies to `A & (C1 | C2)` iff `(A & C2) == C2` pinskia at gcc dot gnu.org
@ 2024-01-01 9:16 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-01 9:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113187
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-01 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-01 9:15 [Bug tree-optimization/113187] New: `(X & C1) | C2` Simplifies to `A & (C1 | C2)` iff `(A & C2) == C2` pinskia at gcc dot gnu.org
2024-01-01 9:16 ` [Bug tree-optimization/113187] " 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).