<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Use noalias information to optimize pointer comparisons"
href="https://bugs.llvm.org/show_bug.cgi?id=50110">50110</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Use noalias information to optimize pointer comparisons
</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>enhancement
</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>david.bolvansky@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>extern void *alloc(int) __attribute__((malloc));
char global_arr[128];
char *__restrict__ global_noalias_ptr;
int test1(void) {
if (global_arr == global_noalias_ptr) return 1;
return 0;
}
int test2(char *__restrict__ noalias_ptr_arg1) {
if (noalias_ptr_arg1 == global_arr) return 1;
return 0;
}
int test3(char *__restrict__ noalias_ptr_arg1) {
if (noalias_ptr_arg1 == global_noalias_ptr) return 1;
return 0;
}
int test4(char *__restrict__ noalias_ptr_arg1, char *__restrict__
noalias_ptr_arg2) {
if (noalias_ptr_arg1 == noalias_ptr_arg2) return 1;
return 0;
}
int test5( char *unknown_ptr) {
char *__restrict__ noalias_local_ptr = unknown_ptr;
if (noalias_local_ptr == global_arr) return 1;
return 0;
}
int test6( char *__restrict__ noalias_ptr_arg1,char *unknown_ptr) {
char *__restrict__ noalias_local_ptr = unknown_ptr;
if (noalias_local_ptr == noalias_ptr_arg1) return 1;
return 0;
}
int test7( char *unknown_ptr) {
char *__restrict__ noalias_local_ptr = unknown_ptr;
if (noalias_local_ptr == global_noalias_ptr) return 1;
return 0;
}
int test8(void) {
char *allocated_noalias_ptr = (char *)alloc(64);
if (allocated_noalias_ptr == global_arr) return 1;
return 0;
}
int test9(char *unknown_ptr) {
char *__restrict__ noalias_local_ptr = unknown_ptr;
char *allocated_noalias_ptr = (char *)alloc(64);
if (allocated_noalias_ptr == noalias_local_ptr) return 1;
return 0;
}
int test10(char *__restrict__ noalias_ptr_arg1) {
char *allocated_noalias_ptr = (char *)alloc(64);
if (allocated_noalias_ptr == noalias_ptr_arg1) return 1;
return 0;
}
int test11(void) {
char *allocated_noalias_ptr = (char *)alloc(64);
if (allocated_noalias_ptr == global_noalias_ptr) return 1;
return 0;
}
<a href="https://godbolt.org/z/dz3zv4fTh">https://godbolt.org/z/dz3zv4fTh</a>
LLVM does not optimize these cases, GCC can optimize atleast test1 and test8.</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>