aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-23 06:00:11 +0000
committerChris Lattner <sabre@nondot.org>2004-02-23 06:00:11 +0000
commitfed58fd72e1c02ea9e068fc5e9a1f1c7d1912bb8 (patch)
treef8e97a764a914aee65562a87ca16f5873b19b1be /lib/Transforms/Scalar
parentf4821745dfb23899d250bb9010582750e5cee31a (diff)
downloadexternal_llvm-fed58fd72e1c02ea9e068fc5e9a1f1c7d1912bb8.zip
external_llvm-fed58fd72e1c02ea9e068fc5e9a1f1c7d1912bb8.tar.gz
external_llvm-fed58fd72e1c02ea9e068fc5e9a1f1c7d1912bb8.tar.bz2
Implement mul.ll:test11
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index f23c10f..a5fcbc9 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -616,12 +616,13 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
Value *SCIOp0 = SCI->getOperand(0), *SCIOp1 = SCI->getOperand(1);
const Type *SCOpTy = SCIOp0->getType();
- // If the source is X < 0, and X is a signed integer type, convert this
- // multiply into a shift/and combination.
- if (SCI->getOpcode() == Instruction::SetLT &&
- isa<Constant>(SCIOp1) && cast<Constant>(SCIOp1)->isNullValue() &&
- SCOpTy->isInteger() && SCOpTy->isSigned()) {
-
+ // If the source is X < 0 or X <= -1, and X is a signed integer type,
+ // convert this multiply into a shift/and combination.
+ if (SCOpTy->isSigned() && isa<ConstantInt>(SCIOp1) &&
+ ((SCI->getOpcode() == Instruction::SetLT &&
+ cast<Constant>(SCIOp1)->isNullValue()) ||
+ (SCI->getOpcode() == Instruction::SetLE &&
+ cast<ConstantInt>(SCIOp1)->isAllOnesValue()))) {
// Shift the X value right to turn it into "all signbits".
Constant *Amt = ConstantUInt::get(Type::UByteTy,
SCOpTy->getPrimitiveSize()*8-1);