public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1581] Fix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only static vars Date: Sat, 9 Jul 2022 01:27:24 +0000 (GMT) [thread overview] Message-ID: <20220709012724.AF593385781D@sourceware.org> (raw) https://gcc.gnu.org/g:71e3daa31cfa35ee58e5899cb00767be92227fd2 commit r13-1581-g71e3daa31cfa35ee58e5899cb00767be92227fd2 Author: Andrew Pinski <apinski@marvell.com> Date: Thu Jul 7 22:06:19 2022 +0000 Fix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only static vars The problem here is that when we mark the ssa name that was referenced in the now removed dead store (to a write only static variable), the inline-asm would also be removed even though it was defining another ssa name. This fixes the problem by checking to make sure that the statement was only defining one ssa name. Committed as approved after a bootstrapped and tested on x86_64 with no regressions. PR tree-optimization/106087 gcc/ChangeLog: * tree-ssa-dce.cc (simple_dce_from_worklist): Check to make sure the statement is only defining one operand. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/inline-asm-1.c: New test. Diff: --- gcc/testsuite/gcc.c-torture/compile/inline-asm-1.c | 14 ++++++++++++++ gcc/tree-ssa-dce.cc | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/gcc/testsuite/gcc.c-torture/compile/inline-asm-1.c b/gcc/testsuite/gcc.c-torture/compile/inline-asm-1.c new file mode 100644 index 00000000000..0044cb761b6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/inline-asm-1.c @@ -0,0 +1,14 @@ +/* PR tree-opt/106087, + simple_dce_from_worklist would delete the + inline-asm when it was still being referenced + by the other ssa name. */ + +static int t; + +int f(void) +{ + int tt, tt1; + asm("":"=r"(tt), "=r"(tt1)); + t = tt1; + return tt; +} diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc index bc533582673..daf0782b0e1 100644 --- a/gcc/tree-ssa-dce.cc +++ b/gcc/tree-ssa-dce.cc @@ -2061,6 +2061,13 @@ simple_dce_from_worklist (bitmap worklist) if (gimple_has_side_effects (t)) continue; + /* The defining statement needs to be defining only this name. + ASM is the only statement that can define more than one + (non-virtual) name. */ + if (is_a<gasm *>(t) + && !single_ssa_def_operand (t, SSA_OP_DEF)) + continue; + /* Don't remove statements that are needed for non-call eh to work. */ if (stmt_unremovable_because_of_non_call_eh_p (cfun, t))
reply other threads:[~2022-07-09 1:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220709012724.AF593385781D@sourceware.org \ --to=pinskia@gcc.gnu.org \ --cc=gcc-cvs@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).