<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 - [loop vectorize] failure to vectorize with llvm.invariant.start after instcombine"
href="https://bugs.llvm.org/show_bug.cgi?id=39852">39852</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[loop vectorize] failure to vectorize with llvm.invariant.start after instcombine
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mpfergu@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21183" name="attach_21183" title="invariant-start-vector-issue.ll">attachment 21183</a> <a href="attachment.cgi?id=21183&action=edit" title="invariant-start-vector-issue.ll">[details]</a></span>
invariant-start-vector-issue.ll
I'm seeing an issue where adding !llvm.invariant.start metadata seems to
prevents loop vectorization from occurring.
I'd like the attached example to vectorize, but it doesn't. To reproduce:
opt -S -O3 invariant-start-vector-issue.ll -force-vector-width=4
-force-vector-interleave=1
and notice that the fmul is not vectorized. (invariant-start-vector-issue.ll is
attached). If the llvm.invariant.start metadata is removed (or they are updated
to all make %14 invariant, for example), then the loop is vectorized.
This is very surprising. I think most of us expect that adding additional
information to the LLVM IR, like llvm.invariant.start, will help and not hinder
optimization.
I know a little bit more about what is happening here. instcombine is creating
a bitcast that seems to trip up the loop vectorizer.
opt -instcombine -S invariant-start-vector-issue.ll
generates this snippet:
%44 = bitcast double* %4 to i64*
%45 = load i64, i64* %44, align 8, !tbaa !2
%46 = bitcast double* %31 to i64*
store i64 %45, i64* %46, align 8, !tbaa !2
I believe this snippet is tripping up the LoopVectorizer.</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>