<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - LICM uses an overly conservative alias information"
href="https://llvm.org/bugs/show_bug.cgi?id=28069">28069</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LICM uses an overly conservative alias information
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sebpop@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>