+2016-11-23 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR middle-end/78153
+ * gimple-fold.c (fold_stmt_1): Handle case for GIMPLE_RETURN.
+ * tree-vrp.c (extract_range_basic): Handle case for
+ CFN_BUILT_IN_STRLEN.
+
2016-11-23 Jeff Law <law@redhat.com>
* config/ia64/ia64.c (ia64_emit_insn_before): Fix prototype.
}
break;
+ case GIMPLE_RETURN:
+ {
+ greturn *ret_stmt = as_a<greturn *> (stmt);
+ tree ret = gimple_return_retval(ret_stmt);
+
+ if (ret && TREE_CODE (ret) == SSA_NAME && valueize)
+ {
+ tree val = valueize (ret);
+ if (val && val != ret)
+ {
+ gimple_return_set_retval (ret_stmt, val);
+ changed = true;
+ }
+ }
+ }
+ break;
+
default:;
}
+2016-11-23 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR middle-end/78153
+ * gcc.dg/tree-ssa/pr78153-1.c: New test.
+ * gcc.dg/tree-ssa/pr78153-2.c: Likewise.
+
2016-11-23 James Greenhalgh <james.greenhalgh@arm.com>
PR target/63250
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp-slim" } */
+
+void f(const char *s)
+{
+ if (__PTRDIFF_MAX__ <= __builtin_strlen (s))
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-not "__builtin_abort" "evrp" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp-slim" } */
+
+void f(const char *s)
+{
+ __PTRDIFF_TYPE__ n = __builtin_strlen (s);
+ if (n < 0)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-not "__builtin_abort" "evrp" } } */
: vrp_val_max (type), NULL);
}
return;
+ case CFN_BUILT_IN_STRLEN:
+ {
+ tree type = TREE_TYPE (gimple_call_lhs (stmt));
+ tree max = vrp_val_max (ptrdiff_type_node);
+ wide_int wmax = wi::to_wide (max, TYPE_PRECISION (TREE_TYPE (max)));
+ tree range_min = build_zero_cst (type);
+ tree range_max = wide_int_to_tree (type, wmax - 1);
+ set_value_range (vr, VR_RANGE, range_min, range_max, NULL);
+ }
+ return;
default:
break;
}