forked from OSchip/llvm-project
Unclutter this by using new cast creation functions.
llvm-svn: 32192
This commit is contained in:
parent
5c14088844
commit
49c5a86912
|
@ -115,18 +115,12 @@ namespace llvm {
|
||||||
|
|
||||||
Value *visitTruncateExpr(SCEVTruncateExpr *S) {
|
Value *visitTruncateExpr(SCEVTruncateExpr *S) {
|
||||||
Value *V = expand(S->getOperand());
|
Value *V = expand(S->getOperand());
|
||||||
Instruction::CastOps Opcode = (V->getType()->getPrimitiveSizeInBits() ==
|
return CastInst::createTruncOrBitCast(V, S->getType(), "tmp.", InsertPt);
|
||||||
S->getType()->getPrimitiveSizeInBits()) ? Instruction::BitCast :
|
|
||||||
Instruction::Trunc;
|
|
||||||
return CastInst::create(Opcode, V, S->getType(), "tmp.", InsertPt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
|
Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
|
||||||
Value *V = expandInTy(S->getOperand(),S->getType()->getUnsignedVersion());
|
Value *V = expandInTy(S->getOperand(),S->getType()->getUnsignedVersion());
|
||||||
Instruction::CastOps Opcode = (V->getType()->getPrimitiveSizeInBits() ==
|
return CastInst::createZExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
|
||||||
S->getType()->getPrimitiveSizeInBits()) ? Instruction::BitCast :
|
|
||||||
Instruction::ZExt;
|
|
||||||
return CastInst::create(Opcode, V, S->getType(), "tmp.", InsertPt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *visitAddExpr(SCEVAddExpr *S) {
|
Value *visitAddExpr(SCEVAddExpr *S) {
|
||||||
|
|
Loading…
Reference in New Issue