]> granicus.if.org Git - clang/commitdiff
temporarily revert Sangiv's patch.
authorChris Lattner <sabre@nondot.org>
Fri, 21 Nov 2008 16:26:37 +0000 (16:26 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 21 Nov 2008 16:26:37 +0000 (16:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59821 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CodeGenModule.cpp

index 7caf6dfd7f5e95514a8464bad7776d45fb1f8d9b..1b554b2205539e7536fbf7638c016ce336f2736b 100644 (file)
@@ -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);
+    llvm::Value *MemSet = CGF.CGM.getIntrinsic(llvm::Intrinsic::memset_i64);
     uint64_t Size = CGF.getContext().getTypeSize(T);
     
     const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
index 029adba2b16f8b01d35d2719f3083e58807d9fc8..7ea52deb2ad44c6057c9f720203b15d6616540aa 100644 (file)
@@ -757,17 +757,38 @@ llvm::Function *CodeGenModule::getIntrinsic(unsigned IID,const llvm::Type **Tys,
 
 llvm::Function *CodeGenModule::getMemCpyFn() {
   if (MemCpyFn) return MemCpyFn;
-  return MemCpyFn = getIntrinsic(llvm::Intrinsic::memcpy);
+  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);
 }
 
 llvm::Function *CodeGenModule::getMemMoveFn() {
   if (MemMoveFn) return MemMoveFn;
-  return MemMoveFn = getIntrinsic(llvm::Intrinsic::memmove);
+  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);
 }
 
 llvm::Function *CodeGenModule::getMemSetFn() {
   if (MemSetFn) return MemSetFn;
-  return MemSetFn = getIntrinsic(llvm::Intrinsic::memset);
+  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);
 }
 
 static void appendFieldAndPadding(CodeGenModule &CGM,