public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/64895] New: [5 Regression] RA picks the wrong register for -fipa-ra
@ 2015-02-01 13:47 hjl.tools at gmail dot com
  2015-02-01 19:09 ` [Bug rtl-optimization/64895] " jakub at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: hjl.tools at gmail dot com @ 2015-02-01 13:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64895

            Bug ID: 64895
           Summary: [5 Regression] RA picks the wrong register for
                    -fipa-ra
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: vmakarov at redhat dot com

'-fipa-ra'
     Use caller save registers for allocation if those registers are not
     used by any called function.  In that case it is not necessary to
     save and restore them around calls.  This is only possible if
     called functions are part of same compilation unit as current
     function and they are compiled before it.

But in this case testcase 
[hjl@gnu-tools-1 gcc]$ cat /tmp/x.c 
static int __attribute__((noinline))
bar (int x)
{
  if (x > 4)
    return bar (x - 3);
  return 0;
}

int __attribute__((noinline))
foo (int y)
{
  return y + bar (y);
}
[hjl@gnu-tools-1 gcc]$ ./xgcc -B./ -m32 -fpic -O2 -fipa-ra -fomit-frame-pointer
-fno-optimize-sibling-calls -mregparm=1 /tmp/x.c -S
-fno-asynchronous-unwind-tables        
[hjl@gnu-tools-1 gcc]$ cat x.s 
    .file    "x.c"
    .section    .text.unlikely,"ax",@progbits
.LCOLDB0:
    .text
.LHOTB0:
    .p2align 4,,15
    .type    bar, @function
bar:
    cmpl    $4, %eax
    jg    .L7
    xorl    %eax, %eax
    ret
    .p2align 4,,10
    .p2align 3
.L7:
    subl    $12, %esp
    subl    $3, %eax
    call    bar
    addl    $12, %esp
    ret
    .size    bar, .-bar
    .section    .text.unlikely
.LCOLDE0:
    .text
.LHOTE0:
    .section    .text.unlikely
.LCOLDB1:
    .text
.LHOTB1:
    .p2align 4,,15
    .globl    foo
    .type    foo, @function
foo:
    pushl    %ebx
    movl    %eax, %ebx
    subl    $8, %esp
    call    bar
    addl    $8, %esp
    addl    %ebx, %eax
    popl    %ebx
    ret
    .size    foo, .-foo
    .section    .text.unlikely
.LCOLDE1:
    .text
.LHOTE1:
    .ident    "GCC: (GNU) 5.0.0 20150201 (experimental)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-tools-1 gcc]$ 

Pick EBX instead of EDX to save EAX in foo.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-03-16  9:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-01 13:47 [Bug rtl-optimization/64895] New: [5 Regression] RA picks the wrong register for -fipa-ra hjl.tools at gmail dot com
2015-02-01 19:09 ` [Bug rtl-optimization/64895] " jakub at gcc dot gnu.org
2015-02-01 19:22 ` hjl.tools at gmail dot com
2015-02-01 19:24 ` jakub at gcc dot gnu.org
2015-02-01 19:25 ` hjl.tools at gmail dot com
2015-03-06  8:04 ` [Bug rtl-optimization/64895] " ubizjak at gmail dot com
2015-03-10 10:24 ` vries at gcc dot gnu.org
2015-03-10 19:21 ` vmakarov at gcc dot gnu.org
2015-03-12 11:11 ` vries at gcc dot gnu.org
2015-03-12 11:27 ` vries at gcc dot gnu.org
2015-03-16  9:42 ` vries at gcc dot gnu.org
2015-03-16  9:44 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).