summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-12-30 00:13:21 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-12-30 00:13:21 +0000
commitacc6b4e2fdd9a242b7f15ded72dd542c0518a115 (patch)
tree217e367cfb43be9d0d2a62fc57a80c51ec35e78f /clang/lib/CodeGen/CGDecl.cpp
parent7bcde197d75fa40c982e47668dcfac2258f55296 (diff)
downloadbcm5719-llvm-acc6b4e2fdd9a242b7f15ded72dd542c0518a115.tar.gz
bcm5719-llvm-acc6b4e2fdd9a242b7f15ded72dd542c0518a115.zip
Simplify mem{cpy, move, set} creation with IRBuilder.
llvm-svn: 122634
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 9490769407d..de4cca3a288 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -810,26 +810,20 @@ void CodeGenFunction::EmitAutoVarDecl(const VarDecl &D,
llvm::Constant *Init = CGM.EmitConstantExpr(D.getInit(), Ty,this);
assert(Init != 0 && "Wasn't a simple constant init?");
- llvm::Value *AlignVal = Builder.getInt32(Align.getQuantity());
llvm::Value *SizeVal =
llvm::ConstantInt::get(CGF.IntPtrTy,
getContext().getTypeSizeInChars(Ty).getQuantity());
- const llvm::Type *BP = llvm::Type::getInt8PtrTy(VMContext);
+ const llvm::Type *BP = Builder.getInt8PtrTy();
if (Loc->getType() != BP)
Loc = Builder.CreateBitCast(Loc, BP, "tmp");
-
- llvm::Value *NotVolatile = Builder.getFalse();
// If the initializer is all or mostly zeros, codegen with memset then do
// a few stores afterward.
if (shouldUseMemSetPlusStoresToInitialize(Init,
CGM.getTargetData().getTypeAllocSize(Init->getType()))) {
- const llvm::Type *BP = llvm::Type::getInt8PtrTy(VMContext);
-
- Builder.CreateCall5(CGM.getMemSetFn(BP, SizeVal->getType()),
- Loc, Builder.getInt8(0), SizeVal, AlignVal,
- NotVolatile);
+ Builder.CreateMemSet(Loc, Builder.getInt8(0), SizeVal,
+ Align.getQuantity(), false);
if (!Init->isNullValue()) {
Loc = Builder.CreateBitCast(Loc, Init->getType()->getPointerTo());
emitStoresForInitAfterMemset(Init, Loc, Builder);
@@ -849,9 +843,7 @@ void CodeGenFunction::EmitAutoVarDecl(const VarDecl &D,
if (SrcPtr->getType() != BP)
SrcPtr = Builder.CreateBitCast(SrcPtr, BP, "tmp");
- Builder.CreateCall5(CGM.getMemCpyFn(Loc->getType(), SrcPtr->getType(),
- SizeVal->getType()),
- Loc, SrcPtr, SizeVal, AlignVal, NotVolatile);
+ Builder.CreateMemCpy(Loc, SrcPtr, SizeVal, Align.getQuantity(), false);
}
} else if (Ty->isReferenceType()) {
RValue RV = EmitReferenceBindingToExpr(Init, &D);
OpenPOWER on IntegriCloud