<html>
<head>
<base href="http://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 --- - Failure to constant-fold vector global"
href="http://llvm.org/bugs/show_bug.cgi?id=16710">16710</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Failure to constant-fold vector global
</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>All
</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>Interprocedural Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>silvas@purdue.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>We are not able to constant-fold the use of `Global.Member` in this code (with
clang -O3):
typedef float __m128 __attribute__((__vector_size__(16)));
class GlobalType {
public:
GlobalType(float F) {
Member = (__m128){F, F, F, F}; // simplified from _mm_load1_ps
}
__m128 Member;
};
static const GlobalType Global = 42.0f;
__m128 use(__m128 V) {
return V * Global.Member;
}
However, we *are* able to fold this:
class GlobalType {
public:
GlobalType(float F) {
Member = F;
}
float Member;
};
static const GlobalType Global = 42.0f;
float use(float V) {
return V * Global.Member;
}
In the float case, the folding happens in -globalopt.
(Note: running an extra `-globalopt -constprop` after the standard -O3
optimizations does fold it; for some reason -globalopt only folds the value of
the global, but doesn't substitute its use).</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>