summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-11-03 18:13:57 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-11-03 18:13:57 +0000
commit3d5a02f677262841d951257b928e49d18c460410 (patch)
treecb589318c6689855bdf6e45ce3cfd6e9932f4e91 /llvm/lib
parent1d8cc909cc1bd6cb2e78d179a2c33b30610215a9 (diff)
downloadbcm5719-llvm-3d5a02f677262841d951257b928e49d18c460410.tar.gz
bcm5719-llvm-3d5a02f677262841d951257b928e49d18c460410.zip
IR: MDNode => Value: Instruction::getAllMetadataOtherThanDebugLoc()
Change `Instruction::getAllMetadataOtherThanDebugLoc()` from a vector of `MDNode` to one of `Value`. Part of PR21433. llvm-svn: 221167
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp2
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.cpp8
-rw-r--r--llvm/lib/IR/Instruction.cpp2
-rw-r--r--llvm/lib/IR/Metadata.cpp5
-rw-r--r--llvm/lib/IR/TypeFinder.cpp4
-rw-r--r--llvm/lib/Target/R600/SITypeRewriter.cpp3
-rw-r--r--llvm/lib/Transforms/Scalar/Scalarizer.cpp5
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp4
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp2
-rw-r--r--llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp4
10 files changed, 19 insertions, 20 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 191fdc9efdc..ef7a456a35c 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -848,7 +848,7 @@ static void WriteMetadataAttachment(const Function &F,
// Write metadata attachments
// METADATA_ATTACHMENT - [m x [value, [n x [id, mdnode]]]
- SmallVector<std::pair<unsigned, MDNode*>, 4> MDs;
+ SmallVector<std::pair<unsigned, Value *>, 4> MDs;
for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end();
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index c14591acc8a..902bb27c1e9 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -321,7 +321,7 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
EnumerateValueSymbolTable(M->getValueSymbolTable());
EnumerateNamedMetadata(M);
- SmallVector<std::pair<unsigned, MDNode*>, 8> MDs;
+ SmallVector<std::pair<unsigned, Value *>, 8> MDs;
// Enumerate types used by function bodies and argument lists.
for (const Function &F : *M) {
@@ -347,7 +347,7 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
MDs.clear();
I.getAllMetadataOtherThanDebugLoc(MDs);
for (unsigned i = 0, e = MDs.size(); i != e; ++i)
- EnumerateMetadata(MDs[i].second);
+ EnumerateMetadata(cast<MDNode>(MDs[i].second));
if (!I.getDebugLoc().isUnknown()) {
MDNode *Scope, *IA;
@@ -741,10 +741,10 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
FnLocalMDVector.push_back(MD);
}
- SmallVector<std::pair<unsigned, MDNode*>, 8> MDs;
+ SmallVector<std::pair<unsigned, Value *>, 8> MDs;
I->getAllMetadataOtherThanDebugLoc(MDs);
for (unsigned i = 0, e = MDs.size(); i != e; ++i) {
- MDNode *N = MDs[i].second;
+ auto *N = cast<MDNode>(MDs[i].second);
if (N->isFunctionLocal() && N->getFunction())
FnLocalMDVector.push_back(N);
}
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index bf375c976df..a2bbb563db4 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -548,7 +548,7 @@ Instruction *Instruction::clone() const {
// Otherwise, enumerate and copy over metadata from the old instruction to the
// new one.
- SmallVector<std::pair<unsigned, MDNode*>, 4> TheMDs;
+ SmallVector<std::pair<unsigned, Value *>, 4> TheMDs;
getAllMetadataOtherThanDebugLoc(TheMDs);
for (const auto &MD : TheMDs)
New->setMetadata(MD.first, MD.second);
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index ba86e9e6085..34c85004bc2 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -770,9 +770,8 @@ void Instruction::getAllMetadataImpl(
array_pod_sort(Result.begin(), Result.end());
}
-void Instruction::
-getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl<std::pair<unsigned,
- MDNode*> > &Result) const {
+void Instruction::getAllMetadataOtherThanDebugLocImpl(
+ SmallVectorImpl<std::pair<unsigned, Value *>> &Result) const {
Result.clear();
assert(hasMetadataHashEntry() &&
getContext().pImpl->MetadataStore.count(this) &&
diff --git a/llvm/lib/IR/TypeFinder.cpp b/llvm/lib/IR/TypeFinder.cpp
index 689b9038913..d1d8e1381be 100644
--- a/llvm/lib/IR/TypeFinder.cpp
+++ b/llvm/lib/IR/TypeFinder.cpp
@@ -40,7 +40,7 @@ void TypeFinder::run(const Module &M, bool onlyNamed) {
}
// Get types from functions.
- SmallVector<std::pair<unsigned, MDNode*>, 4> MDForInst;
+ SmallVector<std::pair<unsigned, Value *>, 4> MDForInst;
for (Module::const_iterator FI = M.begin(), E = M.end(); FI != E; ++FI) {
incorporateType(FI->getType());
@@ -71,7 +71,7 @@ void TypeFinder::run(const Module &M, bool onlyNamed) {
// Incorporate types hiding in metadata.
I.getAllMetadataOtherThanDebugLoc(MDForInst);
for (unsigned i = 0, e = MDForInst.size(); i != e; ++i)
- incorporateMDNode(MDForInst[i].second);
+ incorporateMDNode(cast<MDNode>(MDForInst[i].second));
MDForInst.clear();
}
diff --git a/llvm/lib/Target/R600/SITypeRewriter.cpp b/llvm/lib/Target/R600/SITypeRewriter.cpp
index 367963aebb0..f32b1e4ef7b 100644
--- a/llvm/lib/Target/R600/SITypeRewriter.cpp
+++ b/llvm/lib/Target/R600/SITypeRewriter.cpp
@@ -87,7 +87,8 @@ void SITypeRewriter::visitLoadInst(LoadInst &I) {
Value *BitCast = Builder.CreateBitCast(Ptr,
PointerType::get(v4i32,PtrTy->getPointerAddressSpace()));
LoadInst *Load = Builder.CreateLoad(BitCast);
- SmallVector <std::pair<unsigned, MDNode*>, 8> MD;
+ // FIXME: Should the DebugLoc really get dropped here?
+ SmallVector<std::pair<unsigned, Value *>, 8> MD;
I.getAllMetadataOtherThanDebugLoc(MD);
for (unsigned i = 0, e = MD.size(); i != e; ++i) {
Load->setMetadata(MD[i].first, MD[i].second);
diff --git a/llvm/lib/Transforms/Scalar/Scalarizer.cpp b/llvm/lib/Transforms/Scalar/Scalarizer.cpp
index 64e12d45bb3..0ad7cea6392 100644
--- a/llvm/lib/Transforms/Scalar/Scalarizer.cpp
+++ b/llvm/lib/Transforms/Scalar/Scalarizer.cpp
@@ -327,12 +327,11 @@ bool Scalarizer::canTransferMetadata(unsigned Tag) {
// Transfer metadata from Op to the instructions in CV if it is known
// to be safe to do so.
void Scalarizer::transferMetadata(Instruction *Op, const ValueVector &CV) {
- SmallVector<std::pair<unsigned, MDNode *>, 4> MDs;
+ SmallVector<std::pair<unsigned, Value *>, 4> MDs;
Op->getAllMetadataOtherThanDebugLoc(MDs);
for (unsigned I = 0, E = CV.size(); I != E; ++I) {
if (Instruction *New = dyn_cast<Instruction>(CV[I])) {
- for (SmallVectorImpl<std::pair<unsigned, MDNode *> >::iterator
- MI = MDs.begin(), ME = MDs.end(); MI != ME; ++MI)
+ for (auto MI = MDs.begin(), ME = MDs.end(); MI != ME; ++MI)
if (canTransferMetadata(MI->first))
New->setMetadata(MI->first, MI->second);
New->setDebugLoc(Op->getDebugLoc());
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 7c0e4c7f214..c6229b1028c 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1308,13 +1308,13 @@ bool llvm::removeUnreachableBlocks(Function &F) {
}
void llvm::combineMetadata(Instruction *K, const Instruction *J, ArrayRef<unsigned> KnownIDs) {
- SmallVector<std::pair<unsigned, MDNode*>, 4> Metadata;
+ SmallVector<std::pair<unsigned, Value *>, 4> Metadata;
K->dropUnknownMetadata(KnownIDs);
K->getAllMetadataOtherThanDebugLoc(Metadata);
for (unsigned i = 0, n = Metadata.size(); i < n; ++i) {
unsigned Kind = Metadata[i].first;
MDNode *JMD = J->getMDNode(Kind);
- MDNode *KMD = Metadata[i].second;
+ MDNode *KMD = cast<MDNode>(Metadata[i].second);
switch (Kind) {
default:
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 17e11724183..f02cf0a55bd 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -531,7 +531,7 @@ static std::string getDebugLocString(const Loop *L) {
/// \brief Propagate known metadata from one instruction to another.
static void propagateMetadata(Instruction *To, const Instruction *From) {
- SmallVector<std::pair<unsigned, MDNode *>, 4> Metadata;
+ SmallVector<std::pair<unsigned, Value *>, 4> Metadata;
From->getAllMetadataOtherThanDebugLoc(Metadata);
for (auto M : Metadata) {
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 73767b46a36..5771582896d 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -188,12 +188,12 @@ static void propagateIRFlags(Value *I, ArrayRef<Value *> VL) {
/// \returns \p I after propagating metadata from \p VL.
static Instruction *propagateMetadata(Instruction *I, ArrayRef<Value *> VL) {
Instruction *I0 = cast<Instruction>(VL[0]);
- SmallVector<std::pair<unsigned, MDNode *>, 4> Metadata;
+ SmallVector<std::pair<unsigned, Value *>, 4> Metadata;
I0->getAllMetadataOtherThanDebugLoc(Metadata);
for (unsigned i = 0, n = Metadata.size(); i != n; ++i) {
unsigned Kind = Metadata[i].first;
- MDNode *MD = Metadata[i].second;
+ MDNode *MD = cast_or_null<MDNode>(Metadata[i].second);
for (int i = 1, e = VL.size(); MD && i != e; i++) {
Instruction *I = cast<Instruction>(VL[i]);
OpenPOWER on IntegriCloud