public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Qing Zhao <qinzhao@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-9663] middle-end/100775 - updating the reg use in exit block for -fzero-call-used-regs
Date: Wed, 16 Mar 2022 20:21:02 +0000 (GMT)	[thread overview]
Message-ID: <20220316202102.C1140395200C@sourceware.org> (raw)

https://gcc.gnu.org/g:9b1faeb5bfef258780e313aa8302a43f98f3b442

commit r11-9663-g9b1faeb5bfef258780e313aa8302a43f98f3b442
Author: Qing Zhao <qing.zhao@oracle.com>
Date:   Wed Mar 16 20:18:54 2022 +0000

    middle-end/100775 - updating the reg use in exit block for -fzero-call-used-regs
    
    GCC11 backport.
    
    In the pass_zero_call_used_regs, when updating dataflow info after adding
    the register zeroing sequence in the epilogue of the function, we should
    call "df_update_exit_block_uses" to update the register use information in
    the exit block to include all the registers that have been zeroed.
    
    gcc/ChangeLog:
    
            PR middle-end/100775
            * function.c (gen_call_used_regs_seq): Call
            df_update_exit_block_uses when updating df.
    
    gcc/testsuite/ChangeLog:
    
            PR middle-end/100775
            * gcc.target/arm/pr100775.c: New test.

Diff:
---
 gcc/function.c                          | 2 +-
 gcc/testsuite/gcc.target/arm/pr100775.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/function.c b/gcc/function.c
index fc7b147b5f1..0495e9f1b81 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5922,7 +5922,7 @@ gen_call_used_regs_seq (rtx_insn *ret, unsigned int zero_regs_type)
 
       /* Update the data flow information.  */
       crtl->must_be_zero_on_return |= zeroed_hardregs;
-      df_set_bb_dirty (EXIT_BLOCK_PTR_FOR_FN (cfun));
+      df_update_exit_block_uses ();
     }
 }
 
diff --git a/gcc/testsuite/gcc.target/arm/pr100775.c b/gcc/testsuite/gcc.target/arm/pr100775.c
new file mode 100644
index 00000000000..c648cd5e8f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr100775.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { ! { arm_thumb1_ok || arm_thumb2_ok } } } */
+/* { dg-options "-mthumb -fzero-call-used-regs=used" } */
+
+int
+foo (int x)
+{
+  return x;
+}


                 reply	other threads:[~2022-03-16 20:21 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=20220316202102.C1140395200C@sourceware.org \
    --to=qinzhao@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: link
Be 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).