summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 8bf824250e4..95a2fa13864 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -936,7 +936,9 @@ static tree
fold_const_aggregate_ref (tree t)
{
prop_value_t *value;
- tree base, ctor, idx, field, elt;
+ tree base, ctor, idx, field;
+ unsigned HOST_WIDE_INT cnt;
+ tree cfield, cval;
switch (TREE_CODE (t))
{
@@ -993,13 +995,9 @@ fold_const_aggregate_ref (tree t)
}
/* Whoo-hoo! I'll fold ya baby. Yeah! */
- for (elt = CONSTRUCTOR_ELTS (ctor);
- (elt && !tree_int_cst_equal (TREE_PURPOSE (elt), idx));
- elt = TREE_CHAIN (elt))
- ;
-
- if (elt)
- return TREE_VALUE (elt);
+ FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), cnt, cfield, cval)
+ if (tree_int_cst_equal (cfield, idx))
+ return cval;
break;
case COMPONENT_REF:
@@ -1035,11 +1033,11 @@ fold_const_aggregate_ref (tree t)
field = TREE_OPERAND (t, 1);
- for (elt = CONSTRUCTOR_ELTS (ctor); elt; elt = TREE_CHAIN (elt))
- if (TREE_PURPOSE (elt) == field
+ FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), cnt, cfield, cval)
+ if (cfield == field
/* FIXME: Handle bit-fields. */
- && ! DECL_BIT_FIELD (TREE_PURPOSE (elt)))
- return TREE_VALUE (elt);
+ && ! DECL_BIT_FIELD (cfield))
+ return cval;
break;
default: