<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 - Pointless static initializer guard generated for SIMD intrinsics"
href="https://bugs.llvm.org/show_bug.cgi?id=41283">41283</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Pointless static initializer guard generated for SIMD intrinsics
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>fabiang@radgametools.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Example:
-
#include <xmmintrin.h>
__m128i foo()
{
static const __m128i x = _mm_set1_epi32(1234); // <-- generates init guard
//const __m128i x = _mm_set1_epi32(1234); // <-- no guard
return x;
}
-
The intrinsic turns into a literal constant and then the static initializer
ends up producing a guard to copy one value from .rodata to .bss that it could
just access directly.
This is easy enough to work around in the source (just avoid static consts for
this kind of SIMD constants) but I've now run into this multiple times; maybe
there is a way to handle this better on the Clang side as well?
(I suppose the tricky part is that Clang codegen doesn't know which intrinsics
get constant-folded at compile time, so it has to emit the guards just in case
they can't.)</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>