This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, PR 55334] Disable IPA-CP on restrict pointers to arrays


Hi,

after much pondering about PR 55334 I came to conclusion that no nice
fix to the regression could be introduced in stage4.  So for the sake
of the SPEC 200 benchmark I decided to cripple IPA-CP on restrict
pointers to arrays so that the restrict-ness of the memory references
which need to be vectorized is not lost.

I have tried various less aggressive tricks like only propagating the
one constant address that heuristics decided was profitable and not
all the others that came from the same calling contexts (and were
restrict) but then inlining came along and finished the deed with the
same consequences as IPA-CP had.

That only reinforced my feeling that the patch below is a spec hack
and that we ought to find a better way of preserving the restrict-ness
across IPA optimizations.  Therefore I will keep the bug open and
revert this patch after 4.8 is branched and stage1 opens.

Meanwhile, this passes bootstrap and testsuite on x86_64-linux.  OK
for trunk?

Thanks,

Martin


2013-02-07  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/55334
	* ipa-cp.c (initialize_node_lattices): Disable IPA-CP through and to
	restricted pointers to arrays.

Index: src/gcc/ipa-cp.c
===================================================================
--- src.orig/gcc/ipa-cp.c
+++ src/gcc/ipa-cp.c
@@ -730,6 +730,22 @@ initialize_node_lattices (struct cgraph_
 		 cgraph_node_name (node), node->uid,
 		 disable ? "BOTTOM" : "VARIABLE");
     }
+  if (!disable)
+    for (i = 0; i < ipa_get_param_count (info) ; i++)
+      {
+	struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
+	tree t = TREE_TYPE (ipa_get_param(info, i));
+
+	if (TYPE_RESTRICT (t) && POINTER_TYPE_P (t)
+	    && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
+	  {
+	    set_lattice_to_bottom (&plats->itself);
+	    if (dump_file && (dump_flags & TDF_DETAILS)
+		&& !node->alias && !node->thunk.thunk_p)
+	      fprintf (dump_file, "Going to ignore param %i of of %s/%i.\n",
+		       i, cgraph_node_name (node), node->uid);
+	  }
+      }
 
   for (ie = node->indirect_calls; ie; ie = ie->next_callee)
     if (ie->indirect_info->polymorphic)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]