Hi! We should IMHO ignore the clobber stmts when deciding if we can tail call optimize or tail recurse.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-02-16 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/52285 * tree-tailcall.c (find_tail_calls): Ignore gimple_clobber_p stmts when deciding if a call is a tail call or tail recursion. --- gcc/tree-tailcall.c.jj 2011-06-17 11:02:19.000000000 +0200 +++ gcc/tree-tailcall.c 2012-02-16 19:33:49.468926680 +0100 @@ -400,9 +400,10 @@ find_tail_calls (basic_block bb, struct { stmt = gsi_stmt (gsi); - /* Ignore labels, returns and debug stmts. */ + /* Ignore labels, returns, clobbers and debug stmts. */ if (gimple_code (stmt) == GIMPLE_LABEL || gimple_code (stmt) == GIMPLE_RETURN + || gimple_clobber_p (stmt) || is_gimple_debug (stmt)) continue; @@ -523,6 +524,9 @@ find_tail_calls (basic_block bb, struct if (gimple_code (stmt) == GIMPLE_RETURN) break; + if (gimple_clobber_p (stmt)) + continue; + if (is_gimple_debug (stmt)) continue; Jakub