[cfe-commits] r45361 - /cfe/trunk/CodeGen/CGExprScalar.cpp
Anders Carlsson
andersca at mac.com
Wed Dec 26 10:20:23 PST 2007
Author: andersca
Date: Wed Dec 26 12:20:19 2007
New Revision: 45361
URL: http://llvm.org/viewvc/llvm-project?rev=45361&view=rev
Log:
No need to do work that the folding builder does for us.
Modified:
cfe/trunk/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=45361&r1=45360&r2=45361&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Wed Dec 26 12:20:19 2007
@@ -368,50 +368,27 @@
// Finally, we have the arithmetic types: real int/float.
if (isa<llvm::IntegerType>(Src->getType())) {
bool InputSigned = SrcType->isSignedIntegerType();
- if (llvm::Constant *C = dyn_cast<llvm::Constant>(Src)) {
- if (isa<llvm::IntegerType>(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<llvm::IntegerType>(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<llvm::IntegerType>(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<llvm::IntegerType>(DstTy)) {
- if (llvm::Constant *C = dyn_cast<llvm::Constant>(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<llvm::Constant>(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
More information about the cfe-commits
mailing list