diff options
author | Dan Gohman <gohman@apple.com> | 2012-09-28 21:58:29 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2012-09-28 21:58:29 +0000 |
commit | b22c7dc707cf3770ff3b5e5f11f11fd0aaa06d9b (patch) | |
tree | 229206e36c039731daa063a9a194205dc31f904b /lib/CodeGen/CGExprAgg.cpp | |
parent | 72ab27732ea7a42d756a1e79727f86fbe391b42b (diff) |
Add basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
struct assignment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 48b21d2f85..c9ffc19a8b 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -1362,11 +1362,17 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, } } } + + // Determine the metadata to describe the position of any padding in this + // memcpy, as well as the TBAA tags for the members of the struct, in case + // the optimizer wishes to expand it in to scalar memory operations. + llvm::MDNode *TBAAStructTag = CGM.getTBAAStructInfo(Ty); Builder.CreateMemCpy(DestPtr, SrcPtr, llvm::ConstantInt::get(IntPtrTy, TypeInfo.first.getQuantity()), - alignment.getQuantity(), isVolatile); + alignment.getQuantity(), isVolatile, + /*TBAATag=*/0, TBAAStructTag); } void CodeGenFunction::MaybeEmitStdInitializerListCleanup(llvm::Value *loc, |