diff mbox

Fix the "inconsident" devirtualization typo and consolidate the related code

Message ID 20140625221249.GB18164@virgil.suse
State New
Headers show

Commit Message

Martin Jambor June 25, 2014, 10:12 p.m. UTC
Hi,

the patch below fixes the (I guess now almost infamous) typo that
prints "Type inconsident devirtualization" to the dump.  This dumping
has been copied and pasted to a few places so I made all of them just
use the ipa_impossible_devirt_target function to do that.  The code
can be consolidated quite bit more but I believe this patch is small
enough to even be considered for the 4.9 branch, so I stopped there
now.

Bootstrapped and tested on trunk on x86_64-linux, I am running the
bootstrap on the 4.9 branch now.  OK for both or at least for the
trunk?

Thanks,

Martin


2014-06-25  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.c (ipa_impossible_devirt_target): No longer static,
	renamed to ipa_impossible_devirt_target.  Fix typo.
	* ipa-prop.h (ipa_impossible_devirt_target): Declare.
	* ipa-cp.c (ipa_get_indirect_edge_target_1): Use
	ipa_impossible_devirt_target.

testsuite/
	* g++.dg/ipa/pr60600.C: Fix typo.
	* g++.dg/ipa/devirt-25.C: Likewise.
	* g++.dg/ipa/pr61540.C: Likewise.

Comments

Jan Hubicka June 25, 2014, 10:22 p.m. UTC | #1
> Hi,
> 
> the patch below fixes the (I guess now almost infamous) typo that
> prints "Type inconsident devirtualization" to the dump.  This dumping
> has been copied and pasted to a few places so I made all of them just
> use the ipa_impossible_devirt_target function to do that.  The code
> can be consolidated quite bit more but I believe this patch is small
> enough to even be considered for the 4.9 branch, so I stopped there
> now.
> 
> Bootstrapped and tested on trunk on x86_64-linux, I am running the
> bootstrap on the 4.9 branch now.  OK for both or at least for the
> trunk?

