summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-13 11:31:22 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-13 11:31:22 +0000
commit86f29f5f1c262cbe1e6a4e0b4f5553e0321b21b0 (patch)
treed167a412f3467bad90305f5fa28608e706da4e32 /gcc/tree-ssa-structalias.c
parent9126b675de51f6dcdb8002cf7cb3e473c06bea46 (diff)
downloadgcc-86f29f5f1c262cbe1e6a4e0b4f5553e0321b21b0.tar.gz
2010-10-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45982 * tree-ssa-structalias.c (make_constraints_to): New function. (make_constraint_to): Implement in terms of make_constraints_to. (find_func_aliases): Properly make return values of pure/const functions escape if they assign to sth that is not a pointer. * gcc.dg/torture/pr45982.c: New testcase. * gcc.dg/tree-ssa/pr24287.c: Adjust. * gcc.dg/tree-ssa/pta-callused.c: Likewise. * gcc.dg/torture/pr39074-2.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165418 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index c2a82efa27c..707e31ca579 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -3563,12 +3563,11 @@ do_structure_copy (tree lhsop, tree rhsop)
VEC_free (ce_s, heap, rhsc);
}
-/* Create a constraint ID = OP. */
+/* Create constraints ID = { rhsc }. */
static void
-make_constraint_to (unsigned id, tree op)
+make_constraints_to (unsigned id, VEC(ce_s, heap) *rhsc)
{
- VEC(ce_s, heap) *rhsc = NULL;
struct constraint_expr *c;
struct constraint_expr includes;
unsigned int j;
@@ -3577,9 +3576,18 @@ make_constraint_to (unsigned id, tree op)
includes.offset = 0;
includes.type = SCALAR;
- get_constraint_for_rhs (op, &rhsc);
FOR_EACH_VEC_ELT (ce_s, rhsc, j, c)
process_constraint (new_constraint (includes, *c));
+}
+
+/* Create a constraint ID = OP. */
+
+static void
+make_constraint_to (unsigned id, tree op)
+{
+ VEC(ce_s, heap) *rhsc = NULL;
+ get_constraint_for_rhs (op, &rhsc);
+ make_constraints_to (id, rhsc);
VEC_free (ce_s, heap, rhsc);
}
@@ -4334,8 +4342,7 @@ find_func_aliases (gimple origt)
of global memory but not of escaped memory. */
if (flags & (ECF_CONST|ECF_NOVOPS))
{
- if (gimple_call_lhs (t)
- && could_have_pointers (gimple_call_lhs (t)))
+ if (gimple_call_lhs (t))
handle_const_call (t, &rhsc);
}
/* Pure functions can return addresses in and of memory
@@ -4345,9 +4352,17 @@ find_func_aliases (gimple origt)
handle_pure_call (t, &rhsc);
else
handle_rhs_call (t, &rhsc);
- if (gimple_call_lhs (t)
- && could_have_pointers (gimple_call_lhs (t)))
- handle_lhs_call (t, gimple_call_lhs (t), flags, rhsc, fndecl);
+ if (gimple_call_lhs (t))
+ {
+ if (could_have_pointers (gimple_call_lhs (t)))
+ handle_lhs_call (t, gimple_call_lhs (t), flags, rhsc, fndecl);
+ /* Similar to conversions a result that is not a pointer
+ is an escape point for any pointer the function might
+ return. */
+ else if (flags & (ECF_CONST|ECF_PURE
+ |ECF_NOVOPS|ECF_LOOPING_CONST_OR_PURE))
+ make_constraints_to (escaped_id, rhsc);
+ }
VEC_free (ce_s, heap, rhsc);
}
else