[llvm-bugs] [Bug 34283] New: Wrong size taken for vectorization

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 22 11:10:15 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34283

            Bug ID: 34283
           Summary: Wrong size taken for vectorization
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ilia.taraban at intel.com
                CC: llvm-bugs at lists.llvm.org

==============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;
}


======================================

>>>clang -v
clang version 6.0.0 (trunk 311429)
...

>>>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
+ +-- 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.

>>>clang -mllvm -debug -mllvm -print-after-all nice.c -O2 -march=skx
...
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.           
>> Wrong value (maxVF * sizeof(int) * 8 = 192 bits) <<
...

------------------------
Intel Software Engineer
Ilia Taraban

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170822/231f9f30/attachment-0001.html>


More information about the llvm-bugs mailing list