The following fixes PR72488, we forgot to restore SSA info when we aborted VN due to too large SCC size. I've added a verifier that checks that we do not share SSA_NAME_{PTR,RANGE}_INFO.
The issue is latent on the GCC 6 branch as well where I will not install the new verifier. Bootstrap and regtest in progress on x86_64-unknown-linux-gnu. Richard. 2017-01-19 Richard Biener <rguent...@suse.de> PR tree-optimization/72488 * tree-ssa-sccvn.c (run_scc_vn): When we abort the VN make sure to restore SSA info. * tree-ssa.c (verify_ssa): Verify SSA info is not shared. Index: gcc/tree-ssa-sccvn.c =================================================================== --- gcc/tree-ssa-sccvn.c (revision 244611) +++ gcc/tree-ssa-sccvn.c (working copy) @@ -4844,6 +4844,7 @@ run_scc_vn (vn_lookup_kind default_vn_wa walker.walk (ENTRY_BLOCK_PTR_FOR_FN (cfun)); if (walker.fail) { + scc_vn_restore_ssa_info (); free_scc_vn (); return false; } Index: gcc/tree-ssa.c =================================================================== --- gcc/tree-ssa.c (revision 244611) +++ gcc/tree-ssa.c (working copy) @@ -1027,24 +1027,49 @@ verify_ssa (bool check_modified_stmt, bo timevar_push (TV_TREE_SSA_VERIFY); - /* Keep track of SSA names present in the IL. */ - size_t i; - tree name; - - FOR_EACH_SSA_NAME (i, name, cfun) { - gimple *stmt; - TREE_VISITED (name) = 0; - - verify_ssa_name (name, virtual_operand_p (name)); + /* Keep track of SSA names present in the IL. */ + size_t i; + tree name; + hash_map <void *, tree> ssa_info; - stmt = SSA_NAME_DEF_STMT (name); - if (!gimple_nop_p (stmt)) + FOR_EACH_SSA_NAME (i, name, cfun) { - basic_block bb = gimple_bb (stmt); - if (verify_def (bb, definition_block, - name, stmt, virtual_operand_p (name))) - goto err; + gimple *stmt; + TREE_VISITED (name) = 0; + + verify_ssa_name (name, virtual_operand_p (name)); + + stmt = SSA_NAME_DEF_STMT (name); + if (!gimple_nop_p (stmt)) + { + basic_block bb = gimple_bb (stmt); + if (verify_def (bb, definition_block, + name, stmt, virtual_operand_p (name))) + goto err; + } + + void *info = NULL; + if (POINTER_TYPE_P (TREE_TYPE (name))) + info = SSA_NAME_PTR_INFO (name); + else if (INTEGRAL_TYPE_P (TREE_TYPE (name))) + info = SSA_NAME_RANGE_INFO (name); + if (info) + { + bool existed; + tree &val = ssa_info.get_or_insert (info, &existed); + if (existed) + { + error ("shared SSA name info"); + print_generic_expr (stderr, val, 0); + fprintf (stderr, " and "); + print_generic_expr (stderr, name, 0); + fprintf (stderr, "\n"); + goto err; + } + else + val = name; + } } }