This is the mail archive of the
mailing list for the GCC project.
[PATCH, PR 55334] Disable IPA-CP on restrict pointers to arrays
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jan Hubicka <hubicka at ucw dot cz>
- Date: Mon, 18 Feb 2013 21:06:23 +0100
- Subject: [PATCH, PR 55334] Disable IPA-CP on restrict pointers to arrays
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
2013-02-07 Martin Jambor <email@example.com>
* ipa-cp.c (initialize_node_lattices): Disable IPA-CP through and to
restricted pointers to arrays.
@@ -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)