[PATCH] D20685: SLPVectorizer to handle GEP with differing constant index types

Jesper Antonsson via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 05:48:29 PDT 2016


JesperAntonsson updated this revision to Diff 60019.
JesperAntonsson added a comment.

Corrected test case in accordance to the review comments from Michael Zolotukhin. (Thanks Michael!)


http://reviews.llvm.org/D20685

Files:
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  test/Transforms/SLPVectorizer/X86/gep_mismatch.ll

Index: test/Transforms/SLPVectorizer/X86/gep_mismatch.ll
===================================================================
--- /dev/null
+++ test/Transforms/SLPVectorizer/X86/gep_mismatch.ll
@@ -0,0 +1,23 @@
+; RUN: opt < %s -S -mcpu=x86-64 -mtriple=x86_64-linux -slp-vectorizer
+
+; This code has GEPs with different index types, which should not
+; matter for the SLPVectorizer.
+
+target triple = "x86_64--linux"
+
+define void @matmul() #0 {
+  br label %bb1
+
+bb1:                                        ; preds = %bb1, %0
+  %ls1.ph = phi float* [ %_tmp1, %bb1 ], [ undef, %0 ]
+  %ls2.ph = phi float* [ %_tmp2, %bb1 ], [ undef, %0 ]
+  store float undef, float* %ls1.ph
+  %_tmp1 = getelementptr float, float* %ls1.ph, i32 1
+  %_tmp2 = getelementptr float, float* %ls2.ph, i64 4
+  br i1 false, label %bb1, label %bb2
+
+bb2:                                        ; preds = %bb1
+  ret void
+}
+
+attributes #0 = { "target-cpu"="x86-64" }
Index: lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1014,7 +1014,7 @@
 
 
 void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth) {
-  bool SameTy = getSameType(VL); (void)SameTy;
+   bool SameTy = allConstant(VL) || getSameType(VL); (void)SameTy;
   bool isAltShuffle = false;
   assert(SameTy && "Invalid types!");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20685.60019.patch
Type: text/x-patch
Size: 1445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160608/ae24608a/attachment.bin>


More information about the llvm-commits mailing list