The following fixes PR77979, yet another case where the jump-threading code in VRP makes things difficult.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2016-10-14 Richard Biener <rguent...@suse.de> PR tree-optimization/77979 * tree-vrp.c (compare_name_with_value): Handle released SSA names in the equivalency sets. (compare_names): Likewise. * gcc.dg/torture/pr77979.c: New testcase. Index: gcc/tree-vrp.c =================================================================== *** gcc/tree-vrp.c (revision 241148) --- gcc/tree-vrp.c (working copy) *************** compare_name_with_value (enum tree_code *** 7188,7196 **** EXECUTE_IF_SET_IN_BITMAP (e, 0, i, bi) { if (! use_equiv_p ! && ! SSA_NAME_IS_DEFAULT_DEF (ssa_name (i)) ! && prop_simulate_again_p (SSA_NAME_DEF_STMT (ssa_name (i)))) continue; equiv_vr = get_vr_for_comparison (i); --- 7188,7200 ---- EXECUTE_IF_SET_IN_BITMAP (e, 0, i, bi) { + tree name = ssa_name (i); + if (! name) + continue; + if (! use_equiv_p ! && ! SSA_NAME_IS_DEFAULT_DEF (name) ! && prop_simulate_again_p (SSA_NAME_DEF_STMT (name))) continue; equiv_vr = get_vr_for_comparison (i); *************** compare_names (enum tree_code comp, tree *** 7289,7299 **** --- 7293,7309 ---- of the loop just to check N1 and N2 ranges. */ EXECUTE_IF_SET_IN_BITMAP (e1, 0, i1, bi1) { + if (! ssa_name (i1)) + continue; + value_range vr1 = get_vr_for_comparison (i1); t = retval = NULL_TREE; EXECUTE_IF_SET_IN_BITMAP (e2, 0, i2, bi2) { + if (! ssa_name (i2)) + continue; + bool sop = false; value_range vr2 = get_vr_for_comparison (i2); Index: gcc/testsuite/gcc.dg/torture/pr77979.c =================================================================== *** gcc/testsuite/gcc.dg/torture/pr77979.c (revision 0) --- gcc/testsuite/gcc.dg/torture/pr77979.c (working copy) *************** *** 0 **** --- 1,12 ---- + /* { dg-do compile } */ + + int a, b, c, d, e, f; + + void fn1 () + { + int g = b; + a = -~(d || a) << 4 || e; + b = c || g ^ a; + if (f < g) + d = e; + }