diff options
Diffstat (limited to 'lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolutionExpander.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index db23a24d60..5e395db5e2 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -19,25 +19,8 @@ using namespace llvm; /// InsertCastOfTo - Insert a cast of V to the specified type, doing what /// we can to share the casts. -Value *SCEVExpander::InsertCastOfTo(Value *V, const Type *Ty) { - // Compute the Cast opcode to use - Instruction::CastOps opcode = Instruction::BitCast; - if (Ty->isIntegral()) { - if (V->getType()->getTypeID() == Type::PointerTyID) - opcode = Instruction::PtrToInt; - else { - unsigned SrcBits = V->getType()->getPrimitiveSizeInBits(); - unsigned DstBits = Ty->getPrimitiveSizeInBits(); - opcode = (SrcBits > DstBits ? Instruction::Trunc : - (SrcBits == DstBits ? Instruction::BitCast : - (V->getType()->isSigned() ? Instruction::SExt : - Instruction::ZExt))); - } - } else if (Ty->isFloatingPoint()) - opcode = Instruction::UIToFP; - else if (Ty->getTypeID() == Type::PointerTyID && V->getType()->isIntegral()) - opcode = Instruction::IntToPtr; - +Value *SCEVExpander::InsertCastOfTo(Instruction::CastOps opcode, Value *V, + const Type *Ty) { // FIXME: keep track of the cast instruction. if (Constant *C = dyn_cast<Constant>(V)) return ConstantExpr::getCast(opcode, C, Ty); |