<html>
<head>
<base href="http://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 - restrict pointers from structures passed by value ignored"
href="http://bugs.llvm.org/show_bug.cgi?id=32581">32581</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>restrict pointers from structures passed by value ignored
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hstong@ca.ibm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>A restrict pointer as a structure member passed by value to a function is
associated with the same block as a similar pointer passed as a scalar to that
function. It is observed that the optimization opportunity associated with such
a structure member is lost in the translation to the IR.
Note: the specific IR surrounding the parameter of structure type is dependent
on the target ABI. For ppc64le, this depends on the size of the structure type.
Online compiler: <a href="https://wandbox.org/permlink/lmzxbVOXYswJPsoe">https://wandbox.org/permlink/lmzxbVOXYswJPsoe</a>
### SOURCE (<stdin>):
typedef struct S {
int *restrict p;
} S;
void f(S s, int *q) {
extern void who_goes_there();
*s.p = 1;
*q = 2;
if (*s.p != 1) { who_goes_there(); }
}
### COMPILER INVOCATION:
clang -x c -std=c11 -O2 -c -o a.o -
### ACTUAL OUTPUT (a.o):
(Contains reference to who_goes_there).
### EXPECTED OUTPUT:
No reference to who_goes_there.
### COMPILER VERSION INFO (clang -v):
clang version 5.0.0 (<a href="https://github.com/llvm-mirror/clang.git">https://github.com/llvm-mirror/clang.git</a>
af734ef76cc33a4d5f10cc7c799687b5997703f1)
(<a href="https://github.com/llvm-mirror/llvm.git">https://github.com/llvm-mirror/llvm.git</a>
1afcae44d92c906c595bd0b2b365dfd58b8657f9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>