Fix PR rtl-optimization/108274

Message ID 4771224.GXAFRqVoOG@fomalhaut
State Accepted
Headers
Series Fix PR rtl-optimization/108274 |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Eric Botcazou Jan. 13, 2023, 10:49 a.m. UTC
  Hi,

unlike other IPA passes, the ICF pass can be run at -O0 and some testcases 
rely on this in the testsuite.  Now it effectively creates a tail call so the 
DF information needs be updated in this case after epilogue creation.

Tested on x86-64/Linux, OK for mainline?


2023-01-13  Eric Botcazou  <ebotcazou@adacore.com>

	PR rtl-optimization/108274
	* function.cc (thread_prologue_and_epilogue_insns): Also update the
	DF information for calls in a few more cases.
  

Comments

Richard Biener Jan. 13, 2023, 12:55 p.m. UTC | #1
On Fri, Jan 13, 2023 at 11:50 AM Eric Botcazou via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> unlike other IPA passes, the ICF pass can be run at -O0 and some testcases
> rely on this in the testsuite.  Now it effectively creates a tail call so the
> DF information needs be updated in this case after epilogue creation.
>
> Tested on x86-64/Linux, OK for mainline?

OK.

Richard.

>
>
> 2023-01-13  Eric Botcazou  <ebotcazou@adacore.com>
>
>         PR rtl-optimization/108274
>         * function.cc (thread_prologue_and_epilogue_insns): Also update the
>         DF information for calls in a few more cases.
>
> --
> Eric Botcazou
  

Patch

diff --git a/gcc/function.cc b/gcc/function.cc
index d975b001ec9..95f47d287c5 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -6261,7 +6261,10 @@  thread_prologue_and_epilogue_insns (void)
 
   /* Threading the prologue and epilogue changes the artificial refs in the
      entry and exit blocks, and may invalidate DF info for tail calls.  */
-  if (optimize)
+  if (optimize
+      || flag_optimize_sibling_calls
+      || flag_ipa_icf_functions
+      || in_lto_p)
     df_update_entry_exit_and_calls ();
   else
     {