On 15/06/17 15:12, Wilco Dijkstra wrote:
This results in smaller code and unwind info.

I have done a quick test on your updated patch through building latest linux
kernel.

Dwarf frame size improved (~ 5% smaller) as using sp to address locals doesn't
need to update CFA register etc.

Though the impact on the codegen by using sp to address locals may be 
diversified,
for the case of linux kernel, I saw text size increase slightly (~ 0.05% 
bigger),
the reason looks like is GCC hardware copy propagation doesn't support stack
pointer case, see regcprop.c, so if you have the following sequences, the fp
case will be optimized into "add x0, x29, 36" while sp case left with two
instructions. A simple testcase listed below.

sp
===
mov     x0, sp
add     x0, x0, 36

fp
===
mov     x0, x29
add     x0, x0, 36

test.c
===
struct K {
 int a;
 int b;
 int c;
 int d;
 char e;
 short f;
 long g;
 float h;
 double i;
};

void foo (int, struct K *);

void test (int i)
{
 struct K k = {
  .a = 5,
  .b = 0,
  .c = i,
 };

 foo (5, &k);

Reply via email to