public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vogt at linux dot vnet.ibm.com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/67443] [5/6 regression] DSE removes required store instruction Date: Thu, 15 Oct 2015 10:04:00 -0000 [thread overview] Message-ID: <bug-67443-4-rS9L9bP7tN@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-67443-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67443 --- Comment #10 from Dominik Vogt <vogt at linux dot vnet.ibm.com> --- This is what's happening: Before the dse2 pass, there is a store instruction (25) followed by a read instruction later (29): --- # store first byte (insn 25 135 136 4 (set (mem/j:QI (reg/v/f:DI 2 %r2 [orig:47 ps ] [47]) [2 ps_7\ ->f1+0 S1 A32]) (reg:QI 1 %r1 [orig:51 D.2017+3 ] [51])) t67443.cxx:17 74 {*movqi} (nil)) (insn 136 25 137 4 (set (reg/v/f:DI 1 %r1 [orig:47 ps ] [47]) (reg/v/f:DI 3 %r3 [orig:47 ps ] [47])) t67443.cxx:18 63 {*movdi_64} (nil)) # overwrites r2 (insn 137 136 29 4 (set (reg:SI 2 %r2 [68]) (mem/u/c:SI (unspec:DI [ (symbol_ref/u:DI ("*.LC0") [flags 0x2]) (reg:DI 13 %r13) ] UNSPEC_LTREF) [3 S4 A32])) t67443.cxx:18 67 {*movsi_zarch} (nil)) # write three bytes (insn 29 137 139 4 (parallel [ (set (reg:SI 2 %r2 [68]) (and:SI (reg:SI 2 %r2 [68]) (mem/j:SI (reg/v/f:DI 1 %r1 [orig:47 ps ] [47]) [2 ps_7->f2\ +-1 S4 A32]))) (clobber (reg:CC 33 %cc)) ]) t67443.cxx:18 454 {*andsi3_zarch} (nil)) --- With the unpatched code, the a "value" expression is put in the mem_addr field of the store_info for the "set" (similar for the read in insn 29): store (value:DI 3:3 @0xb7049598/0xb70516a8) read (value:DI 3:3 @0xb7049598/0xb70516a8) With the patched code, the mem_addr is resolved to a register expression r2 for the store and r1 for the read: store (reg/v/f:DI 2 %r2 [orig:47 ps ] [47]) read (reg/v/f:DI 1 %r1 [orig:47 ps ] [47]) Then, canon_true_dependence is called with these terms and calls get_addr on them again. In the unpatched case, the same address value is resolved to the same register expression: (reg/v/f:DI 1 %r1 [orig:47 ps ] [47]) With the patched code, there's nothing left to do for get_addr, so there are two different register expressions that describe the same address. In the end, memrefs_conflict_p() gets called with the two different register expressions and fails to detect that they refer to the same address (which they do *not* at insn 29 because r2 has been overwritten in between). So, I'd say the new call of get_addr() in record_store() is too early because it may replace the address value by an expression that is no longer valid when the memory is read later.
next prev parent reply other threads:[~2015-10-15 10:04 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-03 7:57 [Bug rtl-optimization/67443] New: " krebbel at gcc dot gnu.org 2015-09-03 8:19 ` [Bug rtl-optimization/67443] [5/6 regression] " rguenth at gcc dot gnu.org 2015-09-08 5:02 ` wmi at google dot com 2015-09-08 5:33 ` wmi at google dot com 2015-10-14 16:27 ` vogt at linux dot vnet.ibm.com 2015-10-14 16:40 ` vogt at linux dot vnet.ibm.com 2015-10-14 16:41 ` vogt at linux dot vnet.ibm.com 2015-10-14 21:32 ` vogt at linux dot vnet.ibm.com 2015-10-14 21:35 ` vogt at linux dot vnet.ibm.com 2015-10-15 10:04 ` vogt at linux dot vnet.ibm.com [this message] 2015-10-15 10:13 ` vogt at linux dot vnet.ibm.com 2015-10-17 19:25 ` wmi at google dot com 2015-10-18 18:55 ` wmi at google dot com 2015-10-18 19:54 ` vogt at linux dot vnet.ibm.com 2015-10-18 20:58 ` vogt at linux dot vnet.ibm.com 2015-10-20 9:13 ` rguenth at gcc dot gnu.org 2015-10-20 13:13 ` vogt at linux dot vnet.ibm.com 2015-10-20 13:32 ` rguenther at suse dot de 2015-10-21 0:11 ` vogt at linux dot vnet.ibm.com 2015-10-21 0:12 ` vogt at linux dot vnet.ibm.com 2015-10-23 10:27 ` vogt at linux dot vnet.ibm.com 2015-10-26 15:25 ` rguenth at gcc dot gnu.org 2015-10-26 15:26 ` [Bug rtl-optimization/67443] [5 " 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-67443-4-rS9L9bP7tN@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).