[llvm-bugs] [Bug 28069] New: LICM uses an overly conservative alias information

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 9 16:21:12 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28069

            Bug ID: 28069
           Summary: LICM uses an overly conservative alias information
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: sebpop at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

LICM fails to hoist stride and width loads from the loops, ending with an extra
compare and jump in the outer loop (the check width > 0 for whether the inner
loop executes):

int height, width, stride;
int h(unsigned char *data)
{
   int h[256];
   for (int i = 0; i < height; i++) {
     unsigned char *p = data + (i * stride);
     for (int j = 0; j < width; j++) {
       h[*p]++;
       p += 1;
     }
   }
   return h[42];
}

LICM fails to hoist because pointerInvalidatedByLoop returns true for the
global variables stride and width.  Following the comments of the function, 

/// Return true if the body of this loop may store into the memory
/// location pointed to by V.
///
static bool pointerInvalidatedByLoop(Value *V, uint64_t Size,
                                     const AAMDNodes &AAInfo,
                                     AliasSetTracker *CurAST) {
  // Check to see if any of the basic blocks in CurLoop invalidate *V.
  return CurAST->getAliasSetForPointer(V, Size, AAInfo).isMod();
}

it seems like the alias analysis is not able to disambiguate the stores to a
stack allocated array from the global variables.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160609/829eb454/attachment.html>


More information about the llvm-bugs mailing list