------- Comment #10 from thutt at vmware dot com  2009-01-22 13:59 -------
(In reply to comment #7)
> The problem here is that you are using unitialized local register variables so
> the register allocator does not know any better.  Anyways it works correctly 
> on
> the trunk and I don't have any other compiler to test with really (this is 
> both
> with and without IRA).
> 

First, what's the expansion of the TLA 'IRA'?

Second, it makes no difference if all the locals are initialized, the compiler
still incorrectly uses '%rbp'.  Here is the disassembly of the source, with
initializers for all local variables.

0000000000000010 <test_function>:
  10:   48 89 5c 24 d0          mov    %rbx,0xffffffffffffffd0(%rsp)
  15:   48 89 6c 24 d8          mov    %rbp,0xffffffffffffffd8(%rsp)
  1a:   31 db                   xor    %ebx,%ebx
  1c:   4c 89 64 24 e0          mov    %r12,0xffffffffffffffe0(%rsp)
  21:   4c 89 6c 24 e8          mov    %r13,0xffffffffffffffe8(%rsp)
  26:   31 c9                   xor    %ecx,%ecx
  28:   4c 89 74 24 f0          mov    %r14,0xfffffffffffffff0(%rsp)
  2d:   4c 89 7c 24 f8          mov    %r15,0xfffffffffffffff8(%rsp)
  32:   31 d2                   xor    %edx,%edx
  34:   48 83 ec 38             sub    $0x38,%rsp
  38:   31 f6                   xor    %esi,%esi
  3a:   48 8b 2d 00 00 00 00    mov    0(%rip),%rbp        # 41
<test_function+0x31>
  41:   48 8b 05 00 00 00 00    mov    0(%rip),%rax        # 48
<test_function+0x38>
  48:   31 ed                   xor    %ebp,%ebp
  4a:   31 ff                   xor    %edi,%edi
  4c:   45 31 c0                xor    %r8d,%r8d
  4f:   45 31 c9                xor    %r9d,%r9d
  52:   45 31 d2                xor    %r10d,%r10d
  55:   45 31 db                xor    %r11d,%r11d
  58:   45 31 e4                xor    %r12d,%r12d
  5b:   45 31 ed                xor    %r13d,%r13d
  5e:   45 31 f6                xor    %r14d,%r14d
  61:   45 31 ff                xor    %r15d,%r15d
  64:   0f 01 d8                vmrun  
  67:   48 8b 3d 00 00 00 00    mov    0(%rip),%rdi        # 6e
<test_function+0x5e>
  6e:   48 8d 75 f8             lea    0xfffffffffffffff8(%rbp),%rsi
  72:   48 39 fe                cmp    %rdi,%rsi
  75:   74 05                   je     7c <test_function+0x6c>
  77:   e8 00 00 00 00          callq  7c <test_function+0x6c>
  7c:   48 8b 5c 24 08          mov    0x8(%rsp),%rbx
  81:   48 8b 6c 24 10          mov    0x10(%rsp),%rbp
  86:   31 c0                   xor    %eax,%eax
  88:   4c 8b 64 24 18          mov    0x18(%rsp),%r12
  8d:   4c 8b 6c 24 20          mov    0x20(%rsp),%r13
  92:   4c 8b 74 24 28          mov    0x28(%rsp),%r14
  97:   4c 8b 7c 24 30          mov    0x30(%rsp),%r15
  9c:   48 83 c4 38             add    $0x38,%rsp
  a0:   c3                      retq   

Third, why does removing the unused function 'SetupVMCB' cause the compiler
to generate different code?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38925

Reply via email to