public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107137] New: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var Date: Mon, 03 Oct 2022 19:40:05 +0000 [thread overview] Message-ID: <bug-107137-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137 Bug ID: 107137 Summary: (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var 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: ``` unsigned f(_Bool a) { int t = a; t = -t; return t; } ``` Currently we get: ``` t_2 = (int) a_1(D); t_3 = -t_2; _4 = (unsigned int) t_3; ``` But we can do better than that with just: ``` _ = (unsigned int) a_1(D); _4 = -_; ``` Noticed that while looking into https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131. Note even bool_var could be an unsigned type or a type which whos size is bigger than the outer type really.
next reply other threads:[~2022-10-03 19:40 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-03 19:40 pinskia at gcc dot gnu.org [this message] 2022-10-06 10:02 ` [Bug tree-optimization/107137] " rguenth at gcc dot gnu.org 2022-11-26 20:45 ` pinskia at gcc dot gnu.org 2023-08-31 18:34 ` pinskia at gcc dot gnu.org 2023-09-01 2:27 ` pinskia at gcc dot gnu.org 2023-09-01 16:26 ` pinskia at gcc dot gnu.org 2023-09-02 7:01 ` pinskia at gcc dot gnu.org 2023-09-05 21:16 ` cvs-commit at gcc dot gnu.org 2023-09-05 21: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-107137-4@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).