diff options
| author | Michael Zolotukhin <mzolotukhin@apple.com> | 2016-06-08 21:55:16 +0000 |
|---|---|---|
| committer | Michael Zolotukhin <mzolotukhin@apple.com> | 2016-06-08 21:55:16 +0000 |
| commit | 987ab631fad4edbebe3aaa00ba7c04dab1e8be32 (patch) | |
| tree | 7839a001181c9905816ba2f00a49b122290017b3 | |
| parent | a8777c2ef8f38112b5c3b2adce41bf02e8f615f4 (diff) | |
| download | bcm5719-llvm-987ab631fad4edbebe3aaa00ba7c04dab1e8be32.tar.gz bcm5719-llvm-987ab631fad4edbebe3aaa00ba7c04dab1e8be32.zip | |
[SLPVectorizer] Handle GEP with differing constant index types
Summary:
This fixes PR27617.
Bug description: The SLPVectorizer asserts on encountering GEPs with different index types, such as i8 and i64.
The patch includes a simple relaxation of the assert to allow constants being of different types, along with a regression test that will provoke the unrelaxed assert.
Reviewers: nadav, mzolotukhin
Subscribers: JesperAntonsson, llvm-commits, mzolotukhin
Differential Revision: http://reviews.llvm.org/D20685
Patch by Jesper Antonsson!
llvm-svn: 272206
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 57824434b1b..66d7fc8f1f4 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1014,7 +1014,7 @@ void BoUpSLP::buildTree(ArrayRef<Value *> Roots, 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!"); diff --git a/llvm/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll b/llvm/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll new file mode 100644 index 00000000000..1cd28a909f7 --- /dev/null +++ b/llvm/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll @@ -0,0 +1,22 @@ +; RUN: opt < %s -S -slp-vectorizer + +; This code has GEPs with different index types, which should not +; matter for the SLPVectorizer. + +target triple = "x86_64--linux" + +define void @foo() { +entry: + br label %bb1 + +bb1: + %ls1.ph = phi float* [ %_tmp1, %bb1 ], [ undef, %entry ] + %ls2.ph = phi float* [ %_tmp2, %bb1 ], [ undef, %entry ] + 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: + ret void +} |

