------- Comment #1 from ramana at gcc dot gnu dot org 2009-12-30 17:32 ------- The problem here essentially appears to be that GCC can't seem to generate conditional tail-calls (or conditional calls for that matter in this case) with -fno-optimize-sibling-calls . I don't read this as a problem with builtin_expect per-se but that of GCC not being able to generate a conditional tail-call / call.
A simpler test is essentially the following. void foo (int x) { if (x) bar (); else baz (); } This is also not just a target problem but probably one for the RTL optimizers rather any where else.. -- ramana at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Component|target |rtl-optimization Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2009-12-30 17:32:59 date| | Summary|GCC can do less work in the |Generate conditional tail |frequently executed path |calls . http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42497