From: Jakub Jelinek Date: Tue, 11 Dec 2018 17:16:48 +0000 (+0100) Subject: re PR tree-optimization/88444 (ICE: tree check: expected ssa_name, have integer_cst... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ccef67160c2c467b3101e0d3e7f08ea996624fc6;p=gcc.git re PR tree-optimization/88444 (ICE: tree check: expected ssa_name, have integer_cst in live_on_edge, at tree-vrp.c:468; or ICE: tree check: expected ssa_name, have integer_cst in get_value_range, at vr-values.c:84) PR tree-optimization/88444 * tree-vrp.c (register_edge_assert_for_2): Only register assertions for conversions if rhs1 is a SSA_NAME. * gcc.dg/pr88444.c: New test. From-SVN: r267026 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc126c7e3ee..94c7ca75cab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-12-11 Jakub Jelinek + + 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 * cfgexpand.c (asm_clobber_reg_is_valid): Also produce diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c15bf7c152..e69abe6288b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-11 Jakub Jelinek + + PR tree-optimization/88444 + * gcc.dg/pr88444.c: New test. + 2018-12-11 Dimitar Dimitrov * gcc.target/i386/pr52813.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr88444.c b/gcc/testsuite/gcc.dg/pr88444.c new file mode 100644 index 00000000000..01b0d45ed83 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr88444.c @@ -0,0 +1,30 @@ +/* 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); +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 15ac65b7dd4..864de4195da 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2894,6 +2894,7 @@ register_edge_assert_for_2 (tree name, edge e, { 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)) @@ -2990,6 +2991,7 @@ register_edge_assert_for_2 (tree name, edge e, 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 @@ -3054,6 +3056,7 @@ register_edge_assert_for_2 (tree name, edge e, { 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]))))