From 575d95ce373f1e405e6c27ce8d9f244bba3bdd0d Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 4 Dec 2006 02:46:44 +0000 Subject: Change inferred casts to explicit casts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32165 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/ScalarEvolutionExpander.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h index 163d357..7f0f96f 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpander.h +++ b/include/llvm/Analysis/ScalarEvolutionExpander.h @@ -115,12 +115,18 @@ namespace llvm { Value *visitTruncateExpr(SCEVTruncateExpr *S) { Value *V = expand(S->getOperand()); - return CastInst::createInferredCast(V, S->getType(), "tmp.", InsertPt); + Instruction::CastOps Opcode = (V->getType()->getPrimitiveSizeInBits() == + S->getType()->getPrimitiveSizeInBits()) ? Instruction::BitCast : + Instruction::Trunc; + return CastInst::create(Opcode, V, S->getType(), "tmp.", InsertPt); } Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) { Value *V = expandInTy(S->getOperand(),S->getType()->getUnsignedVersion()); - return CastInst::createInferredCast(V, S->getType(), "tmp.", InsertPt); + Instruction::CastOps Opcode = (V->getType()->getPrimitiveSizeInBits() == + S->getType()->getPrimitiveSizeInBits()) ? Instruction::BitCast : + Instruction::ZExt; + return CastInst::create(Opcode, V, S->getType(), "tmp.", InsertPt); } Value *visitAddExpr(SCEVAddExpr *S) { -- cgit v1.1