Created attachment 33280 [details] partially reduced testcase Compiler output: $ gcc -std=c++0x -O2 -fnon-call-exceptions testcase.C testcase.C: In function 'int main()': testcase.C:75:1: internal compiler error: in calc_dfs_tree, at dominance.c:401 } ^ 0x98b7ab calc_dfs_tree /mnt/svn/gcc-trunk/gcc/dominance.c:401 0x98c7c1 calculate_dominance_info(cdi_direction) /mnt/svn/gcc-trunk/gcc/dominance.c:662 0x9220a7 flow_loops_find(loops*) /mnt/svn/gcc-trunk/gcc/cfgloop.c:414 0xb903c7 loop_optimizer_init(unsigned int) /mnt/svn/gcc-trunk/gcc/loop-init.c:92 0x157db93 if_convert /mnt/svn/gcc-trunk/gcc/ifcvt.c:4427 0x157fe8d execute /mnt/svn/gcc-trunk/gcc/ifcvt.c:4650 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. Tested revisions: r213777 - ICE 4_9 r212703 - ICE 4_8 r212702 - OK 4_7 r211571 - OK
Mine.
Ok, so this is if-after-reload which calls loop_optimizer_init on a CFG with an unreachable block. Thus we miss a cfg-cleanup somewhere. Note that regular ifcvt runs a cleanup_cfg (CLEANUP_EXPENSIVE), but not if-after-combine or if-after-reload. It's peephole2 that ends up with this bogus CFG. Passes leaving dangling unreachable blocks should fix that up.
Funny that peep2s peep2_do_cleanup_cfg variable is write-only. Bernd introduced that, a simple Index: recog.c =================================================================== --- recog.c (revision 213909) +++ recog.c (working copy) @@ -3553,6 +3553,8 @@ peephole2_optimize (void) BITMAP_FREE (live); if (peep2_do_rebuild_jump_labels) rebuild_jump_labels (get_insns ()); + if (peep2_do_cleanup_cfg) + cleanup_cfg (CLEANUP_CFG_CHANGED); } #endif /* HAVE_peephole2 */ fixes the testcase.
Fixed on trunk sofar.
Author: rguenth Date: Thu Aug 14 08:56:49 2014 New Revision: 213950 URL: https://gcc.gnu.org/viewcvs?rev=213950&root=gcc&view=rev Log: 2014-08-14 Richard Biener <rguenther@suse.de> PR rtl-optimization/62079 * recog.c (peephole2_optimize): If peep2_do_cleanup_cfg run cleanup_cfg. * g++.dg/pr62079.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/pr62079.C Modified: trunk/gcc/ChangeLog trunk/gcc/recog.c trunk/gcc/testsuite/ChangeLog
Author: rguenth Date: Tue Sep 9 11:42:34 2014 New Revision: 215059 URL: https://gcc.gnu.org/viewcvs?rev=215059&root=gcc&view=rev Log: 2014-09-09 Richard Biener <rguenther@suse.de> Backport from mainline 2014-08-05 Richard Biener <rguenther@suse.de> PR rtl-optimization/61672 * emit-rtl.h (mem_attrs_eq_p): Declare. * emit-rtl.c (mem_attrs_eq_p): Export. Handle NULL mem-attrs. * cse.c (exp_equiv_p): Use mem_attrs_eq_p. * cfgcleanup.c (merge_memattrs): Likewise. Include emit-rtl.h. 2014-08-11 Richard Biener <rguenther@suse.de> PR tree-optimization/62075 * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Properly handle uses in patterns. * gcc.dg/vect/pr62075.c: New testcase. 2014-08-14 Richard Biener <rguenther@suse.de> PR rtl-optimization/62079 * recog.c (peephole2_optimize): If peep2_do_cleanup_cfg run cleanup_cfg. * g++.dg/pr62079.C: New testcase. 2014-08-26 Richard Biener <rguenther@suse.de> PR tree-optimization/62175 * tree-ssa-loop-niter.c (expand_simple_operations): Do not expand possibly trapping operations. * g++.dg/torture/pr62175.C: New testcase. Added: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/pr62079.C branches/gcc-4_9-branch/gcc/testsuite/g++.dg/torture/pr62175.C branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/pr62075.c Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/cfgcleanup.c branches/gcc-4_9-branch/gcc/cse.c branches/gcc-4_9-branch/gcc/emit-rtl.c branches/gcc-4_9-branch/gcc/recog.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog branches/gcc-4_9-branch/gcc/tree-ssa-loop-niter.c branches/gcc-4_9-branch/gcc/tree-vect-slp.c
Fixed.