+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>
* 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>
* lib/target-supports.exp (check_effective_target_mmap): New proc.
--- /dev/null
+/* { 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" } } */
+
+
--- /dev/null
+/* { 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" } } */
+
+
build_int_cst
(TREE_TYPE (TREE_OPERAND (*tp, 1)), 0));
*tp = tem;
+ TREE_THIS_VOLATILE (*tem_basep) = TREE_THIS_VOLATILE (old);
+ TREE_THIS_NOTRAP (*tem_basep) = TREE_THIS_NOTRAP (old);
}
else
{
*tp = fold_build2 (MEM_REF, type,
ptr, TREE_OPERAND (*tp, 1));
- TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (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);
*walk_subtrees = 0;
return NULL;
&& TREE_OPERAND (lhs, 0) == name
&& integer_zerop (TREE_OPERAND (lhs, 1))
&& types_compatible_p (TREE_TYPE (lhs),
- TREE_TYPE (TREE_TYPE (name))))
+ TREE_TYPE (TREE_TYPE (name)))
+ && !TREE_THIS_VOLATILE (lhs))
uses_ok++;
}
if (gimple_assign_single_p (stmt))
&& TREE_OPERAND (rhs, 0) == name
&& integer_zerop (TREE_OPERAND (rhs, 1))
&& types_compatible_p (TREE_TYPE (rhs),
- TREE_TYPE (TREE_TYPE (name))))
+ TREE_TYPE (TREE_TYPE (name)))
+ && !TREE_THIS_VOLATILE (rhs))
uses_ok++;
}
else if (is_gimple_call (stmt))
&& TREE_OPERAND (arg, 0) == name
&& integer_zerop (TREE_OPERAND (arg, 1))
&& types_compatible_p (TREE_TYPE (arg),
- TREE_TYPE (TREE_TYPE (name))))
+ TREE_TYPE (TREE_TYPE (name)))
+ && !TREE_THIS_VOLATILE (arg))
uses_ok++;
}
}