Commit 8d2c775f by Daniel Berlin Committed by Daniel Berlin

re PR tree-optimization/24117 (struct is not marked fully as call clobbered)

2005-09-29  Daniel Berlin  <dberlin@dberlin.org>

	Fix PR tree-optimization/24117
	* tree-ssa-structalias.c (find_func_aliases): Strip nops
	before considering whether to use anyoffset.

From-SVN: r104791
parent ffc53fb0
2005-09-29 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/24117
* tree-ssa-structalias.c (find_func_aliases): Strip nops
before considering whether to use anyoffset.
2005-09-29 Paolo Bonzini <bonzini@gnu.org> 2005-09-29 Paolo Bonzini <bonzini@gnu.org>
Revert this patch: Revert this patch:
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
typedef struct {
int x;
int z;
} Foo_t;
char *xm;
void bar(void);
void foo(void)
{
Foo_t x;
x.x = 1;
x.z = 2;
xm = (char *)&x;
bar();
/* We can't propagate x.z past bar, so this link_error should still be there. */
if (x.z != 2)
link_error ();
}
/* { dg-final { scan-tree-dump-times "link_error" 1 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
...@@ -2817,16 +2817,18 @@ find_func_aliases (tree t, struct alias_info *ai) ...@@ -2817,16 +2817,18 @@ find_func_aliases (tree t, struct alias_info *ai)
case tcc_expression: case tcc_expression:
case tcc_unary: case tcc_unary:
{ {
tree anyoffsetrhs = rhsop;
bool need_anyoffset = false; bool need_anyoffset = false;
rhs = get_constraint_for (rhsop, &need_anyoffset); rhs = get_constraint_for (rhsop, &need_anyoffset);
process_constraint (new_constraint (lhs, rhs)); process_constraint (new_constraint (lhs, rhs));
STRIP_NOPS (anyoffsetrhs);
/* When taking the address of an aggregate /* When taking the address of an aggregate
type, from the LHS we can access any field type, from the LHS we can access any field
of the RHS. */ of the RHS. */
if (need_anyoffset || (rhs.type == ADDRESSOF if (need_anyoffset || (rhs.type == ADDRESSOF
&& !(get_varinfo (rhs.var)->is_special_var) && !(get_varinfo (rhs.var)->is_special_var)
&& AGGREGATE_TYPE_P (TREE_TYPE (TREE_TYPE (rhsop))))) && AGGREGATE_TYPE_P (TREE_TYPE (TREE_TYPE (anyoffsetrhs)))))
{ {
rhs.var = anyoffset_id; rhs.var = anyoffset_id;
rhs.type = ADDRESSOF; rhs.type = ADDRESSOF;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment