public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110176] [11/12/13/14 Regression] wrong code at -Os and above on x86_64-linux-gnu since r11-2446 Date: Wed, 31 Jan 2024 13:44:16 +0000 [thread overview] Message-ID: <bug-110176-4-TB9G74B8YK@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110176-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110176 --- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- With all VARYING we simplify i_19 = (int) _2; _6 = (int) _5; Value numbering stmt = _7 = _6 <= i_19; Applying pattern match.pd:6775, gimple-match-4.cc:1795 Match-and-simplified _6 <= i_19 to 1 where _5 is _Bool and _2 is unsigned int. We match zext <= (int) 4294967295u note that I see Value numbering stmt = _2 = f$0_25; Setting value number of _2 to 4294967295 (changed) Value numbering stmt = i_19 = (int) _2; Match-and-simplified (int) _2 to -1 RHS (int) _2 simplified to -1 Not changing value number of i_19 from VARYING to -1 Making available beyond BB6 i_19 for value i_19 so it's odd we see the constant here, but ... we go (if (TREE_CODE (@10) == INTEGER_CST && INTEGRAL_TYPE_P (TREE_TYPE (@00)) && !int_fits_type_p (@10, TREE_TYPE (@00))) (with { tree min = lower_bound_in_type (TREE_TYPE (@10), TREE_TYPE (@00)); tree max = upper_bound_in_type (TREE_TYPE (@10), TREE_TYPE (@00)); bool above = integer_nonzerop (const_binop (LT_EXPR, type, max, @10)); bool below = integer_nonzerop (const_binop (LT_EXPR, type, @10, min)); } (if (above || below) failing to see that we deal with a relational compare and a sign-change. The original code from fold-const.cc had only INTEGER_TYPE support, r6-4300-gf6c1575958f7bf made it cover all integral types (it half-way supported BOOLEAN_TYPE already). But the issue was latent I think. One notable difference was that I think get_unwidened made sure to convert a constant to the wider type while here we have @10 != @1 and the conversion not applied. We're doing it correct in earlier code: /* ??? The special-casing of INTEGER_CST conversion was in the original code and here to avoid a spurious overflow flag on the resulting constant which fold_convert produces. */ (if (TREE_CODE (@1) == INTEGER_CST) using @1 instead of @10. Correcting that avoids the pattern from triggering in this wrong way.
next prev parent reply other threads:[~2024-01-31 13:44 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-08 14:44 [Bug tree-optimization/110176] New: wrong code at -Os and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch 2023-06-08 21:43 ` [Bug tree-optimization/110176] " pinskia at gcc dot gnu.org 2023-06-08 21:50 ` pinskia at gcc dot gnu.org 2023-06-08 21:52 ` [Bug tree-optimization/110176] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org 2023-06-08 22:10 ` pinskia at gcc dot gnu.org 2023-06-09 7:11 ` rguenth at gcc dot gnu.org 2023-07-07 10:45 ` [Bug tree-optimization/110176] [11/12/13/14 " rguenth at gcc dot gnu.org 2024-01-04 12:31 ` [Bug tree-optimization/110176] [11/12/13/14 Regression] wrong code at -Os and above on x86_64-linux-gnu since r11-2446 jakub at gcc dot gnu.org 2024-01-04 17:17 ` pinskia at gcc dot gnu.org 2024-01-08 9:37 ` rguenth at gcc dot gnu.org 2024-01-31 13:44 ` rguenth at gcc dot gnu.org [this message] 2024-01-31 14:47 ` cvs-commit at gcc dot gnu.org 2024-01-31 14:49 ` [Bug tree-optimization/110176] [11/12/13 " rguenth at gcc dot gnu.org 2024-02-06 13:20 ` cvs-commit at gcc dot gnu.org 2024-05-17 11:12 ` [Bug tree-optimization/110176] [11/12 " cvs-commit 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-110176-4-TB9G74B8YK@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).