From 240b9b1d80ae237805e8b5ec8280c139f7455b60 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 31 Dec 2012 08:10:58 +0000 Subject: 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 --- lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp') 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); -- cgit v1.2.3