Reduce DF computation at -O0

Message ID 2601473.BddDVKsqQX@fomalhaut
State Accepted, archived
Headers
Series Reduce DF computation at -O0 |

Checks

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

Commit Message

Eric Botcazou Oct. 6, 2022, 5:25 p.m. UTC
  Hi,

even at -O0 there may be a fair amount of DF computation performed when
compiling large units and part of it appears to be useless.

Bootstrapped/regtested on x86-64/Linux, OK for the mainline?


2022-10-06  Eric Botcazou  <ebotcazou@adacore.com>

	* function.cc (thread_prologue_and_epilogue_insns): Update only entry
	and exit blocks when not optimizing.  Remove dead statement.
  

Comments

Richard Biener Oct. 7, 2022, 6:07 a.m. UTC | #1
On Thu, Oct 6, 2022 at 7:27 PM Eric Botcazou via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> even at -O0 there may be a fair amount of DF computation performed when
> compiling large units and part of it appears to be useless.
>
> Bootstrapped/regtested on x86-64/Linux, OK for the mainline?

OK.

>
> 2022-10-06  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * function.cc (thread_prologue_and_epilogue_insns): Update only entry
>         and exit blocks when not optimizing.  Remove dead statement.
>
> --
> Eric Botcazou
  

Patch

diff --git a/gcc/function.cc b/gcc/function.cc
index 5498a712c4a..6474a663b30 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -6249,10 +6249,15 @@  thread_prologue_and_epilogue_insns (void)
 	}
     }
 
-  /* Threading the prologue and epilogue changes the artificial refs
-     in the entry and exit blocks.  */
-  epilogue_completed = 1;
-  df_update_entry_exit_and_calls ();
+  /* 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)
+    df_update_entry_exit_and_calls ();
+  else
+    {
+      df_update_entry_block_defs ();
+      df_update_exit_block_uses ();
+    }
 }
 
 /* Reposition the prologue-end and epilogue-begin notes after