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/104162] [12 Regression] Missed CSE after lowering of &MEM[ptr_1 + CST] Date: Wed, 26 Jan 2022 13:48:49 +0000 [thread overview] Message-ID: <bug-104162-4-DSWg5ujocf@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104162-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104162 --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #4) > Btw, in VN it would be nice to handle > > struct S { int i; }; > > int i; > int bar (char *p) > { > char *q = p + 1; > i = 1; > char *r = (char *)&(((struct S *)&p[i])->i); > return q == r; > } Rather the following struct S { int a[4]; }; int i; int bar (struct S *p) { char *q = (char *)p + 4; i = 1; int *r = &((struct S *)p)->a[i]; return q == (char *)r; } > the main issue here is that this is vn_reference vs. vn_nary handling and > this > transitions from vn_reference to possibly vn_nary with valueization. For VN > &MEM[p + 1] was more canonical and we could go back to this when seeing > pointer-plus -- at least when lookup & simplification does not produce a > redundancy. > > Handling this in VN only and only when inlining is complete might also avoid > regressing the testcase again. The adjusted testcase is folded in forwprop after inlining which handles p+4 == &p->a[1]
next prev parent reply other threads:[~2022-01-26 13:48 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-21 13:01 [Bug tree-optimization/104162] New: " rguenth at gcc dot gnu.org 2022-01-21 13:01 ` [Bug tree-optimization/104162] " rguenth at gcc dot gnu.org 2022-01-21 13:13 ` rguenth at gcc dot gnu.org 2022-01-21 16:10 ` pinskia at gcc dot gnu.org 2022-01-24 9:50 ` rguenth at gcc dot gnu.org 2022-01-26 13:48 ` rguenth at gcc dot gnu.org [this message] 2022-01-26 14:39 ` rguenth at gcc dot gnu.org 2022-03-23 12:32 ` rguenth at gcc dot gnu.org 2022-05-05 12:41 ` [Bug tree-optimization/104162] [12/13 " cvs-commit at gcc dot gnu.org 2022-12-12 13:32 ` [Bug tree-optimization/104162] [12 " marxin at gcc dot gnu.org 2023-04-26 6:55 ` rguenth at gcc dot gnu.org 2023-07-27 9:22 ` rguenth at gcc dot gnu.org 2024-05-21 9:11 ` 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-104162-4-DSWg5ujocf@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).