On gcc.dg/pr17635.c, tree-if-conversion badly screws up the cfg (we just don't notice because we aren't doing enough verification)
Before if-convresion: (gdb) p debug_tree_bb (basic_block_info[0].data.bb[2]) ;; basic block 2, loop depth 1, count 0 ;; prev block 1, next block 3 ;; pred: 1 [100.0%] (fallthru,dfs_back,exec) 0 [100.0%] (fallthru,exec) ;; succ: 3 [50.0%] (true,exec) 4 [50.0%] (false,exec) # i_1 = PHI <i_4(1), i_2(0)>; <L5>:; if (i_1 != 0) goto <L1>; else goto <L6>; After: ;; basic block 2, loop depth 1, count 0 ;; prev block 0, next block -2 ;; pred: 0 [100.0%] (fallthru,exec) ;; succ: Invalid sum of incoming frequencies 1, should be 10000 # i_1 = PHI <i_2(0)>; <L5>:; _ifc_.0_5 = i_1 != 0; i_3 = i_1 + 1; i_4 = i_1 != 0 ? i_3 : i_1; Note that our successors have completely disappeared (in fact, we now have no path to the exit block at all). It's fine to remove the successor blocks, but you still have to fix up the successors on the new if-converted block so that they are going to the right place. Simply compile pr17635.c with -ftree-vectorize, and look at the dumps, and you can see this. On diego's pending tree-cleanup-branch merge, more checking was added, and this is triggering errors in it. -- Summary: Tree if-conversion screws up cfg very badly Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dberlin at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: *-*-* GCC host triplet: *-*-* GCC target triplet: *-*-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18815