public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][RTL ifcvt] Print name of noce trasform that succeeded in dump file
@ 2016-06-06 16:29 Kyrill Tkachov
  2016-06-06 17:13 ` Bernd Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Kyrill Tkachov @ 2016-06-06 16:29 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1471 bytes --]

Hi all,

When debugging the noce if-conversion passes one of the most frustrating and time-consuming
things I have to do is find which of the dozen or so transforms triggered.
You'd think going through the cascade of if-gotos in noce_process_if_block in gdb would work,
but this tends to be optimised in weird ways and stepping through them doesn't work accurately
most of the time.

This patch adds the name of the transform that succeeded in if-conversion and prints it to the
dump file so that we can pinpoint the extact noce_try* function that triggered.

Bootstrapped and tested on arm-none-linux-gnueabihf and aarch64-none-linux-gnu.

Ok for trunk?

Thanks,
Kyrill

2016-06-06  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * ifcvt.c (struct noce_if_info): Add transform_name field.
     (noce_try_move): Set if_info->transform_name to the function name.
     (noce_try_ifelse_collapse): Likewise.
     (noce_try_store_flag): Likewise.
     (noce_try_inverse_constants): Likewise.
     (noce_try_store_flag_constants): Likewise.
     (noce_try_addcc): Likewise.
     (noce_try_store_flag_mask): Likewise.
     (noce_try_cmove): Likewise.
     (noce_try_cmove_arith): Likewise.
     (noce_try_minmax): Likewise.
     (noce_try_abs): Likewise.
     (noce_try_sign_mask): Likewise.
     (noce_try_bitop): Likewise.
     (noce_convert_multiple_sets): Likewise.
     (noce_process_if_block): Print if_info->transform_name to
     dump_file if transformation succeeded.

[-- Attachment #2: ifcvt-noce-dumps.patch --]
[-- Type: text/x-patch, Size: 5505 bytes --]

diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 05fac71409d401a08d01b7dc7cf164613f8477c4..4a277db7dcc4cd467299419b21bae0f2a2b42926 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -813,6 +813,10 @@ struct noce_if_info
 
   /* Estimated cost of the particular branch instruction.  */
   unsigned int branch_cost;
+
+  /* The name of the noce transform that succeeded in if-converting
+     this structure.  Used for debugging.  */
+  const char *transform_name;
 };
 
 static rtx noce_emit_store_flag (struct noce_if_info *, rtx, int, int);
@@ -1116,6 +1120,7 @@ noce_try_move (struct noce_if_info *if_info)
 	  emit_insn_before_setloc (seq, if_info->jump,
 				   INSN_LOCATION (if_info->insn_a));
 	}
+      if_info->transform_name = "noce_try_move";
       return TRUE;
     }
   return FALSE;
@@ -1148,6 +1153,8 @@ noce_try_ifelse_collapse (struct noce_if_info * if_info)
 
   emit_insn_before_setloc (seq, if_info->jump,
 			  INSN_LOCATION (if_info->insn_a));
+
+  if_info->transform_name = "noce_try_ifelse_collapse";
   return TRUE;
 }
 
@@ -1195,6 +1202,7 @@ noce_try_store_flag (struct noce_if_info *if_info)
 
       emit_insn_before_setloc (seq, if_info->jump,
 			       INSN_LOCATION (if_info->insn_a));
+      if_info->transform_name = "noce_try_store_flag";
       return TRUE;
     }
   else
@@ -1273,6 +1281,7 @@ noce_try_inverse_constants (struct noce_if_info *if_info)
 
       emit_insn_before_setloc (seq, if_info->jump,
 			       INSN_LOCATION (if_info->insn_a));
+      if_info->transform_name = "noce_try_inverse_constants";
       return true;
     }
 
@@ -1493,6 +1502,8 @@ noce_try_store_flag_constants (struct noce_if_info *if_info)
 
       emit_insn_before_setloc (seq, if_info->jump,
 			       INSN_LOCATION (if_info->insn_a));
+      if_info->transform_name = "noce_try_store_flag_constants";
+
       return TRUE;
     }
 
@@ -1545,6 +1556,8 @@ noce_try_addcc (struct noce_if_info *if_info)
 
 	      emit_insn_before_setloc (seq, if_info->jump,
 				       INSN_LOCATION (if_info->insn_a));
+	      if_info->transform_name = "noce_try_addcc";
+
 	      return TRUE;
 	    }
 	  end_sequence ();
@@ -1585,6 +1598,7 @@ noce_try_addcc (struct noce_if_info *if_info)
 
 	      emit_insn_before_setloc (seq, if_info->jump,
 				       INSN_LOCATION (if_info->insn_a));
+	      if_info->transform_name = "noce_try_addcc";
 	      return TRUE;
 	    }
 	  end_sequence ();
@@ -1649,6 +1663,8 @@ noce_try_store_flag_mask (struct noce_if_info *if_info)
 
 	  emit_insn_before_setloc (seq, if_info->jump,
 				   INSN_LOCATION (if_info->insn_a));
+	  if_info->transform_name = "noce_try_store_flag_mask";
+
 	  return TRUE;
 	}
 
@@ -1799,6 +1815,8 @@ noce_try_cmove (struct noce_if_info *if_info)
 
 	  emit_insn_before_setloc (seq, if_info->jump,
 				   INSN_LOCATION (if_info->insn_a));
+	  if_info->transform_name = "noce_try_cmove";
+
 	  return TRUE;
 	}
       /* If both a and b are constants try a last-ditch transformation:
@@ -1852,6 +1870,7 @@ noce_try_cmove (struct noce_if_info *if_info)
 
 	      emit_insn_before_setloc (seq, if_info->jump,
 				   INSN_LOCATION (if_info->insn_a));
+	      if_info->transform_name = "noce_try_cmove";
 	      return TRUE;
 	    }
 	  else
@@ -2305,6 +2324,7 @@ noce_try_cmove_arith (struct noce_if_info *if_info)
 
   emit_insn_before_setloc (ifcvt_seq, if_info->jump,
 			   INSN_LOCATION (if_info->insn_a));
+  if_info->transform_name = "noce_try_cmove_arith";
   return TRUE;
 
  end_seq_and_fail:
@@ -2561,6 +2581,7 @@ noce_try_minmax (struct noce_if_info *if_info)
   emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a));
   if_info->cond = cond;
   if_info->cond_earliest = earliest;
+  if_info->transform_name = "noce_try_minmax";
 
   return TRUE;
 }
@@ -2727,6 +2748,7 @@ noce_try_abs (struct noce_if_info *if_info)
   emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a));
   if_info->cond = cond;
   if_info->cond_earliest = earliest;
+  if_info->transform_name = "noce_try_abs";
 
   return TRUE;
 }
@@ -2808,6 +2830,8 @@ noce_try_sign_mask (struct noce_if_info *if_info)
     return FALSE;
 
   emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATION (if_info->insn_a));
+  if_info->transform_name = "noce_try_sign_mask";
+
   return TRUE;
 }
 
@@ -2913,6 +2937,7 @@ noce_try_bitop (struct noce_if_info *if_info)
       emit_insn_before_setloc (seq, if_info->jump,
 			       INSN_LOCATION (if_info->insn_a));
     }
+  if_info->transform_name = "noce_try_bitop";
   return TRUE;
 }
 
@@ -3276,6 +3301,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
     }
 
   num_updated_if_blocks++;
+  if_info->transform_name = "noce_convert_multiple_sets";
   return TRUE;
 }
 
@@ -3372,7 +3398,12 @@ noce_process_if_block (struct noce_if_info *if_info)
       && bb_ok_for_noce_convert_multiple_sets (then_bb, if_info))
     {
       if (noce_convert_multiple_sets (if_info))
-	return TRUE;
+	{
+	  if (dump_file && if_info->transform_name)
+	    fprintf (dump_file, "if-conversion succeeded through %s\n",
+		     if_info->transform_name);
+	  return TRUE;
+	}
     }
 
   if (! bb_valid_for_noce_process_p (then_bb, cond, &if_info->then_cost,
@@ -3571,6 +3602,9 @@ noce_process_if_block (struct noce_if_info *if_info)
   return FALSE;
 
  success:
+  if (dump_file && if_info->transform_name)
+    fprintf (dump_file, "if-conversion succeeded through %s\n",
+	     if_info->transform_name);
 
   /* If we used a temporary, fix it up now.  */
   if (orig_x != x)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][RTL ifcvt] Print name of noce trasform that succeeded in dump file
  2016-06-06 16:29 [PATCH][RTL ifcvt] Print name of noce trasform that succeeded in dump file Kyrill Tkachov
@ 2016-06-06 17:13 ` Bernd Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Bernd Schmidt @ 2016-06-06 17:13 UTC (permalink / raw)
  To: Kyrill Tkachov, GCC Patches

On 06/06/2016 06:28 PM, Kyrill Tkachov wrote:
> This patch adds the name of the transform that succeeded in
> if-conversion and prints it to the
> dump file so that we can pinpoint the extact noce_try* function that
> triggered.

Ok.


Bernd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-06 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 16:29 [PATCH][RTL ifcvt] Print name of noce trasform that succeeded in dump file Kyrill Tkachov
2016-06-06 17:13 ` Bernd Schmidt

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