public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v6)] Use dump_printf_loc.
@ 2021-12-07 15:22 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-12-07 15:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:aae9313ce268a9f29c4f1f730ddd13388599fec6

commit aae9313ce268a9f29c4f1f730ddd13388599fec6
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Dec 7 16:19:47 2021 +0100

    Use dump_printf_loc.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 41 ++++++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 9e6aa49a6f2..76ebd507205 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -786,14 +786,17 @@ tree_unswitch_single_loop (class loop *loop, int num,
   bool changed = false;
   HOST_WIDE_INT iterations;
 
+  dump_user_location_t loc (last_stmt (loop->header));
+
   /* Perform initial tests if unswitch is eligible.  */
   if (num == 0)
     {
       /* Do not unswitch in cold regions. */
       if (optimize_loop_for_size_p (loop))
 	{
-	  if (dump_file && (dump_flags & TDF_DETAILS))
-	    fprintf (dump_file, ";; Not unswitching cold loops\n");
+	  if (dump_enabled_p ())
+	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
+			     "Not unswitching cold loops\n");
 	  return false;
 	}
 
@@ -804,9 +807,10 @@ tree_unswitch_single_loop (class loop *loop, int num,
         iterations = likely_max_loop_iterations_int (loop);
       if (iterations >= 0 && iterations <= 1)
 	{
-	  if (dump_file && (dump_flags & TDF_DETAILS))
-	    fprintf (dump_file, ";; Not unswitching, loop is not expected"
-		     " to iterate\n");
+	  if (dump_enabled_p ())
+	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
+			 "Not unswitching, loop is not expected"
+			 " to iterate\n");
 	  return false;
 	}
     }
@@ -815,9 +819,9 @@ tree_unswitch_single_loop (class loop *loop, int num,
   basic_block bb = NULL;
   if (num > param_max_unswitch_level)
     {
-      if (dump_file
-	  && (dump_flags & TDF_DETAILS))
-	fprintf (dump_file, ";; Not unswitching anymore, hit max level\n");
+      if (dump_enabled_p ())
+	dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
+			 "Not unswitching anymore, hit max level\n");
       goto exit;
     }
 
@@ -844,13 +848,10 @@ tree_unswitch_single_loop (class loop *loop, int num,
 	      budget -= cost;
 	      break;
 	    }
-	  else if (dump_file && (dump_flags & TDF_DETAILS))
-	    {
-	      fprintf (dump_file, ";; Not unswitching condition, cost too big "
-		       "(%d insns): ", cost);
-	      print_generic_expr (dump_file, pred->condition);
-	      fprintf (dump_file, "\n");
-	    }
+	  else if (dump_enabled_p ())
+	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
+			     "Not unswitching condition, cost too big "
+			     "(%d insns)\n", cost);
 	}
     }
 
@@ -859,12 +860,10 @@ tree_unswitch_single_loop (class loop *loop, int num,
       if (!dbg_cnt (loop_unswitch))
 	goto exit;
 
-      if (dump_file && (dump_flags & TDF_DETAILS))
-	{
-	  fprintf (dump_file, ";; Unswitching loop on condition: ");
-	  print_generic_expr (dump_file, predicate->condition);
-	  fprintf (dump_file, "\n");
-	}
+      if (dump_enabled_p ())
+	dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
+			 "Unswitching loop on condition: %T\n",
+			 predicate->condition);
 
       predicate->handled = true;
       initialize_original_copy_tables ();


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

only message in thread, other threads:[~2021-12-07 15:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 15:22 [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v6)] Use dump_printf_loc Martin Liska

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).