diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-05 17:31:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-05 17:31:36 +0000 |
commit | 7c94d1171ad7620245c53bd4b2843fb0be66485e (patch) | |
tree | f054458d1b26d30ae15c0b236fd1adfdc275aad8 /llvm/lib/Transforms | |
parent | e5b358c8294f0026c482c3cf93e3c585c98e89f4 (diff) | |
download | bcm5719-llvm-7c94d1171ad7620245c53bd4b2843fb0be66485e.tar.gz bcm5719-llvm-7c94d1171ad7620245c53bd4b2843fb0be66485e.zip |
Fix flawed logic that was breaking several SPEC benchmarks, including gzip and crafty.
llvm-svn: 9731
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 4a5f1fbcfc3..07736b57c2d 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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, |