From 0c99509927a0c7a48490486b9fec287b63e5c09c Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 26 May 2008 12:59:39 +0000 Subject: Emit memmove, not memcpy, for structure copies; this is unfortunately required for correctness in cases of copying a struct to itself or to an overlapping struct (itself for cases like *a = *a, and overlapping is possible with unions). Hopefully, this won't end up being a perf issue; LLVM *should* be able to optimize memmove to memcpy in a lot of cases, and for small copies the generated code *should* be mostly comparable. (In reality, LLVM is currently horrible at optimizing memmove, but that's a bug, not a fundamental issue.) gcc currently generates wrong code; that's http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51566 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index bc216e4f48..992a3bf3c2 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -59,6 +59,7 @@ class CodeGenModule { CGDebugInfo *DebugInfo; llvm::Function *MemCpyFn; + llvm::Function *MemMoveFn; llvm::Function *MemSetFn; llvm::DenseMap GlobalDeclMap; std::vector StaticDecls; @@ -101,6 +102,7 @@ public: /// array containing the literal. The result is pointer to array type. llvm::Constant *GetAddrOfConstantString(const std::string& str); llvm::Function *getMemCpyFn(); + llvm::Function *getMemMoveFn(); llvm::Function *getMemSetFn(); llvm::Function *getIntrinsic(unsigned IID, const llvm::Type **Tys = 0, unsigned NumTys = 0); -- cgit v1.2.3-18-g5258