summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-15 03:11:48 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-15 03:11:48 +0000
commitd3e88495d5a54c57ef80caffe232c6b3eed96a04 (patch)
tree4a2f16439b5d9964b8b0b04f7b84b25c3dfecac9
parent61f2f61b16a303866ab01a4bbb185addc625b19b (diff)
downloadgcc-d3e88495d5a54c57ef80caffe232c6b3eed96a04.tar.gz
introduce TDF_compare_debug, omit OBJ_TYPE_REF casts with it
for gcc/ChangeLog * dumpfile.h (TDF_COMPARE_DEBUG): New. * final.c (rest_of_clean_state): Set it for the -fcompare-debug dump. * tree-pretty-print.c (dump_generic_node): Omit OBJ_TYPE_REF class when TDF_COMPARE_DEBUG is set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254751 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/dumpfile.h1
-rw-r--r--gcc/final.c2
-rw-r--r--gcc/tree-pretty-print.c10
4 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 70ae417b366..9cba109ec59 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2017-11-15 Alexandre Oliva <aoliva@redhat.com>
+ * dumpfile.h (TDF_COMPARE_DEBUG): New.
+ * final.c (rest_of_clean_state): Set it for the
+ -fcompare-debug dump.
+ * tree-pretty-print.c (dump_generic_node): Omit OBJ_TYPE_REF
+ class when TDF_COMPARE_DEBUG is set.
+
* dwarf2out.c (gen_producer_string): Discard
OPT_fcompare_debug.
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 4d9f6b3656a..1b4d7e7dab7 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -93,6 +93,7 @@ enum dump_kind
#define MSG_NOTE (1 << 24) /* general optimization info */
#define MSG_ALL (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
| MSG_NOTE)
+#define TDF_COMPARE_DEBUG (1 << 25) /* Dumping for -fcompare-debug. */
/* Value of TDF_NONE is used just for bits filtered by TDF_KIND_MASK. */
diff --git a/gcc/final.c b/gcc/final.c
index 039c37a3135..fe35a36dbbf 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -4629,7 +4629,7 @@ rest_of_clean_state (void)
{
flag_dump_noaddr = flag_dump_unnumbered = 1;
if (flag_compare_debug_opt || flag_compare_debug)
- dump_flags |= TDF_NOUID;
+ dump_flags |= TDF_NOUID | TDF_COMPARE_DEBUG;
dump_function_header (final_output, current_function_decl,
dump_flags);
final_insns_dump_p = true;
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 61a28c6757f..80d45f96d67 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -2760,7 +2760,15 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
pp_string (pp, "OBJ_TYPE_REF(");
dump_generic_node (pp, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
pp_semicolon (pp);
- if (!(flags & TDF_SLIM) && virtual_method_call_p (node))
+ /* We omit the class type for -fcompare-debug because we may
+ drop TYPE_BINFO early depending on debug info, and then
+ virtual_method_call_p would return false, whereas when
+ TYPE_BINFO is preserved it may still return true and then
+ we'd print the class type. Compare tree and rtl dumps for
+ libstdc++-prettyprinters/shared_ptr.cc with and without -g,
+ for example, at occurrences of OBJ_TYPE_REF. */
+ if (!(flags & (TDF_SLIM | TDF_COMPARE_DEBUG))
+ && virtual_method_call_p (node))
{
pp_string (pp, "(");
dump_generic_node (pp, obj_type_ref_class (node), spc, flags, false);