[llvm-bugs] [Bug 47629] New: [SLPVectorizer] Failure to utilize load gather operations

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 23 07:09:57 PDT 2020


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

            Bug ID: 47629
           Summary: [SLPVectorizer] Failure to utilize load gather
                    operations
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: dtemirbulatov at gmail.com
                CC: llvm-bugs at lists.llvm.org

For the following code:
void add0(int * __restrict dst, const int * __restrict src) {
  *dst++ = *src++ + 1;
  *dst++ = *(src+10) + 2;
  *dst++ = *(src+3) + 3;
  *dst++ = *src++ + 4;
}

the SLP produces this output:

define dso_local void @add0(i32* noalias nocapture %dst, i32* noalias nocapture
readonly %src) local_unnamed_addr #0 {
entry:
  %incdec.ptr = getelementptr inbounds i32, i32* %src, i64 1
  %0 = load i32, i32* %src, align 4, !tbaa !2
  %add.ptr = getelementptr inbounds i32, i32* %src, i64 11
  %1 = load i32, i32* %add.ptr, align 4, !tbaa !2
  %add.ptr4 = getelementptr inbounds i32, i32* %src, i64 4
  %2 = load i32, i32* %add.ptr4, align 4, !tbaa !2
  %3 = load i32, i32* %incdec.ptr, align 4, !tbaa !2
  %4 = insertelement <4 x i32> undef, i32 %0, i32 0
  %5 = insertelement <4 x i32> %4, i32 %1, i32 1
  %6 = insertelement <4 x i32> %5, i32 %2, i32 2
  %7 = insertelement <4 x i32> %6, i32 %3, i32 3
  %8 = add nsw <4 x i32> %7, <i32 1, i32 2, i32 3, i32 4>
  %9 = bitcast i32* %dst to <4 x i32>*
  store <4 x i32> %8, <4 x i32>* %9, align 4, !tbaa !2
  ret void
}

but it could utilize llvm.masked.gather for avx2 and higher capable targets

-- 
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/20200923/808e1281/attachment-0001.html>


More information about the llvm-bugs mailing list