+2018-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/88444
+ * tree-vrp.c (register_edge_assert_for_2): Only register assertions
+ for conversions if rhs1 is a SSA_NAME.
+
2018-12-11 Dimitar Dimitrov <dimitar@dinux.eu>
* cfgexpand.c (asm_clobber_reg_is_valid): Also produce
+2018-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/88444
+ * gcc.dg/pr88444.c: New test.
+
2018-12-11 Dimitar Dimitrov <dimitar@dinux.eu>
* gcc.target/i386/pr52813.c: New test.
--- /dev/null
+/* PR tree-optimization/88444 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-vrp -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre" } */
+
+int v;
+
+int
+foo (int, int);
+
+static inline int
+bar (long int x)
+{
+ return !!x ? x : 1;
+}
+
+static inline void
+baz (int x)
+{
+ v += foo (0, 0) + bar (x);
+}
+
+void
+qux (void)
+{
+ int a = 0;
+ v = v || foo (0, 0);
+ v = v || foo (0, 0);
+ v = v || foo (0, 0);
+ baz (a);
+}
{
name2 = gimple_assign_rhs1 (def_stmt);
if (CONVERT_EXPR_CODE_P (rhs_code)
+ && TREE_CODE (name2) == SSA_NAME
&& INTEGRAL_TYPE_P (TREE_TYPE (name2))
&& TYPE_UNSIGNED (TREE_TYPE (name2))
&& prec == TYPE_PRECISION (TREE_TYPE (name2))
wide_int rmin, rmax;
tree rhs1 = gimple_assign_rhs1 (def_stmt);
if (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
+ && TREE_CODE (rhs1) == SSA_NAME
/* Make sure the relation preserves the upper/lower boundary of
the range conservatively. */
&& (comp_code == NE_EXPR
{
names[1] = gimple_assign_rhs1 (def_stmt2);
if (!CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt2))
+ || TREE_CODE (names[1]) != SSA_NAME
|| !INTEGRAL_TYPE_P (TREE_TYPE (names[1]))
|| (TYPE_PRECISION (TREE_TYPE (name2))
!= TYPE_PRECISION (TREE_TYPE (names[1]))))