diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-02-05 05:57:49 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-02-05 05:57:49 +0000 |
| commit | 83ac5ae9f3ba84291c1ce65def1d448360ec2a8d (patch) | |
| tree | 698c316ae8898022cf8d49e7042d1187c1c9c09c /llvm/lib/Transforms/Scalar | |
| parent | a1d35926b7e2fdae5cfabb005f553865fdc2dd44 (diff) | |
| download | bcm5719-llvm-83ac5ae9f3ba84291c1ce65def1d448360ec2a8d.tar.gz bcm5719-llvm-83ac5ae9f3ba84291c1ce65def1d448360ec2a8d.zip | |
Fix miscompilations of consumer-typeset, telecomm-gsm, and 176.gcc.
llvm-svn: 33902
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 80b84afd237..8b582da8fa3 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -5675,7 +5675,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, } else if (ShiftAmt1 < ShiftAmt2) { unsigned ShiftDiff = ShiftAmt2-ShiftAmt1; - // (X >>? C1) << C2 --> X << (C2-C1) & (-1 << C1) + // (X >>? C1) << C2 --> X << (C2-C1) & (-1 << C2) if (I.getOpcode() == Instruction::Shl) { assert(ShiftOp->getOpcode() == Instruction::LShr || ShiftOp->getOpcode() == Instruction::AShr); @@ -5683,18 +5683,18 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, BinaryOperator::createShl(X, ConstantInt::get(Ty, ShiftDiff)); InsertNewInstBefore(Shift, I); - uint64_t Mask = Ty->getBitMask() << ShiftAmt1; + uint64_t Mask = Ty->getBitMask() << ShiftAmt2; return BinaryOperator::createAnd(Shift, ConstantInt::get(Ty, Mask)); } - // (X << C1) >>u C2 --> X >>u (C2-C1) & (-1 >> C1) + // (X << C1) >>u C2 --> X >>u (C2-C1) & (-1 >> C2) if (I.getOpcode() == Instruction::LShr) { assert(ShiftOp->getOpcode() == Instruction::Shl); Instruction *Shift = BinaryOperator::createLShr(X, ConstantInt::get(Ty, ShiftDiff)); InsertNewInstBefore(Shift, I); - uint64_t Mask = Ty->getBitMask() >> ShiftAmt1; + uint64_t Mask = Ty->getBitMask() >> ShiftAmt2; return BinaryOperator::createAnd(Shift, ConstantInt::get(Ty, Mask)); } @@ -5703,7 +5703,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, assert(ShiftAmt2 < ShiftAmt1); unsigned ShiftDiff = ShiftAmt1-ShiftAmt2; - // (X >>? C1) << C2 --> X >>? (C1-C2) & (-1 << C1) + // (X >>? C1) << C2 --> X >>? (C1-C2) & (-1 << C2) if (I.getOpcode() == Instruction::Shl) { assert(ShiftOp->getOpcode() == Instruction::LShr || ShiftOp->getOpcode() == Instruction::AShr); @@ -5716,7 +5716,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, return BinaryOperator::createAnd(Shift, ConstantInt::get(Ty, Mask)); } - // (X << C1) >>u C2 --> X << (C1-C2) & (-1 >> C1) + // (X << C1) >>u C2 --> X << (C1-C2) & (-1 >> C2) if (I.getOpcode() == Instruction::LShr) { assert(ShiftOp->getOpcode() == Instruction::Shl); Instruction *Shift = |