Obviously OK :)
thanks!
> 
> Thanks,
> 
> Martin
> 
> 
> 2014-06-25  Martin Jambor  <mjambor@suse.cz>
> 
> 	* ipa-prop.c (ipa_impossible_devirt_target): No longer static,
> 	renamed to ipa_impossible_devirt_target.  Fix typo.
> 	* ipa-prop.h (ipa_impossible_devirt_target): Declare.
> 	* ipa-cp.c (ipa_get_indirect_edge_target_1): Use
> 	ipa_impossible_devirt_target.
> 
> testsuite/
> 	* g++.dg/ipa/pr60600.C: Fix typo.
> 	* g++.dg/ipa/devirt-25.C: Likewise.
> 	* g++.dg/ipa/pr61540.C: Likewise.
> 
> Index: src/gcc/ipa-cp.c
> ===================================================================
> --- src.orig/gcc/ipa-cp.c
> +++ src/gcc/ipa-cp.c
> @@ -1587,15 +1587,7 @@ ipa_get_indirect_edge_target_1 (struct c
>  		   && DECL_FUNCTION_CODE (target) == BUILT_IN_UNREACHABLE)
>  		  || !possible_polymorphic_call_target_p
>  		       (ie, cgraph_get_node (target)))
> -		{
> -		  if (dump_file)
> -		    fprintf (dump_file,
> -			     "Type inconsident devirtualization: %s/%i->%s\n",
> -			     ie->caller->name (), ie->caller->order,
> -			     IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (target)));
> -		  target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
> -		  cgraph_get_create_node (target);
> -		}
> +		target = ipa_impossible_devirt_target (ie, target);
>  	      return target;
>  	    }
>  	}
> @@ -1629,7 +1621,7 @@ ipa_get_indirect_edge_target_1 (struct c
>        if (targets.length () == 1)
>  	target = targets[0]->decl;
>        else
> -	target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
> +	target = ipa_impossible_devirt_target (ie, NULL_TREE);
>      }
>    else
>      {
> @@ -1643,15 +1635,7 @@ ipa_get_indirect_edge_target_1 (struct c
>  
>    if (target && !possible_polymorphic_call_target_p (ie,
>  						     cgraph_get_node (target)))
> -    {
> -      if (dump_file)
> -	fprintf (dump_file,
> -		 "Type inconsident devirtualization: %s/%i->%s\n",
> -		 ie->caller->name (), ie->caller->order,
> -		 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (target)));
> -      target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
> -      cgraph_get_create_node (target);
> -    }
> +    target = ipa_impossible_devirt_target (ie, target);
>  
>    return target;
>  }
> Index: src/gcc/ipa-prop.c
> ===================================================================
> --- src.orig/gcc/ipa-prop.c
> +++ src/gcc/ipa-prop.c
> @@ -2915,14 +2915,14 @@ try_make_edge_direct_simple_call (struct
>  /* Return the target to be used in cases of impossible devirtualization.  IE
>     and target (the latter can be NULL) are dumped when dumping is enabled.  */
>  
> -static tree
> -impossible_devirt_target (struct cgraph_edge *ie, tree target)
> +tree
> +ipa_impossible_devirt_target (struct cgraph_edge *ie, tree target)
>  {
>    if (dump_file)
>      {
>        if (target)
>  	fprintf (dump_file,
> -		 "Type inconsident devirtualization: %s/%i->%s\n",
> +		 "Type inconsistent devirtualization: %s/%i->%s\n",
>  		 ie->caller->name (), ie->caller->order,
>  		 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (target)));
>        else
> @@ -2969,7 +2969,7 @@ try_make_edge_direct_virtual_call (struc
>  		   && DECL_FUNCTION_CODE (target) == BUILT_IN_UNREACHABLE)
>  		  || !possible_polymorphic_call_target_p
>  		       (ie, cgraph_get_node (target)))
> -		target = impossible_devirt_target (ie, target);
> +		target = ipa_impossible_devirt_target (ie, target);
>  	      return ipa_make_edge_direct_to_target (ie, target);
>  	    }
>  	}
> @@ -2999,7 +2999,7 @@ try_make_edge_direct_virtual_call (struc
>        if (targets.length () == 1)
>  	target = targets[0]->decl;
>        else
> -	target = impossible_devirt_target (ie, NULL_TREE);
> +	target = ipa_impossible_devirt_target (ie, NULL_TREE);
>      }
>    else
>      {
> @@ -3015,7 +3015,7 @@ try_make_edge_direct_virtual_call (struc
>    if (target)
>      {
>        if (!possible_polymorphic_call_target_p (ie, cgraph_get_node (target)))
> -	target = impossible_devirt_target (ie, target);
> +	target = ipa_impossible_devirt_target (ie, target);
>        return ipa_make_edge_direct_to_target (ie, target);
>      }
>    else
> Index: src/gcc/ipa-prop.h
> ===================================================================
> --- src.orig/gcc/ipa-prop.h
> +++ src/gcc/ipa-prop.h
> @@ -586,6 +586,7 @@ tree ipa_get_indirect_edge_target (struc
>  struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree);
>  tree ipa_binfo_from_known_type_jfunc (struct ipa_jump_func *);
>  tree ipa_intraprocedural_devirtualization (gimple);
> +tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
>  
>  /* Functions related to both.  */
>  void ipa_analyze_node (struct cgraph_node *);
> Index: src/gcc/testsuite/g++.dg/ipa/devirt-25.C
> ===================================================================
> --- src.orig/gcc/testsuite/g++.dg/ipa/devirt-25.C
> +++ src/gcc/testsuite/g++.dg/ipa/devirt-25.C
> @@ -22,5 +22,5 @@ void dpr_run(ebs_Object& objectA) {
>    dpr_Job jobL;
>    dpr_run(jobL);
>  }
> -/* { dg-final { scan-ipa-dump "Type inconsident devirtualization" "cp"  } } */
> +/* { dg-final { scan-ipa-dump "Type inconsistent devirtualization" "cp"  } } */
>  /* { dg-final { cleanup-ipa-dump "cp" } } */
> Index: src/gcc/testsuite/g++.dg/ipa/pr60600.C
> ===================================================================
> --- src.orig/gcc/testsuite/g++.dg/ipa/pr60600.C
> +++ src/gcc/testsuite/g++.dg/ipa/pr60600.C
> @@ -30,5 +30,5 @@ void test(top& t)
>      test(d);
>  }
>  
> -/* { dg-final { scan-ipa-dump "Type inconsident devirtualization" "cp" } } */
> +/* { dg-final { scan-ipa-dump "Type inconsistent devirtualization" "cp" } } */
>  /* { dg-final { cleanup-ipa-dump "cp" } } */
> Index: src/gcc/testsuite/g++.dg/ipa/pr61540.C
> ===================================================================
> --- src.orig/gcc/testsuite/g++.dg/ipa/pr61540.C
> +++ src/gcc/testsuite/g++.dg/ipa/pr61540.C
> @@ -37,5 +37,5 @@ int main (int argc, char **argv)
>    return 0;
>  }
>  
> -/* { dg-final { scan-ipa-dump "Type inconsident devirtualization" "cp" } } */
> +/* { dg-final { scan-ipa-dump "Type inconsistent devirtualization" "cp" } } */
>  /* { dg-final { cleanup-ipa-dump "cp" } } */
diff mbox

