From eeefe1bc07ac7ce7f774220fc4f099b6ba24bacd 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 llvm-svn: 171279 --- llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/Transforms/InstCombine') 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); -- cgit v1.2.3