Commit 3c1832c3 by Jan Hubicka Committed by Jan Hubicka

local-pure-const.c: New testcase.

	* gcc.dg/tree-ssa/local-pure-const.c: New testcase.
	* ipa-pure-const.c (check_op): Use PTA info to see if indirect_ref is
	local.

From-SVN: r149176
parent 92355a9c
2009-07-02 Jan Hubicka <jh@suse.cz>
* ipa-pure-const.c (check_op): Use PTA info to see if indirect_ref is
local.
2009-07-02 Paolo Bonzini <bonzini@gnu.org>
* expmed.c (emit_cstore, emit_store_flag_1): Accept target_mode
......
......@@ -213,13 +213,23 @@ check_decl (funct_state local,
static inline void
check_op (funct_state local, tree t, bool checking_write)
{
if (TREE_THIS_VOLATILE (t))
t = get_base_address (t);
if (t && TREE_THIS_VOLATILE (t))
{
local->pure_const_state = IPA_NEITHER;
if (dump_file)
fprintf (dump_file, " Volatile indirect ref is not const/pure\n");
return;
}
else if (t
&& INDIRECT_REF_P (t)
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
&& !ptr_deref_may_alias_global_p (TREE_OPERAND (t, 0)))
{
if (dump_file)
fprintf (dump_file, " Indirect ref to local memory is OK\n");
return;
}
else if (checking_write)
{
local->pure_const_state = IPA_NEITHER;
......
2009-07-02 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/local-pure-const.c: New testcase.
2009-07-01 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/truncate-4.c: New testcase.
......
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-local-pure-const1" } */
t(int a, int b, int c)
{
int *p;
if (a)
p = &a;
else
p = &c;
return *p;
}
/* { dg-final { scan-tree-dump-times "local memory is OK" 1 "local-pure-const1"} } */
/* { dg-final { scan-tree-dump-times "found to be const" 1 "local-pure-const1"} } */
/* { dg-final { cleanup-tree-dump "local-pure-const1" } } */
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