On Fri, May 06, 2016 at 04:00:28PM +0100, Jiong Wang wrote: > This patch fixes PR63596. > > There is no need to push/pop all arguments registers. We only need to > push and pop those registers used. These use info is calculated by a > dedicated vaarg optimization tree pass "tree-stdarg", the backend should > honor it's analysis result. > > For a simple testcase where vaarg declared but actually not used: > > int > f (int a, ...) > { > return a; > } > > before this patch, we are generating: > > f: > sub sp, sp, #192 > stp x1, x2, [sp, 136] > stp x3, x4, [sp, 152] > stp x5, x6, [sp, 168] > str x7, [sp, 184] > str q0, [sp] > str q1, [sp, 16] > str q2, [sp, 32] > str q3, [sp, 48] > str q4, [sp, 64] > str q5, [sp, 80] > str q6, [sp, 96] > str q7, [sp, 112] > add sp, sp, 192 > ret > > after this patch, it's optimized into: > > f: > ret
Can't argue with that! Nice! > OK for trunk? OK. Thanks, James