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/106617] [13 Regression] gcc is very slow at ternary expressions, Date: Mon, 15 Aug 2022 08:55:05 +0000 [thread overview] Message-ID: <bug-106617-4-auScoS4xsM@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106617-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106617 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org Status|UNCONFIRMED |NEW Last reconfirmed| |2022-08-15 Keywords| |needs-bisection Ever confirmed|0 |1 --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 Applying pattern match.pd:5769, generic-match.cc:14472 ... that's the following pattern which GCC 12 doesn't have /* From fold_binary_op_with_conditional_arg handle the case of rewriting (a ? b : c) > d to a ? (b > d) : (c > d) when the compares simplify. */ (for cmp (simple_comparison) (simplify (cmp:c (cond @0 @1 @2) @3) /* Do not move possibly trapping operations into the conditional as this pessimizes code and causes gimplification issues when applied late. */ (if (!FLOAT_TYPE_P (TREE_TYPE (@3)) || operation_could_trap_p (cmp, true, false, @3)) (cond @0 (cmp! @1 @3) (cmp! @2 @3))))) the testcase is essentially a degenerate case of this, applying the pattern recursively. The testcase is a bit too large to easily follow what happens, cutting some lines in the middle shows we are eventually producing 0, 0 ? nr_cpu_ids == 0 && ((nr_cpu_ids & 7) == 0 && (nr_cpu_ids == 0 && ((nr_cpu_ids & 5) == 0 && (nr_cpu_ids == 0 && ((nr_cpu_ids & 3) == 0 && (nr_cpu_ids + -1 & 1) != 0))))) : 0 ? 2 : 1; not sure why we don't fold the (0, 0) ? ..., that seems to be a "bug" of fully folding in the C frontend? We do simplify 0 ? ... just fine. Supposedly COMPOUND_EXPRs are never constant folded?
next prev parent reply other threads:[~2022-08-15 8:55 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-14 21:52 [Bug tree-optimization/106617] New: " slyfox at gcc dot gnu.org 2022-08-14 21:55 ` [Bug tree-optimization/106617] " pinskia at gcc dot gnu.org 2022-08-14 22:02 ` slyfox at gcc dot gnu.org 2022-08-14 22:08 ` slyfox at gcc dot gnu.org 2022-08-14 22:09 ` pinskia at gcc dot gnu.org 2022-08-15 7:01 ` slyfox at gcc dot gnu.org 2022-08-15 7:22 ` slyfox at gcc dot gnu.org 2022-08-15 7:39 ` pinskia at gcc dot gnu.org 2022-08-15 8:55 ` rguenth at gcc dot gnu.org [this message] 2022-08-15 9:06 ` rguenth at gcc dot gnu.org 2022-08-16 6:47 ` [Bug tree-optimization/106617] [13 Regression] gcc is very slow at ternary expressions since r13-322-g7f04b0d786e13ff5 marxin at gcc dot gnu.org 2022-08-16 7:17 ` rguenth at gcc dot gnu.org 2022-08-16 14:48 ` pinskia at gcc dot gnu.org 2022-08-16 15:10 ` pivanov at hotmail dot com
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-106617-4-auScoS4xsM@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).