Unclutter this by using new cast creation functions.
authorReid Spencer <rspencer@reidspencer.com>
Mon, 4 Dec 2006 20:18:26 +0000 (20:18 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 4 Dec 2006 20:18:26 +0000 (20:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32192 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/ScalarEvolutionExpander.h

index 7f0f96f8fe33b87ad109005bf2a1834c9b222723..c3ea383e322b261b9b110b178d9191025953f610 100644 (file)
@@ -115,18 +115,12 @@ namespace llvm {
 
     Value *visitTruncateExpr(SCEVTruncateExpr *S) {
       Value *V = expand(S->getOperand());
-      Instruction::CastOps Opcode = (V->getType()->getPrimitiveSizeInBits() ==
-          S->getType()->getPrimitiveSizeInBits()) ? Instruction::BitCast :
-          Instruction::Trunc;
-      return CastInst::create(Opcode, V, S->getType(), "tmp.", InsertPt);
+      return CastInst::createTruncOrBitCast(V, S->getType(), "tmp.", InsertPt);
     }
 
     Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
       Value *V = expandInTy(S->getOperand(),S->getType()->getUnsignedVersion());
-      Instruction::CastOps Opcode = (V->getType()->getPrimitiveSizeInBits() ==
-          S->getType()->getPrimitiveSizeInBits()) ? Instruction::BitCast :
-          Instruction::ZExt;
-      return CastInst::create(Opcode, V, S->getType(), "tmp.", InsertPt);
+      return CastInst::createZExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
     }
 
     Value *visitAddExpr(SCEVAddExpr *S) {