]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end: updating the reg use in exit block for -fzero-call-used-regs [PR100775]
authorQing Zhao <qing.zhao@oracle.com>
Thu, 10 Feb 2022 16:40:39 +0000 (16:40 +0000)
committerQing Zhao <qing.zhao@oracle.com>
Thu, 10 Feb 2022 16:40:39 +0000 (16:40 +0000)
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  <qing.zhao@oracle.com>

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.

gcc/function.cc
gcc/testsuite/gcc.target/arm/pr100775.c [new file with mode: 0644]

index e1d2565f8d9254a21d42b04736c77456c3ee0519..d5ed51a6a663a1ef472f5b1c090543f359c18f42 100644 (file)
@@ -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 (file)
index 0000000..c648cd5
--- /dev/null
@@ -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;
+}