<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 - Failure to vectorize simple loop to AVX vpaddb"
href="https://bugs.llvm.org/show_bug.cgi?id=36359">36359</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Failure to vectorize simple loop to AVX vpaddb
</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>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>timshen91@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=19851" name="attach_19851" title="IR file">attachment 19851</a> <a href="attachment.cgi?id=19851&action=edit" title="IR file">[details]</a></span>
IR file
opt doesn't produce a single instruction for the attached test case:
$ opt -O2 -S a.ll
define <32 x i8> @_Z3AddDv32_cS_(<32 x i8> %a, <32 x i8> %b) local_unnamed_addr
#0 {
entry:
br label %for.body
for.cond.cleanup: ; preds = %for.body
ret <32 x i8> %vecins.3
for.body: ; preds = %for.body, %entry
%i.09 = phi i32 [ 0, %entry ], [ %inc.3, %for.body ]
%ret.08 = phi <32 x i8> [ undef, %entry ], [ %vecins.3, %for.body ]
%vecext = extractelement <32 x i8> %a, i32 %i.09
%vecext1 = extractelement <32 x i8> %b, i32 %i.09
%add = add i8 %vecext, %vecext1
%vecins = insertelement <32 x i8> %ret.08, i8 %add, i32 %i.09
%inc = or i32 %i.09, 1
%vecext.1 = extractelement <32 x i8> %a, i32 %inc
%vecext1.1 = extractelement <32 x i8> %b, i32 %inc
%add.1 = add i8 %vecext.1, %vecext1.1
%vecins.1 = insertelement <32 x i8> %vecins, i8 %add.1, i32 %inc
%inc.1 = or i32 %i.09, 2
%vecext.2 = extractelement <32 x i8> %a, i32 %inc.1
%vecext1.2 = extractelement <32 x i8> %b, i32 %inc.1
%add.2 = add i8 %vecext.2, %vecext1.2
%vecins.2 = insertelement <32 x i8> %vecins.1, i8 %add.2, i32 %inc.1
%inc.2 = or i32 %i.09, 3
%vecext.3 = extractelement <32 x i8> %a, i32 %inc.2
%vecext1.3 = extractelement <32 x i8> %b, i32 %inc.2
%add.3 = add i8 %vecext.3, %vecext1.3
%vecins.3 = insertelement <32 x i8> %vecins.2, i8 %add.3, i32 %inc.2
%inc.3 = add nuw nsw i32 %i.09, 4
%exitcond.3 = icmp eq i32 %inc.3, 32
br i1 %exitcond.3, label %for.cond.cleanup, label %for.body
}
However, running opt twice produces the optimized result:
$ ~/build/opt -O2 -S < a.ll | ~/build/opt -S -O2
define <32 x i8> @_Z3AddDv32_cS_(<32 x i8> %a, <32 x i8> %b) local_unnamed_addr
#0 {
entry:
%0 = add <32 x i8> %a, %b
ret <32 x i8> %0
}
I suspect that SLPVectorizer didn't pick up some code patterns that are
optimized away in later runs.</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>