diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-18 16:32:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-18 16:32:19 +0000 |
commit | b44b3666f9b7a6c710f3bad0c4993788963759e3 (patch) | |
tree | f683c0fdd47236a0ee6fe9da057a4b1e24518a2c /lib/Transforms | |
parent | f023b54bcd817a7dea1a7f02f1db6f69eae3f0d6 (diff) |
Fix PR3826 - InstComb assert with vector shift, by not calling ComputeNumSignBits on a vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67211 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index fa24d89217..4a7f4c74f3 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7029,15 +7029,16 @@ Instruction *InstCombiner::visitAShr(BinaryOperator &I) { 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; } |