[llvm-commits] [llvm] r67211 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll
Chris Lattner
sabre at nondot.org
Wed Mar 18 09:32:19 PDT 2009
Author: lattner
Date: Wed Mar 18 11:32:19 2009
New Revision: 67211
URL: http://llvm.org/viewvc/llvm-project?rev=67211&view=rev
Log:
Fix PR3826 - InstComb assert with vector shift, by not calling ComputeNumSignBits on a vector.
Added:
llvm/trunk/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=67211&r1=67210&r2=67211&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Mar 18 11:32:19 2009
@@ -7029,15 +7029,16 @@
return ReplaceInstUsesWith(I, CSI);
// See if we can turn a signed shr into an unsigned shr.
- if (!isa<VectorType>(I.getType()) &&
- MaskedValueIsZero(Op0,
+ if (!isa<VectorType>(I.getType())) {
+ if (MaskedValueIsZero(Op0,
APInt::getSignBit(I.getType()->getPrimitiveSizeInBits())))
- return BinaryOperator::CreateLShr(Op0, I.getOperand(1));
+ return BinaryOperator::CreateLShr(Op0, I.getOperand(1));
- // Arithmetic shifting an all-sign-bit value is a no-op.
- unsigned NumSignBits = ComputeNumSignBits(Op0);
- if (NumSignBits == Op0->getType()->getPrimitiveSizeInBits())
- return ReplaceInstUsesWith(I, Op0);
+ // Arithmetic shifting an all-sign-bit value is a no-op.
+ unsigned NumSignBits = ComputeNumSignBits(Op0);
+ if (NumSignBits == Op0->getType()->getPrimitiveSizeInBits())
+ return ReplaceInstUsesWith(I, Op0);
+ }
return 0;
}
Added: llvm/trunk/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll?rev=67211&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll Wed Mar 18 11:32:19 2009
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; PR3826
+
+define void @0(<4 x i16>*, <4 x i16>*) {
+ %3 = alloca <4 x i16>* ; <<4 x i16>**> [#uses=1]
+ %4 = load <4 x i16>* null, align 1 ; <<4 x i16>> [#uses=1]
+ %5 = ashr <4 x i16> %4, <i16 5, i16 5, i16 5, i16 5> ; <<4 x i16>> [#uses=1]
+ %6 = load <4 x i16>** %3 ; <<4 x i16>*> [#uses=1]
+ store <4 x i16> %5, <4 x i16>* %6, align 1
+ ret void
+}
More information about the llvm-commits
mailing list