[Bug debug/47858] New: [4.5/4.6 Regression] IPA-SRA decreases quality of debug info

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 23 14:01:00 GMT 2011


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

           Summary: [4.5/4.6 Regression] IPA-SRA decreases quality of
                    debug info
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: aoliva@gcc.gnu.org


struct inode
{
  char i_pad[16];
  unsigned int i_flags;
};
struct dentry
{
  unsigned int d_pad[16];
  struct inode *d_inode;
};

extern int inode_permission (struct inode *, int);
extern int fsnotify_create (struct inode *, struct dentry *);

static inline int
may_create (struct inode *dir, struct dentry *child)
{
  if (child->d_inode)
    return -17;
  if (((dir)->i_flags & 16))
    return -2;
  return inode_permission (dir, 2 | 1);
}

int
foo (struct inode *dir, struct dentry *child)
{
  if (may_create (dir, child) < 0)
    return -1;
  return fsnotify_create (dir, child);
}

int
bar (struct inode *dir, struct dentry *child)
{
  if (may_create (dir, child) < 0)
    return -1;
  return fsnotify_create (dir, child);
}

int
baz (struct inode *dir, struct dentry *child)
{
  if (may_create (dir, child) < 0)
    return -1;
  return fsnotify_create (dir, child);
}

at -Os on x86_64-linux (distilled from Linux kernel) pessimizes debug info
because child parameter in may_create (which isn't emitted inline) doesn't have
location (well, it doesn't have even DW_TAG_formal_parameter in the out of line
DIE, just in the abstract inline DIE).

This could be solvable with my proposed DW_TAG_GNU_call_site stuff and the
(still in drafting DW_OP_GNU_parameter_ref stuff for completely optimized away
parameters - here it isn't completely optimized away, just replaced by
something based on it).

In this testcase it is of course also questionable why IPA-SRC actually
performs this "optimization" when it increases code size and doesn't improve
anything at all.



More information about the Gcc-bugs mailing list