summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
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
commiteeefe1bc07ac7ce7f774220fc4f099b6ba24bacd (patch)
tree3ffb5c9a08d3b30d3fe7a0b77e2a575a0a61cd89 /llvm/lib/Transforms/InstCombine
parent82f61bf4b69e39b6f0b8ac82a8c9be953148b5e2 (diff)
downloadbcm5719-llvm-eeefe1bc07ac7ce7f774220fc4f099b6ba24bacd.tar.gz
bcm5719-llvm-eeefe1bc07ac7ce7f774220fc4f099b6ba24bacd.zip
teach instcombine to preserve TBAA tag when merging two stores, part of
PR14753 llvm-svn: 171279
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 5726d3a91de..ca069572812 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud