From: David Sherwood Date: Mon, 22 Jun 2020 13:09:34 +0000 (+0100) Subject: [SVE] Fix scalable vector bug in DataLayout::getIntPtrType X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7a834a0a4ee36726df989702c44711a0ef13ec25;p=android-x86%2Fexternal-llvm-project.git [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 --- diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index ca8f66d5f6c..58ef87a21ec 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(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 8e5bcf963ea..4eb449edb34 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 @test8() { +; CHECK-LABEL: @test8( +; CHECK-NEXT: ret icmp ult ( zext ( shufflevector ( insertelement ( undef, i32 1, i32 0), undef, zeroinitializer) to ), zeroinitializer) +; + %ins = insertelement undef, i32 1, i32 0 + %b = shufflevector %ins, undef, zeroinitializer + %c = inttoptr %b to + %d = icmp ult %c, zeroinitializer + ret %d +}