From: Richard Kenner Date: Fri, 25 Jun 2004 20:33:09 +0000 (+0000) Subject: tree-nested.c (build_addr): Merge real/imagpart with handled_component_p. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f44bc38a5532e8d1ac357bf56aaef1fbd1899d3;p=gcc.git tree-nested.c (build_addr): Merge real/imagpart with handled_component_p. * 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. From-SVN: r83677 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4de541bbb6c..f38a5e0ad50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-06-25 Richard Kenner + + * 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 PR wrong-code/16129 diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 1f32e1f60f9..10bf1ce091c 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -158,11 +158,9 @@ build_addr (tree exp) { 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; @@ -797,7 +795,6 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data) } break; - case COMPONENT_REF: case REALPART_EXPR: case IMAGPART_EXPR: wi->val_only = false; @@ -805,6 +802,13 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data) 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; @@ -932,7 +936,6 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data) tsi_link_after (&wi->tsi, x, TSI_SAME_STMT); break; - case COMPONENT_REF: case REALPART_EXPR: case IMAGPART_EXPR: wi->val_only = false; @@ -940,6 +943,13 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data) 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; diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index f19afdde6a1..517e2b8df53 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -1763,17 +1763,21 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, 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)