+2004-06-25 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * tree-nested.c (build_addr): Merge real/imagpart with
+ handled_component_p.
+ (convert_nonlocal_reference, convert_local_reference): Process extra
+ args to COMPONENT_REF and ARRAY_REF.
+ * tree-outof-ssa.c (discover_nonconstant_array_refs_r): Check for
+ lower bound and field offset being constant.
+
2004-06-25 Mark Mitchell <mark@codesourcery.com>
PR wrong-code/16129
{
tree base = exp;
- if (TREE_CODE (base) == REALPART_EXPR || TREE_CODE (base) == IMAGPART_EXPR)
+ while (TREE_CODE (base) == REALPART_EXPR || TREE_CODE (base) == IMAGPART_EXPR
+ || handled_component_p (base))
base = TREE_OPERAND (base, 0);
- else
- while (handled_component_p (base))
- base = TREE_OPERAND (base, 0);
if (DECL_P (base))
TREE_ADDRESSABLE (base) = 1;
}
break;
- case COMPONENT_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
wi->val_only = false;
wi->val_only = true;
break;
+ case COMPONENT_REF:
+ wi->val_only = false;
+ walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
+ wi->val_only = true;
+ walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi, NULL);
+ break;
+
case ARRAY_REF:
case ARRAY_RANGE_REF:
wi->val_only = false;
tsi_link_after (&wi->tsi, x, TSI_SAME_STMT);
break;
- case COMPONENT_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
wi->val_only = false;
wi->val_only = true;
break;
+ case COMPONENT_REF:
+ wi->val_only = false;
+ walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
+ wi->val_only = true;
+ walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi, NULL);
+ break;
+
case ARRAY_REF:
case ARRAY_RANGE_REF:
wi->val_only = false;
if (TYPE_P (t) || DECL_P (t))
*walk_subtrees = 0;
- else if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
+ if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
{
while (((TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
- && is_gimple_min_invariant (TREE_OPERAND (t, 1)))
+ && is_gimple_min_invariant (TREE_OPERAND (t, 1))
+ && (!TREE_OPERAND (t, 2)
+ || is_gimple_min_invariant (TREE_OPERAND (t, 2))))
|| (TREE_CODE (t) == COMPONENT_REF
- || TREE_CODE (t) == BIT_FIELD_REF
- || TREE_CODE (t) == REALPART_EXPR
- || TREE_CODE (t) == IMAGPART_EXPR
- || TREE_CODE (t) == VIEW_CONVERT_EXPR
- || TREE_CODE (t) == NOP_EXPR
- || TREE_CODE (t) == CONVERT_EXPR))
+ && (!TREE_OPERAND (t,2)
+ || is_gimple_min_invariant (TREE_OPERAND (t, 2))))
+ || TREE_CODE (t) == BIT_FIELD_REF
+ || TREE_CODE (t) == REALPART_EXPR
+ || TREE_CODE (t) == IMAGPART_EXPR
+ || TREE_CODE (t) == VIEW_CONVERT_EXPR
+ || TREE_CODE (t) == NOP_EXPR
+ || TREE_CODE (t) == CONVERT_EXPR)
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)