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 rtl-optimization/103006] [9/10/11/12 Regression] wrong code at -O1 or -O2 on x86_64-linux-gnu by r7-7101 Date: Mon, 31 Jan 2022 13:01:49 +0000 [thread overview] Message-ID: <bug-103006-4-2plZKCYMwG@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103006-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103006 --- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> --- Oh, and I think address-takens are really not an issue but the accesses based on them which confuse the simplistic live analysis to not recognize those as births. So we _can_ introduce explicit birth operations. The simplest thing we probably can do is to add clobbers there and set a special 'birth' flag on them just for liveness analysis, the rest of the compiler can treat them like clobbers - besides cases where we remove clobbers. We can't remove a birth without also removing all clobbers of a variable (even in copies of birth-death regions). It might be tempting to somehow link birth and its clobbers (IIRC with cleanups and so we can have multiple clobbers for one birth), like via SSA def and uses, but when we copy a birth that breaks down. So the alternative is probably to mark a variable as not to be subject to stack slot sharing when removing a birth clobber. The initial birth clobber would be at a more conservative position than the current way of treating the first mention as birth but we can sink birth clobbers (even across address takens) and hoist clobbers to shrink live ranges at some point. Both birth and clobber act as optimization barrier for loads and stores of the affected variable, that's good for the purpose but possibly bad for optimization. I checked and for example loop store motion does consider clobbers inside a loop as reason to not optimize. And with the current scheme we don't even optimize cases like struct Foo { int i; int j; int a[24]; }; void bar(struct Foo f); void baz() { struct Foo f, g; f.i = 1; bar (f); g.j = 2; bar (g); } as nothing hoists the clobbers we only put at the end of the function and thus f and g appear to conflict (we only use clobbers to compute live, for not address taken vars we could rely on mentions only). I don't think we can reasonably fix all of the issue on branches and I have my doubts for GCC 12.
next prev parent reply other threads:[~2022-01-31 13:01 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-30 17:45 [Bug tree-optimization/103006] New: wrong code at -O2 (only) on x86_64-linux-gnu zhendong.su at inf dot ethz.ch 2021-10-30 22:12 ` [Bug tree-optimization/103006] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org 2021-10-30 22:15 ` [Bug middle-end/103006] [9/10/11/12 Regression] wrong code at -O1 or -O2 " pinskia at gcc dot gnu.org 2021-10-30 22:28 ` [Bug rtl-optimization/103006] " pinskia at gcc dot gnu.org 2021-11-01 11:13 ` [Bug rtl-optimization/103006] [9/10/11/12 Regression] wrong code at -O1 or -O2 on x86_64-linux-gnu by r7-7101 jakub at gcc dot gnu.org 2021-11-01 11:29 ` jakub at gcc dot gnu.org 2021-11-02 7:17 ` rguenth at gcc dot gnu.org 2021-11-02 7:57 ` jakub at gcc dot gnu.org 2021-11-02 8:10 ` rguenther at suse dot de 2021-11-02 8:20 ` jakub at gcc dot gnu.org 2021-11-02 13:55 ` rguenther at suse dot de 2021-11-05 13:39 ` rguenth at gcc dot gnu.org 2022-01-31 10:52 ` rguenth at gcc dot gnu.org 2022-01-31 13:01 ` rguenth at gcc dot gnu.org [this message] 2022-01-31 13:08 ` rguenth at gcc dot gnu.org 2022-02-02 11:44 ` rguenth at gcc dot gnu.org 2022-02-04 13:12 ` rguenth at gcc dot gnu.org 2022-05-27 9:46 ` [Bug rtl-optimization/103006] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-06-28 10:46 ` jakub at gcc dot gnu.org 2023-07-07 10:41 ` [Bug middle-end/103006] [11/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-103006-4-2plZKCYMwG@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).