aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpander.h10
1 files changed, 8 insertions, 2 deletions
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) {