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/100162] missed optimization for dead code elimination at -O3 (vs. -O2) Date: Wed, 21 Apr 2021 08:35:46 +0000 [thread overview] Message-ID: <bug-100162-4-sekVkXMcvv@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100162-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100162 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |12.0 CC| |rguenth at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed| |2021-04-21 Status|UNCONFIRMED |NEW Keywords| |missed-optimization --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Optimized by DOM3 which sees the following difference: - <bb 2> [local count: 118111601]: + <bb 2> [local count: 955630225]: b.1_1 = b; - c[0][b.1_1] = 2; - c[1][b.1_1] = 2; - c[2][b.1_1] = 2; - c[3][b.1_1] = 2; + _27 = (sizetype) b.1_1; + _28 = _27 * 4; + vectp_c.13_26 = &c + _28; + MEM <vector(4) int> [(int *)vectp_c.13_26] = { 2, 2, 2, 2 }; + vectp_c.12_30 = vectp_c.13_26 + 16; c[4][b.1_1] = 2; a = 5; _5 = b.1_1 != 0; _6 = (int) _5; - _8 = _6 / 2; + _7 = c[0][0]; + _8 = _6 / _7; if (_8 != 0) here c[0][b.1_1] takes advantage of get_ref_base_and_extent honoring the known array size of [1] while the pointer based access is not constrained this way which makes matching c[0][0] to *(&c + _28) = { 2, 2, 2, 2 } difficult. The realistic chance is to catch this by improving value-numbering done on the not unrolled loop earlier: <bb 3> [local count: 955630225]: # a.3_19 = PHI <_2(3), 0(2)> c[a.3_19][b.1_1] = 2; _2 = a.3_19 + 1; if (_2 <= 4) goto <bb 3>; [89.00%] else goto <bb 4>; [11.00%] <bb 4> [local count: 118111600]: a = _2; _5 = b.1_1 != 0; _6 = (int) _5; _7 = c[0][0]; where we could use SCEV & friends to lookup c[0][0] at the c[a.3_19][b.1_1] definition in vn_reference_lookup_3. That might also help to look through loop abstraction earlier.
next prev parent reply other threads:[~2021-04-21 8:35 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-20 19:20 [Bug tree-optimization/100162] New: " zhendong.su at inf dot ethz.ch 2021-04-21 8:35 ` rguenth at gcc dot gnu.org [this message] 2023-05-05 8:07 ` [Bug tree-optimization/100162] " pinskia at gcc dot gnu.org 2023-05-05 10:16 ` 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-100162-4-sekVkXMcvv@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).