public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/91029] missed optimization regarding value of modulo operation Date: Thu, 19 Nov 2020 15:32:09 +0000 [thread overview] Message-ID: <bug-91029-4-z7Bcbc6Dfp@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-91029-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91029 --- Comment #10 from Andrew Macleod <amacleod at redhat dot com> --- Created attachment 49597 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49597&action=edit op2_range implementation I think this does what you want for op2_range. I tried it with: void f1 (int i, int j) { if ((i % j) == 3) { xx = ((j <= 3) && (j >= -3)); if (xx) kill (); } } and it eliminates the call. the listing shows: if (_1 == 3) goto <bb 3>; [INV] else goto <bb 5>; [INV] _1 : int [-2147483647, +INF] 2->3 (T) _1 : int [3, 3] 2->3 (T) i_8(D) : int [3, +INF] 2->3 (T) j_9(D) : int [-INF, -4][4, +INF] 2->5 (F) _1 : int [-2147483647, 2][4, +INF] so its got int [-INF, -4][4, +INF] for the range which I think is correct? I got a headache trying to write a testcase for the different cases, and I'd probably get it wrong like I did with the initial implementation.. So I leave this with you to do what you will :-) I get all tangled up with the negatives.
next prev parent reply other threads:[~2020-11-19 15:32 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-91029-4@http.gcc.gnu.org/bugzilla/> 2020-11-17 22:01 ` cvs-commit at gcc dot gnu.org 2020-11-17 23:07 ` amacleod at redhat dot com 2020-11-18 0:50 ` bruno at clisp dot org 2020-11-18 21:17 ` cvs-commit at gcc dot gnu.org 2020-11-18 22:23 ` jakub at gcc dot gnu.org 2020-11-19 1:16 ` bruno at clisp dot org 2020-11-19 12:22 ` jakub at gcc dot gnu.org 2020-11-19 15:32 ` amacleod at redhat dot com [this message] 2020-11-19 19:55 ` jakub at gcc dot gnu.org 2020-11-19 23:03 ` cvs-commit at gcc dot gnu.org 2023-11-26 13:16 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-91029-4-z7Bcbc6Dfp@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).