[llvm] 7a834a0 - [SVE] Fix scalable vector bug in DataLayout::getIntPtrType
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 25 23:59:02 PDT 2020
Author: David Sherwood
Date: 2020-06-26T07:58:45+01:00
New Revision: 7a834a0a4ee36726df989702c44711a0ef13ec25
URL: https://github.com/llvm/llvm-project/commit/7a834a0a4ee36726df989702c44711a0ef13ec25
DIFF: https://github.com/llvm/llvm-project/commit/7a834a0a4ee36726df989702c44711a0ef13ec25.diff
LOG: [SVE] Fix scalable vector bug in DataLayout::getIntPtrType
Fixed an issue in DataLayout::getIntPtrType where we were assuming
the input type was always a fixed vector type, which isn't true.
Added a test that exposed the problem to:
Transforms/InstCombine/vector_gep1.ll
Differential Revision: https://reviews.llvm.org/D82294
Added:
Modified:
llvm/lib/IR/DataLayout.cpp
llvm/test/Transforms/InstCombine/vector_gep1.ll
Removed:
################################################################################
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index ca8f66d5f6c6..58ef87a21ecb 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -792,7 +792,7 @@ Type *DataLayout::getIntPtrType(Type *Ty) const {
unsigned NumBits = getPointerTypeSizeInBits(Ty);
IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits);
if (VectorType *VecTy = dyn_cast<VectorType>(Ty))
- return FixedVectorType::get(IntTy, VecTy->getNumElements());
+ return VectorType::get(IntTy, VecTy);
return IntTy;
}
diff --git a/llvm/test/Transforms/InstCombine/vector_gep1.ll b/llvm/test/Transforms/InstCombine/vector_gep1.ll
index 8e5bcf963ea1..4eb449edb348 100644
--- a/llvm/test/Transforms/InstCombine/vector_gep1.ll
+++ b/llvm/test/Transforms/InstCombine/vector_gep1.ll
@@ -62,3 +62,13 @@ define <2 x i32*> @test7(<2 x {i32, i32}*> %a) {
ret <2 x i32*> %w
}
+define <vscale x 2 x i1> @test8() {
+; CHECK-LABEL: @test8(
+; CHECK-NEXT: ret <vscale x 2 x i1> icmp ult (<vscale x 2 x i64> zext (<vscale x 2 x i32> shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> undef, i32 1, i32 0), <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer) to <vscale x 2 x i64>), <vscale x 2 x i64> zeroinitializer)
+;
+ %ins = insertelement <vscale x 2 x i32> undef, i32 1, i32 0
+ %b = shufflevector <vscale x 2 x i32> %ins, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer
+ %c = inttoptr <vscale x 2 x i32> %b to <vscale x 2 x i8*>
+ %d = icmp ult <vscale x 2 x i8*> %c, zeroinitializer
+ ret <vscale x 2 x i1> %d
+}
More information about the llvm-commits
mailing list