]> granicus.if.org Git - clang/commitdiff
Minor cleanup.
authorEli Friedman <eli.friedman@gmail.com>
Sat, 28 Mar 2009 03:10:45 +0000 (03:10 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sat, 28 Mar 2009 03:10:45 +0000 (03:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67896 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprAgg.cpp

index f3c1a9187bd7d871b805a46ff870508574750e33..095e2240cf626b4fd4caa77e2b5df3552436b7f5 100644 (file)
@@ -313,17 +313,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.
-    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(SizeTy, Size/8),
-                        llvm::ConstantInt::get(llvm::Type::Int32Ty, 0));
+    CGF.EmitMemSetToZero(LV.getAddress(), T);
   }
 }