[Bug tree-optimization/20121] New: Aliasing lameness results in missing common subexpressions

law at redhat dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 21 21:39:00 GMT 2005


Our aliasing code is failing pretty badly in disambiguating memory addresses,
which in turn can lead to missing opportunities to remove memory operations.

Here's an exmaple taken from GCC itself (find_unreachable_blocks):

typedef unsigned int size_t;
extern void *xmalloc (size_t) __attribute__ ((__malloc__));
struct edge_def
{
  struct basic_block_def *dest;
  int flags;
};
typedef struct edge_def *edge;
struct basic_block_def
{
  int flags;
};
typedef struct basic_block_def *basic_block;
extern int n_basic_blocks;
extern edge frob ();
void
find_unreachable_blocks (int frobit)
{
  basic_block *tos, *worklist, bb;
  tos = worklist = xmalloc (sizeof (basic_block) * n_basic_blocks);
  edge e = frob();
  if (!(e->dest->flags & 4))
    {
      e->dest->flags |= 4;
      *tos++ = e->dest;
    }
}


The store into e->dest->flags does not affect e or e->dest.  Thus we only need
to load e->dest once.  Unfortunately, we load it twice.

I'll be checking this testcase into the testsuite (xfailed appropriately).

-- 
           Summary: Aliasing lameness results in missing common
                    subexpressions
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: law at redhat dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: Any
  GCC host triplet: Any
GCC target triplet: Any


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



More information about the Gcc-bugs mailing list