public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked @ 2022-09-27 15:24 pinskia at gcc dot gnu.org 2022-09-27 15:24 ` [Bug tree-optimization/107053] " pinskia at gcc dot gnu.org ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-09-27 15:24 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053 Bug ID: 107053 Summary: ones bits is not tracked and popcount is not tracked Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` void link_failure(); void f(int a) { a |= 0x300; int b = __builtin_popcount(a); if (b < 3) link_failure(); } ``` The if statement should be optimized away. The reason is after the |, at least 3 bits are set in a. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/107053] ones bits is not tracked and popcount is not tracked 2022-09-27 15:24 [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked pinskia at gcc dot gnu.org @ 2022-09-27 15:24 ` pinskia at gcc dot gnu.org 2022-09-27 15:33 ` aldyh at gcc dot gnu.org ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-09-27 15:24 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This testcase is not optimized by clang/llvm. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/107053] ones bits is not tracked and popcount is not tracked 2022-09-27 15:24 [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked pinskia at gcc dot gnu.org 2022-09-27 15:24 ` [Bug tree-optimization/107053] " pinskia at gcc dot gnu.org @ 2022-09-27 15:33 ` aldyh at gcc dot gnu.org 2022-09-27 15:40 ` pinskia at gcc dot gnu.org ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: aldyh at gcc dot gnu.org @ 2022-09-27 15:33 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053 Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2022-09-27 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/107053] ones bits is not tracked and popcount is not tracked 2022-09-27 15:24 [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked pinskia at gcc dot gnu.org 2022-09-27 15:24 ` [Bug tree-optimization/107053] " pinskia at gcc dot gnu.org 2022-09-27 15:33 ` aldyh at gcc dot gnu.org @ 2022-09-27 15:40 ` pinskia at gcc dot gnu.org 2022-09-28 6:28 ` aldyh at gcc dot gnu.org ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-09-27 15:40 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note the correct testcase is: void link_failure(); void f(int a) { a |= 0x300; int b = __builtin_popcount(a); if (b < 2) link_failure(); } --- CUT --- the range of b should be 2..31 (assuming int is 32bits). With this change clang is able to optimize it. For the original testcase I think it can be folded to: void link_failure(); void f(int a) { int a1 &= ~0x300; if (a1 != 0) link_failure(); } but that might be worse unless popcount can be removed. (If I did this correctly). ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/107053] ones bits is not tracked and popcount is not tracked 2022-09-27 15:24 [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked pinskia at gcc dot gnu.org ` (2 preceding siblings ...) 2022-09-27 15:40 ` pinskia at gcc dot gnu.org @ 2022-09-28 6:28 ` aldyh at gcc dot gnu.org 2023-07-12 21:16 ` cvs-commit at gcc dot gnu.org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: aldyh at gcc dot gnu.org @ 2022-09-28 6:28 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053 Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=107043 CC| |amacleod at redhat dot com --- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- This is a variant of PR107043 which I discuss in comment #3. We can't get this because we don't track the or-mask, the known 1-bits. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/107053] ones bits is not tracked and popcount is not tracked 2022-09-27 15:24 [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked pinskia at gcc dot gnu.org ` (3 preceding siblings ...) 2022-09-28 6:28 ` aldyh at gcc dot gnu.org @ 2023-07-12 21:16 ` cvs-commit at gcc dot gnu.org 2023-07-12 21:18 ` aldyh at gcc dot gnu.org 2023-07-12 21:56 ` pinskia at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-07-12 21:16 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Aldy Hernandez <aldyh@gcc.gnu.org>: https://gcc.gnu.org/g:137fb7077f7711e2e09ee8f82650fe7d93de6a4d commit r14-2479-g137fb7077f7711e2e09ee8f82650fe7d93de6a4d Author: Aldy Hernandez <aldyh@redhat.com> Date: Fri Jun 30 20:40:02 2023 +0200 [range-op] Take known set bits into account in popcount [PR107053] This patch teaches popcount about known set bits which are now available in the irange. PR tree-optimization/107053 gcc/ChangeLog: * gimple-range-op.cc (cfn_popcount): Use known set bits. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr107053.c: New test. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/107053] ones bits is not tracked and popcount is not tracked 2022-09-27 15:24 [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked pinskia at gcc dot gnu.org ` (4 preceding siblings ...) 2023-07-12 21:16 ` cvs-commit at gcc dot gnu.org @ 2023-07-12 21:18 ` aldyh at gcc dot gnu.org 2023-07-12 21:56 ` pinskia at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: aldyh at gcc dot gnu.org @ 2023-07-12 21:18 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053 Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- fixed in trunk ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/107053] ones bits is not tracked and popcount is not tracked 2022-09-27 15:24 [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked pinskia at gcc dot gnu.org ` (5 preceding siblings ...) 2023-07-12 21:18 ` aldyh at gcc dot gnu.org @ 2023-07-12 21:56 ` pinskia at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-07-12 21:56 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |14.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-12 21:56 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-09-27 15:24 [Bug tree-optimization/107053] New: ones bits is not tracked and popcount is not tracked pinskia at gcc dot gnu.org 2022-09-27 15:24 ` [Bug tree-optimization/107053] " pinskia at gcc dot gnu.org 2022-09-27 15:33 ` aldyh at gcc dot gnu.org 2022-09-27 15:40 ` pinskia at gcc dot gnu.org 2022-09-28 6:28 ` aldyh at gcc dot gnu.org 2023-07-12 21:16 ` cvs-commit at gcc dot gnu.org 2023-07-12 21:18 ` aldyh at gcc dot gnu.org 2023-07-12 21:56 ` 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).