public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108540] [13 Regression] Frange miscompilation of ruby since r13-3261 Date: Thu, 26 Jan 2023 11:41:04 +0000 [thread overview] Message-ID: <bug-108540-4-zqWiJfQOvn@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108540-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108540 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think int foo (int x, double d) { if (x == 42) d = -0.0; if (d == 0.0) return 42; return 12; } behaves similarly with threading. The above function is basically return (x == 42 || d == 0.0) ? 42 : 12; In forwprop1 at -O2 we still have correct: <bb 2> : if (x_3(D) == 42) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : <bb 4> : # d_1 = PHI <d_4(D)(2), -0.0(3)> if (d_1 == 0.0) goto <bb 5>; [INV] else goto <bb 6>; [INV] <bb 5> : // predicted unlikely by early return (on trees) predictor. <bb 6> : # RANGE [irange] int [-INF, +INF] NONZERO 0x2e # _2 = PHI <42(5), 12(4)> but then comes ethread and turns that into: <bb 2> : if (x_3(D) == 42) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : # d_5 = PHI <-0.0(2)> goto <bb 6>; [100.00%] <bb 4> : # d_1 = PHI <d_4(D)(2)> if (d_1 == 0.0) goto <bb 5>; [INV] else goto <bb 6>; [INV] <bb 5> : // predicted unlikely by early return (on trees) predictor. <bb 6> : # RANGE [irange] int [-INF, +INF] NONZERO 0x2e # _2 = PHI <42(5), 12(4), 12(3)> as if -0.0 == 0.0 was false rather than true.
next prev parent reply other threads:[~2023-01-26 11:41 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-25 15:48 [Bug tree-optimization/108540] New: " jakub at gcc dot gnu.org 2023-01-25 15:52 ` [Bug tree-optimization/108540] " jakub at gcc dot gnu.org 2023-01-26 11:27 ` jakub at gcc dot gnu.org 2023-01-26 11:41 ` jakub at gcc dot gnu.org [this message] 2023-01-26 12:16 ` jakub at gcc dot gnu.org 2023-01-26 12:37 ` jakub at gcc dot gnu.org 2023-01-26 13:08 ` jakub at gcc dot gnu.org 2023-01-26 13:29 ` aldyh at gcc dot gnu.org 2023-01-26 16:28 ` cvs-commit at gcc dot gnu.org 2023-01-27 20:39 ` jakub 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-108540-4-zqWiJfQOvn@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).