Patch

Index: src/gcc/ipa-cp.c
===================================================================
--- src.orig/gcc/ipa-cp.c
+++ src/gcc/ipa-cp.c
@@ -1587,15 +1587,7 @@  ipa_get_indirect_edge_target_1 (struct c
 		   && DECL_FUNCTION_CODE (target) == BUILT_IN_UNREACHABLE)
 		  || !possible_polymorphic_call_target_p
 		       (ie, cgraph_get_node (target)))
-		{
-		  if (dump_file)
-		    fprintf (dump_file,
-			     "Type inconsident devirtualization: %s/%i->%s\n",
-			     ie->caller->name (), ie->caller->order,
-			     IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (target)));
-		  target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
-		  cgraph_get_create_node (target);
-		}
+		target = ipa_impossible_devirt_target (ie, target);
 	      return target;
 	    }
 	}
@@ -1629,7 +1621,7 @@  ipa_get_indirect_edge_target_1 (struct c
       if (targets.length () == 1)
 	target = targets[0]->decl;
       else
-	target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
+	target = ipa_impossible_devirt_target (ie, NULL_TREE);
     }
   else
     {
@@ -1643,15 +1635,7 @@  ipa_get_indirect_edge_target_1 (struct c
 
   if (target && !possible_polymorphic_call_target_p (ie,
 						     cgraph_get_node (target)))
-    {
-      if (dump_file)
-	fprintf (dump_file,
-		 "Type inconsident devirtualization: %s/%i->%s\n",
-		 ie->caller->name (), ie->caller->order,
-		 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (target)));
-      target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
-      cgraph_get_create_node (target);
-    }
+    target = ipa_impossible_devirt_target (ie, target);
 
   return target;
 }
