<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 - Wrong size taken for vectorization"
href="https://bugs.llvm.org/show_bug.cgi?id=34283">34283</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong size taken for vectorization
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ilia.taraban@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>==============nice.c=================
#include "stdio.h"
#define M 32
#define N 2 * M
unsigned int a [N];
int main ()
{
unsigned char i = 0;
for (i = 0; i < N; i += 1)
{
a[i] = 0;
}
unsigned int j = 0;
for (j = 0; j < M - 6; ++j)
{
a[N - 2 * j] = 69;
a[N - 12 - 2 * j] = 7;
}
for (int i1 = 0; i1 != M; ++i1) printf("%d\n", a[i1]);
return 0;
}
======================================
<span class="quote">>>>clang -v</span >
clang version 6.0.0 (trunk 311429)
...
<span class="quote">>>>clang nice.c -O0 -march=skx -o nice_0
>>>clang nice.c -O2 -march=skx -o nice_2
>>>sde -skx -- nice_0 > output_0
>>>sde -skx -- nice_2 > output_2
>>>vimdiff output_0 output_2</span >
+ +-- 12 lines: 0------------|+ +-- 12 lines: 0------
7 | 7
0 | 0
69 | 69
0 | 0
69 | 69
0 | 0
69 | 7 #Vector operations intersection
0 | 0
69 | 7 # here
0 | 0
69 | 69
0 | 0
69 | 69
0 | 0
69 | 69
+ +-- 5 lines: 0------------|+ +-- 5 lines: 0-------
======================================
We see in debug output, that wrong register size has been chosen for loop
vectorization.
<span class="quote">>>>clang -mllvm -debug -mllvm -print-after-all nice.c -O2 -march=skx</span >
...
LAA: Positive distance 48 with max VF = 6
Total Dependences: 1
LAA: No unsafe dependent memory operations in loop. We don't need runtime
memory checks.
LV: We can vectorize this loop!
LV: Analyzing interleaved accesses...
LV: Creating an interleave group with: store i32 7, i32* %arrayidx11, align 8,
!tbaa !2
LV: Creating an interleave group with: store i32 69, i32* %arrayidx7, align 8,
!tbaa !2
LV: The Smallest and Widest types: 32 / 32 bits.
LV: The Widest register is: 384 bits.
<span class="quote">>> Wrong value (maxVF * sizeof(int) * 8 = 192 bits) <<</span >
...
------------------------
Intel Software Engineer
Ilia Taraban</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>