Hi, as noticed by Richard, genericize_continue_stmt doesn't really add the prediction statement becuase it has no side effects, so we don't do any continue prediction for C++.
Bootstrapped/regtested x86_64-linux, comitted. Honza * g++.dg/tree-ssa/pred-1.C: New testcase * gcc.dg/tree-ssa/pred-1.c: New testcase * cp-gimplify.c (genericize_continue_stmt): Force addition of predict stmt. Index: testsuite/g++.dg/tree-ssa/pred-1.C =================================================================== --- testsuite/g++.dg/tree-ssa/pred-1.C (revision 0) +++ testsuite/g++.dg/tree-ssa/pred-1.C (working copy) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ +int a[100]; +void foo(int); +main() +{ + int i; + for (i=0;i<100;i++) + { + if (a[i]) + continue; + foo(i); + } +} +// { dg-final { scan-tree-dump "continue heuristics" "profile_estimate" } } Index: testsuite/gcc.dg/tree-ssa/pred-1.c =================================================================== --- testsuite/gcc.dg/tree-ssa/pred-1.c (revision 0) +++ testsuite/gcc.dg/tree-ssa/pred-1.c (working copy) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ +int a[100]; +void foo(int); +int +main() +{ + int i; + for (i=0;i<100;i++) + { + if (a[i]) + continue; + foo(i); + } +} +// { dg-final { scan-tree-dump "continue heuristics" "profile_estimate" } } Index: cp/cp-gimplify.c =================================================================== --- cp/cp-gimplify.c (revision 237043) +++ cp/cp-gimplify.c (working copy) @@ -362,7 +362,7 @@ genericize_continue_stmt (tree *stmt_p) tree label = get_bc_label (bc_continue); location_t location = EXPR_LOCATION (*stmt_p); tree jump = build1_loc (location, GOTO_EXPR, void_type_node, label); - append_to_statement_list (pred, &stmt_list); + append_to_statement_list_force (pred, &stmt_list); append_to_statement_list (jump, &stmt_list); *stmt_p = stmt_list; }