public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-39] PHIOPT: add folding/simplification detail to the dump
@ 2023-04-18 14:40 Andrew Pinski
  0 siblings, 0 replies; only message in thread
From: Andrew Pinski @ 2023-04-18 14:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:529489825677968e6e60dba41ed8f3d046141727

commit r14-39-g529489825677968e6e60dba41ed8f3d046141727
Author: Andrew Pinski <apinski@marvell.com>
Date:   Tue Apr 4 00:09:27 2023 +0000

    PHIOPT: add folding/simplification detail to the dump
    
    While debugging PHI-OPT with match-and-simplify,
    I found that adding more dumping to the debug dumps made
    it easier to understand what was going on rather than stepping in
    the debugger so this adds them. Note I used TDF_FOLDING rather
    than TDF_DETAILS as these debug messages can be chatty and
    only needed if you are debugging match and simplify
    with PHI-OPT and match and simplify uses TDF_FOLDING as
    its check.
    
    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
    
    gcc/ChangeLog:
    
            * tree-ssa-phiopt.cc (gimple_simplify_phiopt): Dump
            the expression that is being tried when TDF_FOLDING
            is true.
            (phiopt_worker::match_simplify_replacement): Dump
            the sequence which was created by gimple_simplify_phiopt
            when TDF_FOLDING is true.

Diff:
---
 gcc/tree-ssa-phiopt.cc | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 4ddb4d5db90..616b5778602 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -916,6 +916,18 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple *comp_stmt,
      "a != 0".  */
   tree cond = build2_loc (loc, comp_code, boolean_type_node,
 			  cmp0, cmp1);
+
+  if (dump_file && (dump_flags & TDF_FOLDING))
+    {
+      fprintf (dump_file, "\nphiopt match-simplify trying:\n\t");
+      print_generic_expr (dump_file, cond);
+      fprintf (dump_file, " ? ");
+      print_generic_expr (dump_file, arg0);
+      fprintf (dump_file, " : ");
+      print_generic_expr (dump_file, arg1);
+      fprintf (dump_file, "\n");
+    }
+
   gimple_match_op op (gimple_match_cond::UNCOND,
 		      COND_EXPR, type, cond, arg0, arg1);
 
@@ -947,6 +959,18 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple *comp_stmt,
   cond = build2_loc (loc,
 		     comp_code, boolean_type_node,
 		     cmp0, cmp1);
+
+  if (dump_file && (dump_flags & TDF_FOLDING))
+    {
+      fprintf (dump_file, "\nphiopt match-simplify trying:\n\t");
+      print_generic_expr (dump_file, cond);
+      fprintf (dump_file, " ? ");
+      print_generic_expr (dump_file, arg1);
+      fprintf (dump_file, " : ");
+      print_generic_expr (dump_file, arg0);
+      fprintf (dump_file, "\n");
+    }
+
   gimple_match_op op1 (gimple_match_cond::UNCOND,
 		       COND_EXPR, type, cond, arg1, arg0);
 
@@ -1078,6 +1102,11 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
 	  if (name && TREE_CODE (name) == SSA_NAME)
 	    bitmap_set_bit (inserted_exprs, SSA_NAME_VERSION (name));
 	}
+      if (dump_file && (dump_flags & TDF_FOLDING))
+	{
+	  fprintf (dump_file, "Folded into the sequence:\n");
+	  print_gimple_seq (dump_file, seq, 0, TDF_VOPS|TDF_MEMSYMS);
+	}
     gsi_insert_seq_before (&gsi, seq, GSI_CONTINUE_LINKING);
   }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-18 14:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 14:40 [gcc r14-39] PHIOPT: add folding/simplification detail to the dump Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).