[llvm] r234046 - [InstCombine] Use DataLayout to determine vector element width
Sanjay Patel
spatel at rotateright.com
Fri Apr 3 14:18:35 PDT 2015
Hi David,
CHECK-LABEL cut and paste bug?
On Fri, Apr 3, 2015 at 2:18 PM, David Majnemer <david.majnemer at gmail.com>
wrote:
> Author: majnemer
> Date: Fri Apr 3 15:18:40 2015
> New Revision: 234046
>
> URL: http://llvm.org/viewvc/llvm-project?rev=234046&view=rev
> Log:
> [InstCombine] Use DataLayout to determine vector element width
>
> InstCombine didn't realize that it needs to use DataLayout to determine
> how wide pointers are. This lead to assertion failures.
>
> This fixes PR23113.
>
> Modified:
> llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
> llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp?rev=234046&r1=234045&r2=234046&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp Fri
> Apr 3 15:18:40 2015
> @@ -987,8 +987,7 @@ Instruction *InstCombiner::visitShuffleV
> unsigned BegIdx = Mask.front();
> VectorType *SrcTy = cast<VectorType>(V->getType());
> unsigned VecBitWidth = SrcTy->getBitWidth();
> - unsigned SrcElemBitWidth =
> - SrcTy->getElementType()->getPrimitiveSizeInBits();
> + unsigned SrcElemBitWidth =
> DL.getTypeSizeInBits(SrcTy->getElementType());
> assert(SrcElemBitWidth && "vector elements must have a bitwidth");
> unsigned SrcNumElems = SrcTy->getNumElements();
> SmallVector<BitCastInst *, 8> BCs;
> @@ -1000,7 +999,7 @@ Instruction *InstCombiner::visitShuffleV
> BCs.push_back(BC);
> for (BitCastInst *BC : BCs) {
> Type *TgtTy = BC->getDestTy();
> - unsigned TgtElemBitWidth = TgtTy->getPrimitiveSizeInBits();
> + unsigned TgtElemBitWidth = DL.getTypeSizeInBits(TgtTy);
> if (!TgtElemBitWidth)
> continue;
> unsigned TgtNumElems = VecBitWidth / TgtElemBitWidth;
>
> Modified: llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll?rev=234046&r1=234045&r2=234046&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll (original)
> +++ llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll Fri Apr 3
> 15:18:40 2015
> @@ -414,3 +414,11 @@ define <4 x i32> @pr20114(<4 x i32> %__m
> %masked_new.i.i.i = and <4 x i32> bitcast (<2 x i64> <i64 ptrtoint (<4
> x i32> (<4 x i32>)* @pr20114 to i64), i64 ptrtoint (<4 x i32> (<4 x i32>)*
> @pr20114 to i64)> to <4 x i32>), %mask01.i
> ret <4 x i32> %masked_new.i.i.i
> }
> +
> +define <2 x i32*> @pr23113(<4 x i32*> %A) {
> +; CHECK-LABEL: @pr20114
> +; CHECK: %[[V:.*]] = shufflevector <4 x i32*> %A, <4 x i32*> undef, <2 x
> i32> <i32 0, i32 1>
> +; CHECK-NEXT: ret <2 x i32*> %[[V]]
> + %1 = shufflevector <4 x i32*> %A, <4 x i32*> undef, <2 x i32> <i32 0,
> i32 1>
> + ret <2 x i32*> %1
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150403/15e3b17e/attachment.html>
More information about the llvm-commits
mailing list