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);
+ if (MDNode *TBAATag = SI.getMetadata(LLVMContext::MD_tbaa))
+ if ((TBAATag = MDNode::getMostGenericTBAA(TBAATag,
+ OtherStore->getMetadata(LLVMContext::MD_tbaa))))
+ NewSI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
// Nuke the old stores.
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Metadata.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
if (LoopUses.empty()) {
// On the first load/store, just take its TBAA tag.
TBAATag = Use->getMetadata(LLVMContext::MD_tbaa);
- } else if (TBAATag && TBAATag != Use->getMetadata(LLVMContext::MD_tbaa)) {
- TBAATag = 0;
+ } else if (TBAATag) {
+ TBAATag = MDNode::getMostGenericTBAA(TBAATag,
+ Use->getMetadata(LLVMContext::MD_tbaa));
}
-
+
LoopUses.push_back(Use);
}
}