------- Comment #38 from jakub at gcc dot gnu dot org 2010-01-22 19:17 ------- In 4.4 the apY = apX; assignment isn't optimized out, because the code after it reads from the apY's fields (apY is the struct from the inline, apX in the caller). But in 4.5 FRE replaces them by whatever is written into apX fields. It surprises me FRE does this, I'd expect that the struct needs to be SRAed first before such optimizations can do anything with it.
That said, other options would be prevent FRE from doing that kind of things with RECORD_TYPE __builtin_va_list objects in the first fre pass, or for DCE1 to somehow signalize to the stdarg pass if it removes an va_list = va_list assignment that it should just signalize that va_list escapes. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41089