summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-12-31 08:10:58 +0000
committerChris Lattner <sabre@nondot.org>2012-12-31 08:10:58 +0000
commit240b9b1d80ae237805e8b5ec8280c139f7455b60 (patch)
tree48a63368ef4769a7082cf21b1018c0e881b4822a /lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
parentb6d9c4181a57a4b57d92a4437761387606f49c2d (diff)
downloadllvm-240b9b1d80ae237805e8b5ec8280c139f7455b60.tar.gz
llvm-240b9b1d80ae237805e8b5ec8280c139f7455b60.tar.bz2
llvm-240b9b1d80ae237805e8b5ec8280c139f7455b60.tar.xz
teach instcombine to preserve TBAA tag when merging two stores, part of
PR14753 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171279 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 5726d3a91d..ca06957281 100644
--- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -802,6 +802,13 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
InsertNewInstBefore(NewSI, *BBI);
NewSI->setDebugLoc(OtherStore->getDebugLoc());
+ // If the two stores had the same TBAA tag, preserve it.
+ if (MDNode *TBAATag1 = SI.getMetadata(LLVMContext::MD_tbaa))
+ if (MDNode *TBAATag2 = OtherStore->getMetadata(LLVMContext::MD_tbaa))
+ if (TBAATag1 == TBAATag2)
+ NewSI->setMetadata(LLVMContext::MD_tbaa, TBAATag1);
+
+
// Nuke the old stores.
EraseInstFromFunction(SI);
EraseInstFromFunction(*OtherStore);