This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Properly generate constraints for CONSTRUCTORs
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Apr 2010 15:36:00 +0200 (CEST)
- Subject: [PATCH] Properly generate constraints for CONSTRUCTORs
For IPA-PTA we currently generate constraints from ANYTHING whenever
we see a global CONSTRUCTOR initializer. That's going to pessimize
us needlessly. The following patch makes us collect constraints
for all initializer elements instead.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2010-04-30 Richard Guenther <rguenther@suse.de>
* tree-ssa-structalias.c (get_constraint_for_1): Generate
constraints for CONSTRUCTOR.
Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c (revision 158924)
--- gcc/tree-ssa-structalias.c (working copy)
*************** get_constraint_for_1 (tree t, VEC (ce_s,
*** 3352,3357 ****
--- 3352,3377 ----
get_constraint_for_ssa_var (t, results, address_p);
return;
}
+ case CONSTRUCTOR:
+ {
+ unsigned int i;
+ tree val;
+ VEC (ce_s, heap) *tmp = NULL;
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, val)
+ {
+ struct constraint_expr *rhsp;
+ unsigned j;
+ get_constraint_for_1 (val, &tmp, address_p);
+ for (j = 0; VEC_iterate (ce_s, tmp, j, rhsp); ++j)
+ VEC_safe_push (ce_s, heap, *results, rhsp);
+ VEC_truncate (ce_s, tmp, 0);
+ }
+ VEC_free (ce_s, heap, tmp);
+ /* We do not know whether the constructor was complete,
+ so technically we have to add &NOTHING or &ANYTHING
+ like we do for an empty constructor as well. */
+ return;
+ }
default:;
}
break;