Index: src/gcc/ipa-prop.c
===================================================================
--- src.orig/gcc/ipa-prop.c
+++ src/gcc/ipa-prop.c
@@ -2915,14 +2915,14 @@  try_make_edge_direct_simple_call (struct
 /* Return the target to be used in cases of impossible devirtualization.  IE
    and target (the latter can be NULL) are dumped when dumping is enabled.  */
 
-static tree
-impossible_devirt_target (struct cgraph_edge *ie, tree target)
+tree
+ipa_impossible_devirt_target (struct cgraph_edge *ie, tree target)
 {
   if (dump_file)
     {
       if (target)
 	fprintf (dump_file,
-		 "Type inconsident devirtualization: %s/%i->%s\n",
+		 "Type inconsistent devirtualization: %s/%i->%s\n",
 		 ie->caller->name (), ie->caller->order,
 		 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (target)));
       else
@@ -2969,7 +2969,7 @@  try_make_edge_direct_virtual_call (struc
 		   && DECL_FUNCTION_CODE (target) == BUILT_IN_UNREACHABLE)
 		  || !possible_polymorphic_call_target_p
 		       (ie, cgraph_get_node (target)))
-		target = impossible_devirt_target (ie, target);
+		target = ipa_impossible_devirt_target (ie, target);
 	      return ipa_make_edge_direct_to_target (ie, target);
 	    }
 	}
@@ -2999,7 +2999,7 @@  try_make_edge_direct_virtual_call (struc
       if (targets.length () == 1)
 	target = targets[0]->decl;
       else
-	target = impossible_devirt_target (ie, NULL_TREE);
+	target = ipa_impossible_devirt_target (ie, NULL_TREE);
     }
   else
     {
@@ -3015,7 +3015,7 @@  try_make_edge_direct_virtual_call (struc
   if (target)
     {
       if (!possible_polymorphic_call_target_p (ie, cgraph_get_node (target)))
-	target = impossible_devirt_target (ie, target);
+	target = ipa_impossible_devirt_target (ie, target);
       return ipa_make_edge_direct_to_target (ie, target);
     }
   else
Index: src/gcc/ipa-prop.h
===================================================================
--- src.orig/gcc/ipa-prop.h
+++ src/gcc/ipa-prop.h
@@ -586,6 +586,7 @@  tree ipa_get_indirect_edge_target (struc
 struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree);
 tree ipa_binfo_from_known_type_jfunc (struct ipa_jump_func *);
 tree ipa_intraprocedural_devirtualization (gimple);
+tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
 
 /* Functions related to both.  */
 void ipa_analyze_node (struct cgraph_node *);
Index: src/gcc/testsuite/g++.dg/ipa/devirt-25.C
===================================================================
--- src.orig/gcc/testsuite/g++.dg/ipa/devirt-25.C
+++ src/gcc/testsuite/g++.dg/ipa/devirt-25.C
@@ -22,5 +22,5 @@  void dpr_run(ebs_Object& objectA) {
   dpr_Job jobL;
   dpr_run(jobL);
 }
-/* { dg-final { scan-ipa-dump "Type inconsident devirtualization" "cp"  } } */
+/* { dg-final { scan-ipa-dump "Type inconsistent devirtualization" "cp"  } } */
 /* { dg-final { cleanup-ipa-dump "cp" } } */
Index: src/gcc/testsuite/g++.dg/ipa/pr60600.C
===================================================================
--- src.orig/gcc/testsuite/g++.dg/ipa/pr60600.C
+++ src/gcc/testsuite/g++.dg/ipa/pr60600.C
@@ -30,5 +30,5 @@  void test(top& t)
     test(d);
 }
 
-/* { dg-final { scan-ipa-dump "Type inconsident devirtualization" "cp" } } */
+/* { dg-final { scan-ipa-dump "Type inconsistent devirtualization" "cp" } } */
 /* { dg-final { cleanup-ipa-dump "cp" } } */
Index: src/gcc/testsuite/g++.dg/ipa/pr61540.C
===================================================================
--- src.orig/gcc/testsuite/g++.dg/ipa/pr61540.C
+++ src/gcc/testsuite/g++.dg/ipa/pr61540.C
@@ -37,5 +37,5 @@  int main (int argc, char **argv)
   return 0;
 }
 
-/* { dg-final { scan-ipa-dump "Type inconsident devirtualization" "cp" } } */
+/* { dg-final { scan-ipa-dump "Type inconsistent devirtualization" "cp" } } */
 /* { dg-final { cleanup-ipa-dump "cp" } } */