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 | 595923ff75b32342103ae5df688f91637d8f18f4 (patch) | |
| tree | bce8fb17c8f5ca2b3bc2a613d745326b83cb09d9 /llvm/lib/Transforms | |
| parent | ab8022055a1d90b1d0ba6ace1b42618c33f00e6e (diff) | |
| download | bcm5719-llvm-595923ff75b32342103ae5df688f91637d8f18f4.tar.gz bcm5719-llvm-595923ff75b32342103ae5df688f91637d8f18f4.zip | |
Fix PR3826 - InstComb assert with vector shift, by not calling ComputeNumSignBits on a vector.
llvm-svn: 67211
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index fa24d892176..4a7f4c74f33 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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; } |

