+2005-12-19 Zdenek Dvorak <dvorakz@suse.cz>
+
+ PR tree-optimization/24793
+ * tree-ssa-loop-ivopts.c (get_ref_tag): Remember the
+ original reference if there are subvars.
+ * tree-ssa-operands.c (get_tmr_operands): Handle subvars.
+
2005-12-19 Kenneth Zadeck <zadeck@naturalbridge.com>
+
* df.c (df_analyze_1, df_analyze_subcfg, iterative_dataflow):
Corrected basic block number calculations for changes in entry and
exit numbering.
and extracts this single useful piece of information. */
static tree
-get_ref_tag (tree ref)
+get_ref_tag (tree ref, tree orig)
{
tree var = get_base_address (ref);
- tree tag;
+ tree aref = NULL_TREE, tag, sv;
+ HOST_WIDE_INT offset, size, maxsize;
+
+ for (sv = orig; handled_component_p (sv); sv = TREE_OPERAND (sv, 0))
+ {
+ aref = get_ref_base_and_extent (sv, &offset, &size, &maxsize);
+ if (ref)
+ break;
+ }
+
+ if (aref && SSA_VAR_P (aref) && get_subvars_for_var (aref))
+ return unshare_expr (sv);
if (!var)
return NULL_TREE;
copy_mem_ref_info (new_ref, old_ref);
else
{
- TMR_TAG (new_ref) = get_ref_tag (old_ref);
TMR_ORIGINAL (new_ref) = unshare_and_remove_ssa_names (old_ref);
+ TMR_TAG (new_ref) = get_ref_tag (old_ref, TMR_ORIGINAL (new_ref));
}
}
static void
get_tmr_operands (tree stmt, tree expr, int flags)
{
- tree tag = TMR_TAG (expr);
+ tree tag = TMR_TAG (expr), ref;
+ HOST_WIDE_INT offset, size, maxsize;
+ subvar_t svars, sv;
+ stmt_ann_t s_ann = stmt_ann (stmt);
/* First record the real operands. */
get_expr_operands (stmt, &TMR_BASE (expr), opf_none);
add_to_addressable_set (TMR_SYMBOL (expr), &ann->addresses_taken);
}
- if (tag)
- get_expr_operands (stmt, &tag, flags);
- else
- /* Something weird, so ensure that we will be careful. */
- stmt_ann (stmt)->has_volatile_ops = true;
+ if (!tag)
+ {
+ /* Something weird, so ensure that we will be careful. */
+ stmt_ann (stmt)->has_volatile_ops = true;
+ return;
+ }
+
+ if (DECL_P (tag))
+ {
+ get_expr_operands (stmt, &tag, flags);
+ return;
+ }
+
+ ref = get_ref_base_and_extent (tag, &offset, &size, &maxsize);
+ gcc_assert (ref != NULL_TREE);
+ svars = get_subvars_for_var (ref);
+ for (sv = svars; sv; sv = sv->next)
+ {
+ bool exact;
+ if (overlap_subvar (offset, maxsize, sv, &exact))
+ {
+ int subvar_flags = flags;
+ if (!exact || size != maxsize)
+ subvar_flags &= ~opf_kill_def;
+ add_stmt_operand (&sv->var, s_ann, subvar_flags);
+ }
+ }
}
/* A subroutine of get_expr_operands to handle CALL_EXPR. */