Unclutter this by using new cast creation functions.

llvm-svn: 32192
This commit is contained in:
Reid Spencer 2006-12-04 20:18:26 +00:00
parent 5c14088844
commit 49c5a86912
1 changed files with 2 additions and 8 deletions

View File

@ -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) {