pro64-support
[Top] [All Lists]

inliner misbehaving at -O3

To: pro64-support@xxxxxxxxxxx
Subject: inliner misbehaving at -O3
From: David Goodwin <goodwin@xxxxxxxxxxxxx>
Date: Wed, 25 Oct 2000 15:07:38 -0700 (PDT)
Cc: goodwin@xxxxxxxxxxxxx
Reply-to: goodwin@xxxxxxxxxxxxx
Sender: owner-pro64-support@xxxxxxxxxxx
Compiling the attached example at -O3 causes the inliner to do a couple of
things that appear wrong.

sgicc -O3 -S alias.c

static int x;
static int y;

static int *get_x(){ return &x;}
static int *get_y(){ int *p = &y; return p;}
int foo(int);

int test()
{
  (*(get_x())) = 8;
  foo(x);
  (*(get_y())) = 9;
  return x + y;
}


1. Neither get_x or get_y are inlined!!

2. The inliner changes some symbol table flags for x and y that cause alias
   problems in be. Diffing the whirl after gccfe and inline, it seems the
   only thing the inliner does is change 'x's "addr_saved" to
   "addr_passed", and add "addr_passed" to 'y'. Removing 'x's "addr_saved"
   causes be to think that the load of 'x' for the call to "foo" can't
   alias with the store of 8 into get_x's return value. Of course that is
   wrong.

David


[~/tensilica/test] diff -c alias.f alias.ff
*** alias.f     Wed Oct 25 14:14:55 2000
--- alias.ff    Wed Oct 25 14:14:52 2000
***************
*** 212,218 ****
                Sclass: TEXT
  [22]: x               <1,22> Variable of type .predef_I4 (#4, I4)
                Address: 0(x<1,22>)  Alignment: 4 bytes
!               Flags:  0x01000000 addr_saved, XLOCAL
                Sclass: FSTATIC
  [23]: get_y           <1,23> Subprogram
                Returning anon_ptr. (#34, KIND_POINTER)  PU[2] C  flags:
--- 212,218 ----
                Sclass: TEXT
  [22]: x               <1,22> Variable of type .predef_I4 (#4, I4)
                Address: 0(x<1,22>)  Alignment: 4 bytes
!               Flags:  0x02000000 addr_passed, XLOCAL
                Sclass: FSTATIC
  [23]: get_y           <1,23> Subprogram
                Returning anon_ptr. (#34, KIND_POINTER)  PU[2] C  flags:
***************
*** 221,227 ****
                Sclass: TEXT
  [24]: y               <1,24> Variable of type .predef_I4 (#4, I4)
                Address: 0(y<1,24>)  Alignment: 4 bytes
!               Flags:  0x01000000 addr_saved, XLOCAL
                Sclass: FSTATIC
  [25]: test            <1,25> Subprogram
                Returning .predef_I4 (#4, I4)  PU[3] C  flags: very_high_whirl
--- 221,227 ----
                Sclass: TEXT
  [24]: y               <1,24> Variable of type .predef_I4 (#4, I4)
                Address: 0(y<1,24>)  Alignment: 4 bytes
!               Flags:  0x03000000 addr_saved addr_passed, XLOCAL
                Sclass: FSTATIC
  [25]: test            <1,25> Subprogram
                Returning .predef_I4 (#4, I4)  PU[3] C  flags: very_high_whirl

<Prev in Thread] Current Thread [Next in Thread>
  • inliner misbehaving at -O3, David Goodwin <=