From 8d668a467ab782bd57c54a639a03f2e74382af84 Mon Sep 17 00:00:00 2001 From: Sanjiv Gupta Date: Fri, 21 Nov 2008 07:57:42 +0000 Subject: [PATCH] mem[cpy,set,move] intrinsics are now overloaded. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59806 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprAgg.cpp | 2 +- lib/CodeGen/CodeGenModule.cpp | 27 +++------------------------ 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 1b554b2205..7caf6dfd7f 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -327,7 +327,7 @@ 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); + llvm::Value *MemSet = CGF.CGM.getIntrinsic(llvm::Intrinsic::memset); uint64_t Size = CGF.getContext().getTypeSize(T); const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty); diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 7ea52deb2a..029adba2b1 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -757,38 +757,17 @@ llvm::Function *CodeGenModule::getIntrinsic(unsigned IID,const llvm::Type **Tys, llvm::Function *CodeGenModule::getMemCpyFn() { if (MemCpyFn) return MemCpyFn; - llvm::Intrinsic::ID IID; - switch (Context.Target.getPointerWidth(0)) { - default: assert(0 && "Unknown ptr width"); - case 16: IID = llvm::Intrinsic::memcpy_i16; break; - case 32: IID = llvm::Intrinsic::memcpy_i32; break; - case 64: IID = llvm::Intrinsic::memcpy_i64; break; - } - return MemCpyFn = getIntrinsic(IID); + return MemCpyFn = getIntrinsic(llvm::Intrinsic::memcpy); } llvm::Function *CodeGenModule::getMemMoveFn() { if (MemMoveFn) return MemMoveFn; - llvm::Intrinsic::ID IID; - switch (Context.Target.getPointerWidth(0)) { - default: assert(0 && "Unknown ptr width"); - case 16: IID = llvm::Intrinsic::memmove_i16; break; - case 32: IID = llvm::Intrinsic::memmove_i32; break; - case 64: IID = llvm::Intrinsic::memmove_i64; break; - } - return MemMoveFn = getIntrinsic(IID); + return MemMoveFn = getIntrinsic(llvm::Intrinsic::memmove); } llvm::Function *CodeGenModule::getMemSetFn() { if (MemSetFn) return MemSetFn; - llvm::Intrinsic::ID IID; - switch (Context.Target.getPointerWidth(0)) { - default: assert(0 && "Unknown ptr width"); - case 16: IID = llvm::Intrinsic::memset_i16; break; - case 32: IID = llvm::Intrinsic::memset_i32; break; - case 64: IID = llvm::Intrinsic::memset_i64; break; - } - return MemSetFn = getIntrinsic(IID); + return MemSetFn = getIntrinsic(llvm::Intrinsic::memset); } static void appendFieldAndPadding(CodeGenModule &CGM,