diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8bc1dce26973..4012cf395bd9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2010-09-06 Richard Guenther + + PR tree-optimization/45534 + * tree-ssa-address.c (create_mem_ref_raw): Add verify parameter. + (create_mem_ref): Do verify the created TARGET_MEM_REF is valid + on the target. + (maybe_fold_tmr): Do not verify the created TARGET_MEM_REF is + valid on the target. + 2010-09-06 Andreas Schwab * configure.ac: Quote argument of AC_MSG_WARN. @@ -5,7 +14,8 @@ 2010-09-06 Alexander Monakov - * sel-sched.c (move_cond_jump): Correct arguments to maybe_tidy_empty_bb. + * sel-sched.c (move_cond_jump): Correct arguments to + maybe_tidy_empty_bb. * sel-sched-ir.c (maybe_tidy_empty_bb): Export. 2010-09-06 Andrey Belevantsev diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index 18c0e556220d..a9ca8354e2fc 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -324,14 +324,16 @@ valid_mem_ref_p (enum machine_mode mode, addr_space_t as, /* Checks whether a TARGET_MEM_REF with type TYPE and parameters given by ADDR is valid on the current target and if so, creates and returns the - TARGET_MEM_REF. */ + TARGET_MEM_REF. If VERIFY is false omit the verification step. */ static tree -create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr) +create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr, + bool verify) { tree base, index2; - if (!valid_mem_ref_p (TYPE_MODE (type), TYPE_ADDR_SPACE (type), addr)) + if (verify + && !valid_mem_ref_p (TYPE_MODE (type), TYPE_ADDR_SPACE (type), addr)) return NULL_TREE; if (addr->step && integer_onep (addr->step)) @@ -689,7 +691,7 @@ create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr, addr_to_parts (type, addr, iv_cand, base_hint, &parts, speed); gimplify_mem_ref_parts (gsi, &parts); - mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts); + mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts, true); if (mem_ref) return mem_ref; @@ -705,7 +707,7 @@ create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr, true, NULL_TREE, true, GSI_SAME_STMT); parts.step = NULL_TREE; - mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts); + mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts, true); if (mem_ref) return mem_ref; } @@ -740,7 +742,7 @@ create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr, parts.base = tmp; parts.symbol = NULL_TREE; - mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts); + mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts, true); if (mem_ref) return mem_ref; } @@ -761,7 +763,7 @@ create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr, parts.base = parts.index; parts.index = NULL_TREE; - mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts); + mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts, true); if (mem_ref) return mem_ref; } @@ -783,7 +785,7 @@ create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr, parts.offset = NULL_TREE; - mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts); + mem_ref = create_mem_ref_raw (type, alias_ptr_type, &parts, true); if (mem_ref) return mem_ref; } @@ -899,10 +901,12 @@ maybe_fold_tmr (tree ref) if (!changed) return NULL_TREE; - ret = create_mem_ref_raw (TREE_TYPE (ref), TREE_TYPE (addr.offset), &addr); - if (!ret) - return NULL_TREE; - + /* If we have propagated something into this TARGET_MEM_REF and thus + ended up folding it, always create a new TARGET_MEM_REF regardless + if it is valid in this for on the target - the propagation result + wouldn't be anyway. */ + ret = create_mem_ref_raw (TREE_TYPE (ref), + TREE_TYPE (addr.offset), &addr, false); copy_mem_ref_info (ret, ref); return ret; }