diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-05-05 20:51:30 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-05-05 20:51:30 +0000 |
| commit | e745c7de0e0cbe42cbdbbab869f14856f27b7ff0 (patch) | |
| tree | 6c5458c4062357a505fb77fd82149e5dc6eb2dbb /llvm/lib/Transforms | |
| parent | 52c22512b91d1f9ece3229def2cbe0e998edbae0 (diff) | |
| download | bcm5719-llvm-e745c7de0e0cbe42cbdbbab869f14856f27b7ff0.tar.gz bcm5719-llvm-e745c7de0e0cbe42cbdbbab869f14856f27b7ff0.zip | |
Fix an infinite loop compiling oggenc last night.
llvm-svn: 28128
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 2c8f6eda495..6491ff9b0f7 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2642,9 +2642,10 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { // fold (and (cast A), (cast B)) -> (cast (and A, B)) if (CastInst *Op0C = dyn_cast<CastInst>(Op0)) { + const Type *SrcTy = Op0C->getOperand(0)->getType(); if (CastInst *Op1C = dyn_cast<CastInst>(Op1)) - if (Op0C->getOperand(0)->getType() == Op1C->getOperand(0)->getType() && - Op0C->getOperand(0)->getType()->isIntegral()) { + if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && + !SrcTy->isLosslesslyConvertibleTo(Op0C->getType())) { Instruction *NewOp = BinaryOperator::createAnd(Op0C->getOperand(0), Op1C->getOperand(0), I.getName()); @@ -2881,9 +2882,10 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { // fold (or (cast A), (cast B)) -> (cast (or A, B)) if (CastInst *Op0C = dyn_cast<CastInst>(Op0)) { + const Type *SrcTy = Op0C->getOperand(0)->getType(); if (CastInst *Op1C = dyn_cast<CastInst>(Op1)) - if (Op0C->getOperand(0)->getType() == Op1C->getOperand(0)->getType() && - Op0C->getOperand(0)->getType()->isIntegral()) { + if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && + !SrcTy->isLosslesslyConvertibleTo(Op0C->getType())) { Instruction *NewOp = BinaryOperator::createOr(Op0C->getOperand(0), Op1C->getOperand(0), I.getName()); @@ -3059,9 +3061,10 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { // fold (xor (cast A), (cast B)) -> (cast (xor A, B)) if (CastInst *Op0C = dyn_cast<CastInst>(Op0)) { + const Type *SrcTy = Op0C->getOperand(0)->getType(); if (CastInst *Op1C = dyn_cast<CastInst>(Op1)) - if (Op0C->getOperand(0)->getType() == Op1C->getOperand(0)->getType() && - Op0C->getOperand(0)->getType()->isIntegral()) { + if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && + !SrcTy->isLosslesslyConvertibleTo(Op0C->getType())) { Instruction *NewOp = BinaryOperator::createXor(Op0C->getOperand(0), Op1C->getOperand(0), I.getName()); |

