aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-05 17:31:36 +0000
committerChris Lattner <sabre@nondot.org>2003-11-05 17:31:36 +0000
commit1bcc70d240edabb41dc74214f21ee86240ee68fb (patch)
tree7482f3a046309a63104d5094c76f9ba1bd1b28b2 /lib/Transforms/Scalar
parent7f1affe677edf5407530e31b5a2d82d713627441 (diff)
downloadexternal_llvm-1bcc70d240edabb41dc74214f21ee86240ee68fb.zip
external_llvm-1bcc70d240edabb41dc74214f21ee86240ee68fb.tar.gz
external_llvm-1bcc70d240edabb41dc74214f21ee86240ee68fb.tar.bz2
Fix flawed logic that was breaking several SPEC benchmarks, including gzip and crafty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9731 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 4a5f1fb..07736b5 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -1337,8 +1337,8 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) {
// because the source would be zero extended.
unsigned SrcBits =
SrcTy == Type::BoolTy ? 1 : SrcTy->getPrimitiveSize()*8;
- bool HasSignBit = 1ULL << (DestTy->getPrimitiveSize()*8-1);
- if (ConstVal & ((1ULL << SrcBits)-1)) {
+ bool HasSignBit = ConstVal & (1ULL << (DestTy->getPrimitiveSize()*8-1));
+ if (ConstVal & ~((1ULL << SrcBits)-1)) {
switch (I.getOpcode()) {
default: assert(0 && "Unknown comparison type!");
case Instruction::SetEQ:
@@ -1655,7 +1655,7 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) {
unsigned AllocElTySize = TD->getTypeSize(AllocElTy);
const Type *CastElTy = PTy->getElementType();
unsigned CastElTySize = TD->getTypeSize(CastElTy);
-
+
// If the allocation is for an even multiple of the cast type size
if (CastElTySize && (AllocElTySize % CastElTySize == 0)) {
Value *Amt = ConstantUInt::get(Type::UIntTy,