public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/98909] New: Failure to optimize odd loop pattern
@ 2021-02-01 8:47 gabravier at gmail dot com
2021-02-01 8:54 ` [Bug tree-optimization/98909] " gabravier at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: gabravier at gmail dot com @ 2021-02-01 8:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98909
Bug ID: 98909
Summary: Failure to optimize odd loop pattern
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
bool f(int x)
{
bool odd = false;
while (x > 0) { x--; odd = !odd; }
return odd;
}
This can be optimized to `return (x > 0) && ((x & 1) != 0);`. This
transformation is done by LLVM, but not by GCC.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/98909] Failure to optimize odd loop pattern
2021-02-01 8:47 [Bug tree-optimization/98909] New: Failure to optimize odd loop pattern gabravier at gmail dot com
@ 2021-02-01 8:54 ` gabravier at gmail dot com
2021-02-02 8:10 ` rguenth at gcc dot gnu.org
2021-07-28 21:24 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: gabravier at gmail dot com @ 2021-02-01 8:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98909
--- Comment #1 from Gabriel Ravier <gabravier at gmail dot com> ---
PS: The same pattern with `unsigned` replacing `int` can be optimized to
`return x & 1;` (done by LLVM, but not by GCC).
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/98909] Failure to optimize odd loop pattern
2021-02-01 8:47 [Bug tree-optimization/98909] New: Failure to optimize odd loop pattern gabravier at gmail dot com
2021-02-01 8:54 ` [Bug tree-optimization/98909] " gabravier at gmail dot com
@ 2021-02-02 8:10 ` rguenth at gcc dot gnu.org
2021-07-28 21:24 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-02 8:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98909
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-02-02
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. Final value replacement just uses SCEV.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/98909] Failure to optimize odd loop pattern
2021-02-01 8:47 [Bug tree-optimization/98909] New: Failure to optimize odd loop pattern gabravier at gmail dot com
2021-02-01 8:54 ` [Bug tree-optimization/98909] " gabravier at gmail dot com
2021-02-02 8:10 ` rguenth at gcc dot gnu.org
@ 2021-07-28 21:24 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-28 21:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98909
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-28 21:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 8:47 [Bug tree-optimization/98909] New: Failure to optimize odd loop pattern gabravier at gmail dot com
2021-02-01 8:54 ` [Bug tree-optimization/98909] " gabravier at gmail dot com
2021-02-02 8:10 ` rguenth at gcc dot gnu.org
2021-07-28 21:24 ` 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).