diff mbox series

IPA ICF: enhance dump output

Message ID e1ba399b-9f66-0560-7d06-ceceb300325f@suse.cz
State New
Headers show
Series IPA ICF: enhance dump output | expand

Commit Message

Martin Liška June 4, 2019, 2:38 p.m. UTC
Hi.

The patch is about simplification of dump output. Plus it prints
also a file in which the dump message was emitted.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-06-04  Martin Liska  <mliska@suse.cz>

	* ipa-icf-gimple.h (dump_message_1): Remove.
	(dump_message): Likewise.
	(return_false_with_message_1): Print also file.
	(return_false_with_msg): Likewise.
	(return_with_result): Likewise.
	(return_with_debug): Likewise.
	* ipa-icf.c (sem_function::equals_private): Remove call
	to dump_message.
---
 gcc/ipa-icf-gimple.h | 31 +++++++++++--------------------
 gcc/ipa-icf.c        |  2 --
 2 files changed, 11 insertions(+), 22 deletions(-)

Comments

Jeff Law June 5, 2019, 10:12 p.m. UTC | #1
On 6/4/19 8:38 AM, Martin Liška wrote:
> Hi.
> 
> The patch is about simplification of dump output. Plus it prints
> also a file in which the dump message was emitted.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2019-06-04  Martin Liska  <mliska@suse.cz>
> 
> 	* ipa-icf-gimple.h (dump_message_1): Remove.
> 	(dump_message): Likewise.
> 	(return_false_with_message_1): Print also file.
> 	(return_false_with_msg): Likewise.
> 	(return_with_result): Likewise.
> 	(return_with_debug): Likewise.
> 	* ipa-icf.c (sem_function::equals_private): Remove call
> 	to dump_message.
OK.
jeff
diff mbox series

Patch

diff --git a/gcc/ipa-icf-gimple.h b/gcc/ipa-icf-gimple.h
index 51aadced9ea..351bddfb2f6 100644
--- a/gcc/ipa-icf-gimple.h
+++ b/gcc/ipa-icf-gimple.h
@@ -36,34 +36,22 @@  along with GCC; see the file COPYING3.  If not see
 #define FPRINTF_SPACES(file, space_count, format, ...) \
   fprintf (file, "%*s" format, space_count, " ", ##__VA_ARGS__);
 
-/* Prints a MESSAGE to dump_file if exists. FUNC is name of function and
-   LINE is location in the source file.  */
-
-static inline void
-dump_message_1 (const char *message, const char *func, unsigned int line)
-{
-  if (dump_file && (dump_flags & TDF_DETAILS))
-    fprintf (dump_file, "  debug message: %s (%s:%u)\n", message, func, line);
-}
-
-/* Prints a MESSAGE to dump_file if exists.  */
-#define dump_message(message) dump_message_1 (message, __func__, __LINE__)
-
 /* Logs a MESSAGE to dump_file if exists and returns false. FUNC is name
    of function and LINE is location in the source file.  */
 
 static inline bool
-return_false_with_message_1 (const char *message, const char *func,
-			     unsigned int line)
+return_false_with_message_1 (const char *message, const char *filename,
+			     const char *func, unsigned int line)
 {
   if (dump_file && (dump_flags & TDF_DETAILS))
-    fprintf (dump_file, "  false returned: '%s' (%s:%u)\n", message, func, line);
+    fprintf (dump_file, "  false returned: '%s' in %s at %s:%u\n", message, func,
+	     filename, line);
   return false;
 }
 
 /* Logs a MESSAGE to dump_file if exists and returns false.  */
 #define return_false_with_msg(message) \
-  return_false_with_message_1 (message, __func__, __LINE__)
+  return_false_with_message_1 (message, __FILE__, __func__, __LINE__)
 
 /* Return false and log that false value is returned.  */
 #define return_false() return_false_with_msg ("")
@@ -72,16 +60,19 @@  return_false_with_message_1 (const char *message, const char *func,
    is location in the source file.  */
 
 static inline bool
-return_with_result (bool result, const char *func, unsigned int line)
+return_with_result (bool result, const char *filename,
+		    const char *func, unsigned int line)
 {
   if (!result && dump_file && (dump_flags & TDF_DETAILS))
-    fprintf (dump_file, "  false returned: (%s:%u)\n", func, line);
+    fprintf (dump_file, "  false returned: '' in %s at %s:%u\n", func,
+	     filename, line);
 
   return result;
 }
 
 /* Logs return value if RESULT is false.  */
-#define return_with_debug(result) return_with_result (result, __func__, __LINE__)
+#define return_with_debug(result) return_with_result \
+  (result, __FILE__, __func__, __LINE__)
 
 /* Verbose logging function logging statements S1 and S2 of a CODE.
    FUNC is name of function and LINE is location in the source file.  */
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 19b45b35c9a..dbfd3640126 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -883,8 +883,6 @@  sem_function::equals_private (sem_item *item)
     if(!m_checker->compare_bb (bb_sorted[i], m_compared_func->bb_sorted[i]))
       return return_false();
 
-  dump_message ("All BBs are equal\n");
-
   auto_vec <int> bb_dict;
 
   /* Basic block edges check.  */