Commit 0de204de by Andrew Pinski Committed by Andrew Pinski

re PR middle-end/49671 (volatile goes missing after inlining)

2011-07-25  Andrew Pinski  <apinski@cavium.com>

	PR tree-opt/49671
	* tree-inline.c (remap_gimple_op_r): Copy TREE_THIS_VOLATILE and
	TREE_THIS_NOTRAP into the inner most MEM_REF.
	Always copy TREE_THIS_VOLATILE.
	* tree-sra.c (ptr_parm_has_direct_uses): Check that the lhs, rhs and
	arguments are not volatile references.

2011-07-25  Andrew Pinski  <apinski@cavium.com>

	PR tree-opt/49671
	* gcc.dg/tree-ssa/pr49671-1.c: New testcase.
	* gcc.dg/tree-ssa/pr49671-2.c: New testcase.

From-SVN: r176782
parent 9bc13c23
2011-07-25 Andrew Pinski <apinski@cavium.com>
PR tree-opt/49671
* tree-inline.c (remap_gimple_op_r): Copy TREE_THIS_VOLATILE and
TREE_THIS_NOTRAP into the inner most MEM_REF.
Always copy TREE_THIS_VOLATILE.
* tree-sra.c (ptr_parm_has_direct_uses): Check that the lhs, rhs and
arguments are not volatile references.
2011-07-25 Richard Henderson <rth@redhat.com> 2011-07-25 Richard Henderson <rth@redhat.com>
* insn-notes.def (NOTE_INSN_CFA_RESTORE_STATE): Remove. * insn-notes.def (NOTE_INSN_CFA_RESTORE_STATE): Remove.
......
2011-07-25 Andrew Pinski <apinski@cavium.com>
PR tree-opt/49671
* gcc.dg/tree-ssa/pr49671-1.c: New testcase.
* gcc.dg/tree-ssa/pr49671-2.c: New testcase.
2011-07-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2011-07-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* lib/target-supports.exp (check_effective_target_mmap): New proc. * lib/target-supports.exp (check_effective_target_mmap): New proc.
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
volatile int t;
static inline int cvmx_atomic_get32(volatile int *ptr)
{
return *ptr;
}
void f(void)
{
while (!cvmx_atomic_get32(&t))
;
}
/* { dg-final { scan-tree-dump "\{v\}" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
int t;
static inline int cvmx_atomic_get32(int *ptr)
{
return *(volatile int*)ptr;
}
void f(void)
{
while (!cvmx_atomic_get32(&t))
;
}
/* { dg-final { scan-tree-dump "\{v\}" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
...@@ -881,14 +881,16 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) ...@@ -881,14 +881,16 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
build_int_cst build_int_cst
(TREE_TYPE (TREE_OPERAND (*tp, 1)), 0)); (TREE_TYPE (TREE_OPERAND (*tp, 1)), 0));
*tp = tem; *tp = tem;
TREE_THIS_VOLATILE (*tem_basep) = TREE_THIS_VOLATILE (old);
TREE_THIS_NOTRAP (*tem_basep) = TREE_THIS_NOTRAP (old);
} }
else else
{ {
*tp = fold_build2 (MEM_REF, type, *tp = fold_build2 (MEM_REF, type,
ptr, TREE_OPERAND (*tp, 1)); ptr, TREE_OPERAND (*tp, 1));
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old); TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
} }
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old); TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
*walk_subtrees = 0; *walk_subtrees = 0;
return NULL; return NULL;
......
...@@ -3302,7 +3302,8 @@ ptr_parm_has_direct_uses (tree parm) ...@@ -3302,7 +3302,8 @@ ptr_parm_has_direct_uses (tree parm)
&& TREE_OPERAND (lhs, 0) == name && TREE_OPERAND (lhs, 0) == name
&& integer_zerop (TREE_OPERAND (lhs, 1)) && integer_zerop (TREE_OPERAND (lhs, 1))
&& types_compatible_p (TREE_TYPE (lhs), && types_compatible_p (TREE_TYPE (lhs),
TREE_TYPE (TREE_TYPE (name)))) TREE_TYPE (TREE_TYPE (name)))
&& !TREE_THIS_VOLATILE (lhs))
uses_ok++; uses_ok++;
} }
if (gimple_assign_single_p (stmt)) if (gimple_assign_single_p (stmt))
...@@ -3314,7 +3315,8 @@ ptr_parm_has_direct_uses (tree parm) ...@@ -3314,7 +3315,8 @@ ptr_parm_has_direct_uses (tree parm)
&& TREE_OPERAND (rhs, 0) == name && TREE_OPERAND (rhs, 0) == name
&& integer_zerop (TREE_OPERAND (rhs, 1)) && integer_zerop (TREE_OPERAND (rhs, 1))
&& types_compatible_p (TREE_TYPE (rhs), && types_compatible_p (TREE_TYPE (rhs),
TREE_TYPE (TREE_TYPE (name)))) TREE_TYPE (TREE_TYPE (name)))
&& !TREE_THIS_VOLATILE (rhs))
uses_ok++; uses_ok++;
} }
else if (is_gimple_call (stmt)) else if (is_gimple_call (stmt))
...@@ -3329,7 +3331,8 @@ ptr_parm_has_direct_uses (tree parm) ...@@ -3329,7 +3331,8 @@ ptr_parm_has_direct_uses (tree parm)
&& TREE_OPERAND (arg, 0) == name && TREE_OPERAND (arg, 0) == name
&& integer_zerop (TREE_OPERAND (arg, 1)) && integer_zerop (TREE_OPERAND (arg, 1))
&& types_compatible_p (TREE_TYPE (arg), && types_compatible_p (TREE_TYPE (arg),
TREE_TYPE (TREE_TYPE (name)))) TREE_TYPE (TREE_TYPE (name)))
&& !TREE_THIS_VOLATILE (arg))
uses_ok++; uses_ok++;
} }
} }
......
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