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/100221] Takes two passes at DSE to remove some dead stores Date: Tue, 11 Jan 2022 10:16:47 +0000 [thread overview] Message-ID: <bug-100221-4-yEMqaIsiYs@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100221-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100221 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |12.0 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- For the reduced testcase the issue is simply that DSE doesn't walk across multiple paths and we have <bb 4> : # .MEM_9 = VDEF <MEM_4> g = &c; a.1_2 = a; if (a.1_2 != 0) goto <bb 6>; [INV] else goto <bb 7>; [INV] <bb 5> : b = 0; <bb 6> : .MEM_5 = PHI <.MEM_9(4), .MEM_12(5)> b.2_3 = b; if (b.2_3 != 0) goto <bb 5>; [INV] else goto <bb 7>; [INV] <bb 7> : .MEM_6 = PHI <.MEM_9(4), .MEM_5(6)> g ={v} {CLOBBER}; return 0; with the walking gathered the .MEM_5 and .MEM_6 defs when following the .MEM_9 uses and /* In addition to kills we can remove defs whose only use is another def in defs. That can only ever be PHIs of which we track two for simplicity reasons, the first and last in {first,last}_phi_def (we fail for multiple PHIs anyways). We can also ignore defs that feed only into already visited PHIs. */ else if (single_imm_use (vdef, &use_p, &use_stmt) && (use_stmt == first_phi_def || use_stmt == last_phi_def || (gimple_code (use_stmt) == GIMPLE_PHI && bitmap_bit_p (visited, SSA_NAME_VERSION (PHI_RESULT (use_stmt)))))) defs.unordered_remove (i); does not trigger to remove either PHI def from consideration (but in principle we could elide .MEM_6 and continue processing .MEM_5 which eventually will lead us to .MEM_6 anyway). I suppose the key would be realizing that one of the PHI defs is a PHI argument of the PHI we can postpone in this round.
next prev parent reply other threads:[~2022-01-11 10:16 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-22 20:07 [Bug tree-optimization/100221] New: missed optimization for dead code elimination at -O3 (vs. -O1, -Os, -O2) zhendong.su at inf dot ethz.ch 2021-09-25 10:54 ` [Bug tree-optimization/100221] " pinskia at gcc dot gnu.org 2021-12-16 4:35 ` pinskia at gcc dot gnu.org 2021-12-16 4:50 ` [Bug tree-optimization/100221] Takes two passes at DSE to remove some dead stores pinskia at gcc dot gnu.org 2021-12-16 4:50 ` pinskia at gcc dot gnu.org 2022-01-11 10:16 ` rguenth at gcc dot gnu.org [this message] 2022-01-11 11:04 ` rguenth at gcc dot gnu.org 2022-01-11 11:04 ` rguenth at gcc dot gnu.org 2022-01-11 11:05 ` rguenth at gcc dot gnu.org 2022-05-24 6:20 ` cvs-commit at gcc dot gnu.org 2022-05-24 6:21 ` 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-100221-4-yEMqaIsiYs@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).