diff options
Diffstat (limited to 'lib/Transforms/ExprTypeConvert.cpp')
-rw-r--r-- | lib/Transforms/ExprTypeConvert.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index 91450218c0..e0aaf7b668 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -76,10 +76,12 @@ bool llvm::ExpressionConvertibleToType(Value *V, const Type *Ty, !ExpressionConvertibleToType(I->getOperand(1), Ty, CTMap, TD)) return false; break; - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: if (!Ty->isInteger()) return false; - if (Ty->isSigned() != V->getType()->isSigned()) return false; - // FALL THROUGH + if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD)) + return false; + break; case Instruction::Shl: if (!Ty->isInteger()) return false; if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD)) @@ -243,7 +245,8 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty, break; case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: Res = new ShiftInst(cast<ShiftInst>(I)->getOpcode(), Dummy, I->getOperand(1), Name); VMC.ExprMap[I] = Res; @@ -476,7 +479,8 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty, Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0); return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); } - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: if (Ty->isSigned() != V->getType()->isSigned()) return false; // FALL THROUGH case Instruction::Shl: @@ -746,7 +750,8 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, break; } case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: assert(I->getOperand(0) == OldVal); Res = new ShiftInst(cast<ShiftInst>(I)->getOpcode(), NewVal, I->getOperand(1), Name); |