public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102981] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) Date: Sat, 30 Oct 2021 17:42:38 +0000 [thread overview] Message-ID: <bug-102981-4-kmFY58zKy1@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102981-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102981 Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at gcc dot gnu.org, | |matz at gcc dot gnu.org --- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- I'm not sure what to do here. Perhaps one of the loop experts can opine. The threadable path starting at 2->11 could elide the call to foo(), but... <bb 2> [local count: 59046943]: goto <bb 11>; [100.00%] <bb 11> [local count: 177158542]: # c_12 = PHI <0(2), c_11(10)> # d_13 = PHI <0(2), d_18(10)> if (d_13 != 2) goto <bb 3>; [66.67%] else goto <bb 12>; [33.33%] The pre-loop threaders chose not to thread because it would destroy loop form. The late DOM pass can't even thread it, because the IL is too complex for it. The backward threader can easily see the candidate, but it has restrictions in place specifically to avoid peeling the first iteration of loops (regardless of loopdone): // This is like path_crosses_loops in profitable_path_p but more // restrictive, since profitable_path_p allows threading the // first block because it would be redirected anyhow. // // If we loosened the restriction and used profitable_path_p() // here instead, we would peel off the first iterations of loops // in places like tree-ssa/pr14341.c. I'm not sure massaging the above conditional will ultimately fix this, since the IL is sufficiently different, but that's the gist of it. This seems to be a special case where the first iteration of a loop has unreachable code, and the overly aggressives threaders in earlier GCC releases could elide it early in the pipeline. It also looks like a highly contrived testcase. Does this happen enough in real life that we should handle it? If so, should we try harder in the threader, or could another pass pick up the slack?
next prev parent reply other threads:[~2021-10-30 17:42 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-28 9:38 [Bug tree-optimization/102981] New: " theodort at inf dot ethz.ch 2021-10-28 11:45 ` [Bug tree-optimization/102981] " rguenth at gcc dot gnu.org 2021-10-30 7:03 ` aldyh at gcc dot gnu.org 2021-10-30 17:42 ` aldyh at gcc dot gnu.org [this message] 2021-10-30 18:08 ` aldyh at gcc dot gnu.org 2021-11-04 18:47 ` law at gcc dot gnu.org 2021-11-16 20:08 ` aldyh at gcc dot gnu.org 2021-11-17 9:49 ` aldyh at gcc dot gnu.org 2021-11-23 19:19 ` aldyh at gcc dot gnu.org 2022-05-06 8:31 ` [Bug tree-optimization/102981] [12/13 " jakub at gcc dot gnu.org 2023-05-08 12:22 ` [Bug tree-optimization/102981] [12/13/14 " rguenth 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-102981-4-kmFY58zKy1@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).