1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

switch from pointer equality comparison to MDNode::getMostGenericTBAA

when merging two TBAA tags, pointed out by Nuno.

llvm-svn: 171627
This commit is contained in:
Chris Lattner 2013-01-05 16:44:07 +00:00
parent afc1c2b5ea
commit 561e5f6442
3 changed files with 9 additions and 8 deletions

View File

@ -803,10 +803,10 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
NewSI->setDebugLoc(OtherStore->getDebugLoc()); NewSI->setDebugLoc(OtherStore->getDebugLoc());
// If the two stores had the same TBAA tag, preserve it. // If the two stores had the same TBAA tag, preserve it.
if (MDNode *TBAATag1 = SI.getMetadata(LLVMContext::MD_tbaa)) if (MDNode *TBAATag = SI.getMetadata(LLVMContext::MD_tbaa))
if (MDNode *TBAATag2 = OtherStore->getMetadata(LLVMContext::MD_tbaa)) if ((TBAATag = MDNode::getMostGenericTBAA(TBAATag,
if (TBAATag1 == TBAATag2) OtherStore->getMetadata(LLVMContext::MD_tbaa))))
NewSI->setMetadata(LLVMContext::MD_tbaa, TBAATag1); NewSI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
// Nuke the old stores. // Nuke the old stores.

View File

@ -46,6 +46,7 @@
#include "llvm/IR/Instructions.h" #include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Support/CFG.h" #include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
@ -816,10 +817,11 @@ void LICM::PromoteAliasSet(AliasSet &AS,
if (LoopUses.empty()) { if (LoopUses.empty()) {
// On the first load/store, just take its TBAA tag. // On the first load/store, just take its TBAA tag.
TBAATag = Use->getMetadata(LLVMContext::MD_tbaa); TBAATag = Use->getMetadata(LLVMContext::MD_tbaa);
} else if (TBAATag && TBAATag != Use->getMetadata(LLVMContext::MD_tbaa)) { } else if (TBAATag) {
TBAATag = 0; TBAATag = MDNode::getMostGenericTBAA(TBAATag,
Use->getMetadata(LLVMContext::MD_tbaa));
} }
LoopUses.push_back(Use); LoopUses.push_back(Use);
} }
} }

View File

@ -22,7 +22,6 @@
#include "llvm/IR/Type.h" #include "llvm/IR/Type.h"
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/TypeFinder.h" #include "llvm/TypeFinder.h"
using namespace llvm; using namespace llvm;
namespace { namespace {