[llvm] r272206 - [SLPVectorizer] Handle GEP with differing constant index types
Michael Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 8 14:55:17 PDT 2016
Author: mzolotukhin
Date: Wed Jun 8 16:55:16 2016
New Revision: 272206
URL: http://llvm.org/viewvc/llvm-project?rev=272206&view=rev
Log:
[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!
Added:
llvm/trunk/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll
Modified:
llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=272206&r1=272205&r2=272206&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Wed Jun 8 16:55:16 2016
@@ -1014,7 +1014,7 @@ void BoUpSLP::buildTree(ArrayRef<Value *
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!");
Added: llvm/trunk/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll?rev=272206&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll (added)
+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/gep_mismatch.ll Wed Jun 8 16:55:16 2016
@@ -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
+}
More information about the llvm-commits
mailing list