From 4e8a9e8640a6717120394ee2ee5f27989757754d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 21 Nov 2008 16:43:15 +0000 Subject: reapply the (corrected) patch to use the new llvm intrinsics for memcpy/memmove etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59824 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprAgg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CGExprAgg.cpp') diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 1b554b2205..28f93c00f1 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -327,14 +327,16 @@ void AggExprEmitter::EmitNullInitializationToLValue(LValue LV, QualType T) { // There's a potential optimization opportunity in combining // memsets; that would be easy for arrays, but relatively // difficult for structures with the current code. - llvm::Value *MemSet = CGF.CGM.getIntrinsic(llvm::Intrinsic::memset_i64); + const llvm::Type *SizeTy = llvm::Type::Int64Ty; + llvm::Value *MemSet = CGF.CGM.getIntrinsic(llvm::Intrinsic::memset, + &SizeTy, 1); uint64_t Size = CGF.getContext().getTypeSize(T); const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty); llvm::Value* DestPtr = Builder.CreateBitCast(LV.getAddress(), BP, "tmp"); Builder.CreateCall4(MemSet, DestPtr, llvm::ConstantInt::get(llvm::Type::Int8Ty, 0), - llvm::ConstantInt::get(llvm::Type::Int64Ty, Size/8), + llvm::ConstantInt::get(SizeTy, Size/8), llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)); } } -- cgit v1.2.3