Skip to content

Commit 987ab63

Browse files
author
Michael Zolotukhin
committedJun 8, 2016
[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
1 parent a8777c2 commit 987ab63

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
 

‎llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ void BoUpSLP::buildTree(ArrayRef<Value *> Roots,
10141014

10151015

10161016
void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth) {
1017-
bool SameTy = getSameType(VL); (void)SameTy;
1017+
bool SameTy = allConstant(VL) || getSameType(VL); (void)SameTy;
10181018
bool isAltShuffle = false;
10191019
assert(SameTy && "Invalid types!");
10201020

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
; RUN: opt < %s -S -slp-vectorizer
2+
3+
; This code has GEPs with different index types, which should not
4+
; matter for the SLPVectorizer.
5+
6+
target triple = "x86_64--linux"
7+
8+
define void @foo() {
9+
entry:
10+
br label %bb1
11+
12+
bb1:
13+
%ls1.ph = phi float* [ %_tmp1, %bb1 ], [ undef, %entry ]
14+
%ls2.ph = phi float* [ %_tmp2, %bb1 ], [ undef, %entry ]
15+
store float undef, float* %ls1.ph
16+
%_tmp1 = getelementptr float, float* %ls1.ph, i32 1
17+
%_tmp2 = getelementptr float, float* %ls2.ph, i64 4
18+
br i1 false, label %bb1, label %bb2
19+
20+
bb2:
21+
ret void
22+
}

0 commit comments

Comments
 (0)
Please sign in to comment.