From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2028) id 65DB8385841B; Thu, 10 Feb 2022 16:40:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65DB8385841B MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Qing Zhao To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7183] middle-end: updating the reg use in exit block for -fzero-call-used-regs [PR100775] X-Act-Checkin: gcc X-Git-Author: Qing Zhao X-Git-Refname: refs/heads/master X-Git-Oldrev: 53fcc46339239c4958e2a15bb9e59274133bbcf7 X-Git-Newrev: b32305b41dcafc5fb6974c0da3ce2f62251afdbf Message-Id: <20220210164053.65DB8385841B@sourceware.org> Date: Thu, 10 Feb 2022 16:40:53 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Feb 2022 16:40:53 -0000 https://gcc.gnu.org/g:b32305b41dcafc5fb6974c0da3ce2f62251afdbf commit r12-7183-gb32305b41dcafc5fb6974c0da3ce2f62251afdbf Author: Qing Zhao Date: Thu Feb 10 16:40:39 2022 +0000 middle-end: updating the reg use in exit block for -fzero-call-used-regs [PR100775] 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. 2022-02-10 Qing Zhao gcc/ChangeLog: PR middle-end/100775 * function.cc (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.cc | 2 +- gcc/testsuite/gcc.target/arm/pr100775.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/function.cc b/gcc/function.cc index e1d2565f8d9..d5ed51a6a66 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -5941,7 +5941,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; +}