+2018-07-06 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * gimplify.h (generic_expr_could_trap_p): Set as global function.
+ * gimplify.h (generic_expr_could_trap_p): Likwise.
+ * tree-scalar-evolution.c (expression_expensive_p): Handle COND_EXPR.
+
2018-07-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/86401
EXPR is GENERIC, while tree_could_trap_p can be called
only on GIMPLE. */
-static bool
+bool
generic_expr_could_trap_p (tree expr)
{
unsigned i, n;
extern void gimplify_function_tree (tree);
extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
gimple_seq *);
+extern bool generic_expr_could_trap_p (tree expr);
gimple *gimplify_assign (tree, tree, gimple_seq *);
#endif /* GCC_GIMPLIFY_H */
+2018-07-06 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * gcc.dg/tree-ssa/pr64183.c: Disable final value replacement
+ to preserve the test.
+ * gcc.target/i386/pr85073.c: Likewise.
+
2018-07-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/86401
/* { dg-do compile } */
-/* { dg-options "-O3 -fno-tree-vectorize -fdump-tree-cunroll-details" } */
+/* { dg-options "-O3 -fno-tree-vectorize -fdisable-tree-sccp -fdump-tree-cunroll-details" } */
int bits;
unsigned int size;
/* PR target/85073 */
/* { dg-do compile } */
-/* { dg-options "-O2 -mbmi" } */
+/* { dg-options "-O2 -mbmi -fdisable-tree-sccp" } */
int
foo (unsigned x)
return false;
}
+ if (code == COND_EXPR)
+ return (expression_expensive_p (TREE_OPERAND (expr, 0))
+ || (EXPR_P (TREE_OPERAND (expr, 1))
+ && EXPR_P (TREE_OPERAND (expr, 2)))
+ /* If either branch has side effects or could trap. */
+ || TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1))
+ || generic_expr_could_trap_p (TREE_OPERAND (expr, 1))
+ || TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 0))
+ || generic_expr_could_trap_p (TREE_OPERAND (expr, 0))
+ || expression_expensive_p (TREE_OPERAND (expr, 1))
+ || expression_expensive_p (TREE_OPERAND (expr, 2)));
+
switch (TREE_CODE_CLASS (code))
{
case tcc_binary: