diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dd7c384d843..549a9b786e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-09-09 Zdenek Dvorak + + PR tree-optimization/23509 + * tree-cfg.c (replace_uses_by): Use replace_exp. + * tree-ssa-loop-ivopts.c (get_ref_tag): Assert that dereferenced + pointers have name_mem_tag or type_mem_tag set. + 2005-09-09 Sebastian Pop * tree-chrec.c (evolution_function_is_invariant_rec_p): Use diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 37115562974..75c14f426ff 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1237,8 +1237,7 @@ replace_uses_by (tree name, tree val) FOR_EACH_IMM_USE_SAFE (use, imm_iter, name) { stmt = USE_STMT (use); - - SET_USE (use, val); + replace_exp (use, val); if (TREE_CODE (stmt) == PHI_NODE) { diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index d0a186a166a..44ebc5ca28e 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -5448,9 +5448,13 @@ get_ref_tag (tree ref) return NULL_TREE; if (TREE_CODE (var) == INDIRECT_REF) - var = TREE_OPERAND (var, 0); - if (TREE_CODE (var) == SSA_NAME) { + /* In case the base is a dereference of a pointer, first check its name + mem tag, and if it does not have one, use type mem tag. */ + var = TREE_OPERAND (var, 0); + if (TREE_CODE (var) != SSA_NAME) + return NULL_TREE; + if (SSA_NAME_PTR_INFO (var)) { tag = SSA_NAME_PTR_INFO (var)->name_mem_tag; @@ -5459,18 +5463,21 @@ get_ref_tag (tree ref) } var = SSA_NAME_VAR (var); + tag = var_ann (var)->type_mem_tag; + gcc_assert (tag != NULL_TREE); + return tag; } - - if (DECL_P (var)) - { + else + { + if (!DECL_P (var)) + return NULL_TREE; + tag = var_ann (var)->type_mem_tag; if (tag) return tag; return var; } - - return NULL_TREE; } /* Copies the reference information from OLD_REF to NEW_REF. */