[cfe-commits] r59806 - in /cfe/trunk/lib/CodeGen: CGExprAgg.cpp CodeGenModule.cpp

Chris Lattner clattner at apple.com
Fri Nov 21 08:27:39 PST 2008


On Nov 20, 2008, at 11:57 PM, Sanjiv Gupta wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=59806&view=rev
> Log:
> mem[cpy,set,move] intrinsics are now overloaded.

Sanjiv, this patch is incorrect for exactly the reasons that the llvm  
side was broken, you're not passing in a type to getIntrinsic to set  
the size.

Please make sure to run make test before committing, thanks!

-Chris

>
> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Nov 21 01:57:42 2008
> @@ -327,7 +327,7 @@
>     // 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);
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=59806&r1=59805&r2=59806&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Nov 21 01:57:42 2008
> @@ -757,38 +757,17 @@
>
> 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,
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list