http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
Arnaud Lacombe <lacombar at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lacombar at gmail dot com --- Comment #13 from Arnaud Lacombe <lacombar at gmail dot com> 2011-05-13 19:26:40 UTC --- It would seem that GCC 4.5.1 is still generating a call to func(), at -Os. Considering the following reduced test-case: extern int outcnt; void test () { outcnt = 0; if (outcnt == 1) func (); if (outcnt == 1) func (); if (outcnt == 1) func (); if (outcnt == 1) func (); if (outcnt == 1) func (); if (outcnt == 1) func (); if (outcnt == 1) func (); if (outcnt == 1) func (); } At -O2: /usr/libexec/gcc/x86_64-redhat-linux/4.5.1/cc1 -O2 -o - test.c .file "test.c" test Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> <visibility> <early_local_cleanups> <whole-program> <cp> <inline> <static-var> <pure-const>Assembling functions: test .text .p2align 4,,15 .globl test .type test, @function test: .LFB0: .cfi_startproc movl $0, outcnt(%rip) ret .cfi_endproc .LFE0: .size test, .-test .ident "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)" .section .note.GNU-stack,"",@progbits Now, at -Os: /usr/libexec/gcc/x86_64-redhat-linux/4.5.1/cc1 -Os -o - test.c .file "test.c" test Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> <visibility> <early_local_cleanups> <whole-program> <cp> <inline> <static-var> <pure-const>Assembling functions: test .text .globl test .type test, @function test: .LFB0: .cfi_startproc movl $0, outcnt(%rip) cmpl $1, outcnt(%rip) jne .L1 xorl %eax, %eax jmp func .L1: ret .cfi_endproc .LFE0: .size test, .-test .ident "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)" .section .note.GNU-stack,"",@progbits