From be35cf60c40ae1c70bb1d1520f66141228d53aa5 Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Sun, 26 Sep 2004 10:32:40 +0200 Subject: re PR tree-optimization/17591 (Ada bootstrap SEGV in stage2 on osint.adb, no SEGV when -fno-ivopts) PR bootstrap/17591 * tree-ssa-loop-im.c (for_each_index): Call callback for component_refs with varying offset. * tree-ssa-loop-ivopts.c (abnormal_ssa_name_p): New function. (idx_contains_abnormal_ssa_name_p): Scan step and lower bound for ARRAY_REFS. (expr_invariant_in_loop_p): New function. (idx_find_step): Handle step and lower bound for ARRAY_REFs. Handle component_ref_field_offset for COMPONENT_REFs. Do not allow ALIGN_INDIRECT_REFs and MISALIGNED_INDIRECT_REFs. (add_address_candidates): Do not handle ALIGN_INDIRECT_REFs and MISALIGNED_INDIRECT_REFs. (idx_remove_ssa_names): Handle step and lower bound for ARRAY_REFs. (rewrite_address_base): Do not handle ALIGN_INDIRECT_REFs and MISALIGNED_INDIRECT_REFs. From-SVN: r88123 --- gcc/tree-ssa-loop-im.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa-loop-im.c') diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 4aafc81..0330a27 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -128,7 +128,7 @@ get_stmt_uid (tree stmt) bool for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data) { - tree *nxt; + tree *nxt, *idx; for (; ; addr_p = nxt) { @@ -144,7 +144,6 @@ for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data) return cbck (*addr_p, nxt, data); case BIT_FIELD_REF: - case COMPONENT_REF: case VIEW_CONVERT_EXPR: case ARRAY_RANGE_REF: case REALPART_EXPR: @@ -152,6 +151,17 @@ for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data) nxt = &TREE_OPERAND (*addr_p, 0); break; + case COMPONENT_REF: + /* If the component has varying offset, it behaves like index + as well. */ + idx = &TREE_OPERAND (*addr_p, 2); + if (*idx + && !cbck (*addr_p, idx, data)) + return false; + + nxt = &TREE_OPERAND (*addr_p, 0); + break; + case ARRAY_REF: nxt = &TREE_OPERAND (*addr_p, 0); if (!cbck (*addr_p, &TREE_OPERAND (*addr_p, 1), data)) -- cgit v1.1