https://bugs.kde.org/show_bug.cgi?id=381553
--- Comment #14 from Julian Seward <[email protected]> --- (In reply to Ivo Raisr from comment #13) > Patches 005 implement function find_vreg_to_spill(). That's excellent. With this in place, I can start and quit Firefox on Memcheck, which requires processing more than 700000 blocks. So here are some numbers with Memcheck, from --stats=yes. For a small program: v2 transtab: new 2,793 (62,574 -> 995,820; ratio 15.9) [0 scs] avg tce size 356 v3 transtab: new 2,793 (62,574 -> 1,285,601; ratio 20.5) [0 scs] avg tce size 460 For Firefox (main process), it's similar: v2 transtab: new 705,840 (18,604,302 -> 319,510,676; ratio 17.2) [73,827 scs] avg tce size 452 v3 transtab: new 722,290 (19,026,251 -> 436,975,315; ratio 23.0) [86,640 scs] avg tce size 604 So there's a significant space loss. At least part of it comes I think from a simple cause. Memcheck instrumented code contains a lot of helper function calls, and so the v2 allocator tries to use callee-save registers rather than caller-save registers whenever it can, so it doesn't have to save registers around the calls. The v3 allocator doesn't appear to have that optimisation. For example: v2: 1 movq $0x4A286E5,0xB8(%rbp) 2 movq 0x3D8(%rbp),%r12 3 movq 0x38(%rbp),%r13 4 leaq 0xFFFFFFC0(%r13),%r14 5 cmpq $0x0,%r12 6 callnz[0,RLPri_None] 0x5805B7C0 v3: 1 movq $0x4A286E5,0xB8(%rbp) 2 movq 0x3D8(%rbp),%rsi 3 movq 0x38(%rbp),%rdi 4 leaq 0xFFFFFFC0(%rdi),%r8 5 cmpq $0x0,%rsi 6 movq %rsi,0xAF0(%rbp) 7 movq %rdi,0xAE8(%rbp) 8 movq %r8,0xAE0(%rbp) 9 callnz[0,RLPri_None] 0x5805B7C0 The v2 allocator starts off using r12, r13, r14, so it doesn't have to save them across the call. But the v3 allocator starts off using rsi, rdi, r8 and so has to spill all of them across the call. I remember that doing this (preferring callee-saved to caller-saved regs) in the v2 allocator was very important to performance, but right now I can't figure out from the v2 code how this is implemented. -- You are receiving this mail because: You are watching all bug changes.
