Improve shrink-wrapping debug output

Message ID 20200704130739.200444-1-alex.popov@linux.com
State New
Headers show
Series
  • Improve shrink-wrapping debug output
Related show

Commit Message

Alexander Popov July 4, 2020, 1:07 p.m.
Currently if requires_stack_frame_p() returns true for some insn,
the shrink-wrapping debug output contains only the number of a block
containing that insn.

But it is very useful to see the particular insn that requires the
prologue. Let's call print_rtl_single to display that insn in the
following pass dump.

2020-07-04 Alexander Popov <alex.popov@linux.com>

gcc/ChangeLog:

	* shrink-wrap.c (try_shrink_wrapping): Improve debug output.

N.B. This is my first GCC patch, I don't have write access for the project.
---
 gcc/shrink-wrap.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

-- 
2.25.4

Comments

Jose E. Marchesi via Gcc-patches July 10, 2020, 8:26 p.m. | #1
On Sat, 2020-07-04 at 16:07 +0300, Alexander Popov wrote:
> Currently if requires_stack_frame_p() returns true for some insn,

> the shrink-wrapping debug output contains only the number of a block

> containing that insn.

> 

> But it is very useful to see the particular insn that requires the

> prologue. Let's call print_rtl_single to display that insn in the

> following pass dump.

> 

> 2020-07-04 Alexander Popov <alex.popov@linux.com>

> 

> gcc/ChangeLog:

> 

> 	* shrink-wrap.c (try_shrink_wrapping): Improve debug output.

Thanks.  I've installed this on the trunk.

jeff
>

Patch

diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
index 775db9ce888..d70635e94a3 100644
--- a/gcc/shrink-wrap.c
+++ b/gcc/shrink-wrap.c
@@ -43,6 +43,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl-iter.h"
 #include "valtrack.h"
 #include "function-abi.h"
+#include "print-rtl.h"
 
 /* Return true if INSN requires the stack frame to be set up.
    PROLOGUE_USED contains the hard registers used in the function
@@ -735,7 +736,11 @@  try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
 				       set_up_by_prologue.set))
 	  {
 	    if (dump_file)
-	      fprintf (dump_file, "Block %d needs the prologue.\n", bb->index);
+	      {
+		fprintf (dump_file, "Block %d needs prologue due to insn %d:\n",
+			 bb->index, INSN_UID (insn));
+		print_rtl_single (dump_file, insn);
+	      }
 	    pro = nearest_common_dominator (CDI_DOMINATORS, pro, bb);
 	    break;
 	  }