From: Anders Carlsson Date: Wed, 26 Dec 2007 18:20:19 +0000 (+0000) Subject: No need to do work that the folding builder does for us. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5ce097bb741733e24efd7803f29849be227f8ce;p=clang No need to do work that the folding builder does for us. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45361 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp index 81a0cedf4e..a4131507e3 100644 --- a/CodeGen/CGExprScalar.cpp +++ b/CodeGen/CGExprScalar.cpp @@ -368,50 +368,27 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, // Finally, we have the arithmetic types: real int/float. if (isa(Src->getType())) { bool InputSigned = SrcType->isSignedIntegerType(); - if (llvm::Constant *C = dyn_cast(Src)) { - if (isa(DstTy)) - return llvm::ConstantExpr::getIntegerCast(C, DstTy, InputSigned); - else if (InputSigned) - return llvm::ConstantExpr::getSIToFP(C, DstTy); - else - return llvm::ConstantExpr::getUIToFP(C, DstTy); - } else { - if (isa(DstTy)) - return Builder.CreateIntCast(Src, DstTy, InputSigned, "conv"); - else if (InputSigned) - return Builder.CreateSIToFP(Src, DstTy, "conv"); - else - return Builder.CreateUIToFP(Src, DstTy, "conv"); - } + if (isa(DstTy)) + return Builder.CreateIntCast(Src, DstTy, InputSigned, "conv"); + else if (InputSigned) + return Builder.CreateSIToFP(Src, DstTy, "conv"); + else + return Builder.CreateUIToFP(Src, DstTy, "conv"); } assert(Src->getType()->isFloatingPoint() && "Unknown real conversion"); if (isa(DstTy)) { - if (llvm::Constant *C = dyn_cast(Src)) { - if (DstType->isSignedIntegerType()) - return llvm::ConstantExpr::getFPToSI(C, DstTy); - else - return llvm::ConstantExpr::getFPToUI(C, DstTy); - } else { - if (DstType->isSignedIntegerType()) - return Builder.CreateFPToSI(Src, DstTy, "conv"); - else - return Builder.CreateFPToUI(Src, DstTy, "conv"); - } + if (DstType->isSignedIntegerType()) + return Builder.CreateFPToSI(Src, DstTy, "conv"); + else + return Builder.CreateFPToUI(Src, DstTy, "conv"); } assert(DstTy->isFloatingPoint() && "Unknown real conversion"); - if (llvm::Constant *C = dyn_cast(Src)) { - if (DstTy->getTypeID() < Src->getType()->getTypeID()) - return llvm::ConstantExpr::getFPTrunc(C, DstTy); - else - return llvm::ConstantExpr::getFPExtend(C, DstTy); - } else { - if (DstTy->getTypeID() < Src->getType()->getTypeID()) - return Builder.CreateFPTrunc(Src, DstTy, "conv"); - else - return Builder.CreateFPExt(Src, DstTy, "conv"); - } + if (DstTy->getTypeID() < Src->getType()->getTypeID()) + return Builder.CreateFPTrunc(Src, DstTy, "conv"); + else + return Builder.CreateFPExt(Src, DstTy, "conv"); } /// EmitComplexToScalarConversion - Emit a conversion from the specified