public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114284] [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice) since r14-8319 Date: Fri, 08 Mar 2024 15:03:37 +0000 [thread overview] Message-ID: <bug-114284-4-QHBl9FtRQu@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114284-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114284 --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- +propagating insn 6 into insn 8, replacing: +(parallel [ + (set (reg:SI 114 [ <retval> ]) + (sign_extend:SI (subreg:HI (reg:SI 117 [ x ]) 0))) + (clobber (scratch:SI)) + ]) +successfully matched this instruction to thumb1_extendhisi2: +(parallel [ + (set (reg:SI 114 [ <retval> ]) + (sign_extend:SI (mem/v/c:HI (reg/f:SI 115) [1 x+0 S2 A16]))) + (clobber (scratch:SI)) + ]) I believe before that change we'd never propagate MEM/v, classify_result even correctly explains why: 4) Creating new (mem/v)s is not correct, since DCE will not remove the old ones. But now that fwprop just ignores that or takes it as a slight hint, we get the invalid change. I'd actually say all the 4 reasons why it shouldn't be propagating MEMs should result in don't actually propagate it rather than just a mere hint: /* Allow (subreg (mem)) -> (mem) simplifications with the following exceptions: 1) Propagating (mem)s into multiple uses is not profitable. 2) Propagating (mem)s across EBBs may not be profitable if the source EBB runs less frequently. 3) Propagating (mem)s into paradoxical (subreg)s is not profitable. 4) Creating new (mem/v)s is not correct, since DCE will not remove the old ones. */ and punt maybe also on propagating any other MEMs into insns. Though, when check_mem is called, it is called only on the MEMs which are being propagated, so not sure how to actually check it in there. Doing --- a/gcc/fwprop.cc +++ b/gcc/fwprop.cc @@ -211,6 +211,11 @@ fwprop_propagation::fwprop_propagation (insn_info *use_insn, bool fwprop_propagation::check_mem (int old_num_changes, rtx mem) { + if (MEM_VOLATILE_P (mem)) + { + failure_reason = "would propagate volatile MEM"; + return false; + } if (!memory_address_addr_space_p (GET_MODE (mem), XEXP (mem, 0), MEM_ADDR_SPACE (mem))) { doesn't really help, so perhaps I misunderstand what is check_mem used for.
next prev parent reply other threads:[~2024-03-08 15:03 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-08 13:12 [Bug target/114284] New: [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice) acoplan at gcc dot gnu.org 2024-03-08 13:25 ` [Bug target/114284] " rguenth at gcc dot gnu.org 2024-03-08 14:31 ` [Bug target/114284] [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice) since r14-8319 jakub at gcc dot gnu.org 2024-03-08 15:02 ` acoplan at gcc dot gnu.org 2024-03-08 15:03 ` jakub at gcc dot gnu.org [this message] 2024-03-08 15:05 ` jakub at gcc dot gnu.org 2024-03-08 15:30 ` jakub at gcc dot gnu.org 2024-03-09 12:05 ` cvs-commit at gcc dot gnu.org 2024-03-09 15:03 ` law at gcc dot gnu.org 2024-03-09 15:03 ` law at gcc dot gnu.org 2024-03-10 1:12 ` roger at nextmovesoftware dot com
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-114284-4-QHBl9FtRQu@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).