+2011-09-06 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/47025
+ * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): BUILT_IN_VA_END
+ uses nothing.
+ (call_may_clobber_ref_p_1): BUILT_IN_VA_END is a barrier like
+ BUILT_IN_FREE.
+ (stmt_kills_ref_p_1): BUILT_IN_VA_END kills what its argument
+ definitely points to.
+ * tree-ssa-structalias.c (find_func_aliases_for_builtin_call):
+ BUILT_IN_VA_START doesn't let its va_list argument escape.
+ * tree-ssa-dce.c (propagate_necessity): BUILT_IN_VA_END does
+ not make any previous stores necessary.
+
2011-09-06 Martin Jambor <mjambor@suse.cz>
* ipa-inline.h (struct inline_summary): Move versionable flag...
case BUILT_IN_SINCOSF:
case BUILT_IN_SINCOSL:
case BUILT_IN_ASSUME_ALIGNED:
+ case BUILT_IN_VA_END:
return false;
/* __sync_* builtins and some OpenMP builtins act as threading
barriers. */
the call has to serve as a barrier for moving loads and stores
across it. */
case BUILT_IN_FREE:
+ case BUILT_IN_VA_END:
{
tree ptr = gimple_call_arg (call, 0);
return ptr_deref_may_alias_ref_p_1 (ptr, ref);
/ BITS_PER_UNIT)))
return true;
}
+ break;
+ }
+
+ case BUILT_IN_VA_END:
+ {
+ tree ptr = gimple_call_arg (stmt, 0);
+ if (TREE_CODE (ptr) == ADDR_EXPR)
+ {
+ tree base = ao_ref_base (ref);
+ if (TREE_OPERAND (ptr, 0) == base)
+ return true;
+ }
+ break;
}
+
default:;
}
-
}
return false;
}
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_MALLOC
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_CALLOC
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_FREE
+ || DECL_FUNCTION_CODE (callee) == BUILT_IN_VA_END
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_ALLOCA
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_STACK_SAVE
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_STACK_RESTORE
mode as well. */
case BUILT_IN_VA_START:
{
+ tree valist = gimple_call_arg (t, 0);
+ struct constraint_expr rhs, *lhsp;
+ unsigned i;
+ get_constraint_for (valist, &lhsc);
+ do_deref (&lhsc);
+ /* The va_list gets access to pointers in variadic
+ arguments. Which we know in the case of IPA analysis
+ and otherwise are just all nonlocal variables. */
if (in_ipa_mode)
{
- tree valist = gimple_call_arg (t, 0);
- struct constraint_expr rhs, *lhsp;
- unsigned i;
- /* The va_list gets access to pointers in variadic
- arguments. */
fi = lookup_vi_for_tree (cfun->decl);
- gcc_assert (fi != NULL);
- get_constraint_for (valist, &lhsc);
- do_deref (&lhsc);
rhs = get_function_part_constraint (fi, ~0);
rhs.type = ADDRESSOF;
- FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
- process_constraint (new_constraint (*lhsp, rhs));
- VEC_free (ce_s, heap, lhsc);
- /* va_list is clobbered. */
- make_constraint_to (get_call_clobber_vi (t)->id, valist);
- return true;
}
- break;
+ else
+ {
+ rhs.var = nonlocal_id;
+ rhs.type = ADDRESSOF;
+ rhs.offset = 0;
+ }
+ FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
+ process_constraint (new_constraint (*lhsp, rhs));
+ VEC_free (ce_s, heap, lhsc);
+ /* va_list is clobbered. */
+ make_constraint_to (get_call_clobber_vi (t)->id, valist);
+ return true;
}
/* va_end doesn't have any effect that matters. */
case BUILT_IN_VA_END: