diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-11 21:30:22 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-11 21:30:22 +0000 |
commit | de36e8040fa72a8242de3fa4a2d663e1c8d0c225 (patch) | |
tree | f0f67024e641b7bbfa0282cae2ba097128370b06 /llvm/lib/Transforms | |
parent | 6312f4a422ddcb6a262ffc9fd3699cd2ec570425 (diff) | |
download | bcm5719-llvm-de36e8040fa72a8242de3fa4a2d663e1c8d0c225.tar.gz bcm5719-llvm-de36e8040fa72a8242de3fa4a2d663e1c8d0c225.zip |
Revert "IR: MDNode => Value"
Instead, we're going to separate metadata from the Value hierarchy. See
PR21532.
This reverts commit r221375.
This reverts commit r221373.
This reverts commit r221359.
This reverts commit r221167.
This reverts commit r221027.
This reverts commit r221024.
This reverts commit r221023.
This reverts commit r220995.
This reverts commit r220994.
llvm-svn: 221711
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/DebugIR.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/Scalarizer.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 21 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 6 |
15 files changed, 50 insertions, 45 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 3b20662068d..5a70d8bb640 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -117,7 +117,7 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) { // If the memcpy has metadata describing the members, see if we can // get the TBAA tag describing our copy. - if (MDNode *M = MI->getMDNode(LLVMContext::MD_tbaa_struct)) { + if (MDNode *M = MI->getMetadata(LLVMContext::MD_tbaa_struct)) { if (M->getNumOperands() == 3 && M->getOperand(0) && isa<ConstantInt>(M->getOperand(0)) && diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index ebbb9ec08c5..f3ac44cbd6b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -304,7 +304,7 @@ Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) { static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewTy) { Value *Ptr = LI.getPointerOperand(); unsigned AS = LI.getPointerAddressSpace(); - SmallVector<std::pair<unsigned, Value *>, 8> MD; + SmallVector<std::pair<unsigned, MDNode *>, 8> MD; LI.getAllMetadata(MD); LoadInst *NewLoad = IC.Builder->CreateAlignedLoad( @@ -312,7 +312,7 @@ static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewT LI.getAlignment(), LI.getName()); for (const auto &MDPair : MD) { unsigned ID = MDPair.first; - Value *N = MDPair.second; + MDNode *N = MDPair.second; // Note, essentially every kind of metadata should be preserved here! This // routine is supposed to clone a load instruction changing *only its type*. // The only metadata it makes sense to drop is metadata which is invalidated diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 49eccad1d97..3e62165c7b4 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -256,9 +256,7 @@ class GlobalsMetadata { NamedMDNode *Globals = M.getNamedMetadata("llvm.asan.globals"); if (!Globals) return; - for (const Value *MDV : Globals->operands()) { - const MDNode *MDN = cast<MDNode>(MDV); - + for (auto MDN : Globals->operands()) { // Metadata node contains the global and the fields of "Entry". assert(MDN->getNumOperands() == 5); Value *V = MDN->getOperand(0); diff --git a/llvm/lib/Transforms/Instrumentation/DebugIR.cpp b/llvm/lib/Transforms/Instrumentation/DebugIR.cpp index 7a0ed81eed6..5234341b32e 100644 --- a/llvm/lib/Transforms/Instrumentation/DebugIR.cpp +++ b/llvm/lib/Transforms/Instrumentation/DebugIR.cpp @@ -474,7 +474,7 @@ bool getSourceInfoFromDI(const Module &M, std::string &Directory, if (!CUNode || CUNode->getNumOperands() == 0) return false; - DICompileUnit CU(cast<MDNode>(CUNode->getOperand(0))); + DICompileUnit CU(CUNode->getOperand(0)); if (!CU.Verify()) return false; diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 0c666ffea6a..220d7f8b490 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -417,7 +417,7 @@ namespace { std::string GCOVProfiler::mangleName(DICompileUnit CU, const char *NewStem) { if (NamedMDNode *GCov = M->getNamedMetadata("llvm.gcov")) { for (int i = 0, e = GCov->getNumOperands(); i != e; ++i) { - MDNode *N = GCov->getOperandAsMDNode(i); + MDNode *N = GCov->getOperand(i); if (N->getNumOperands() != 2) continue; MDString *GCovFile = dyn_cast<MDString>(N->getOperand(0)); MDNode *CompileUnit = dyn_cast<MDNode>(N->getOperand(1)); @@ -479,7 +479,7 @@ void GCOVProfiler::emitProfileNotes() { // this pass over the original .o's as they're produced, or run it after // LTO, we'll generate the same .gcno files. - DICompileUnit CU(CU_Nodes->getOperandAsMDNode(i)); + DICompileUnit CU(CU_Nodes->getOperand(i)); std::error_code EC; raw_fd_ostream out(mangleName(CU, "gcno"), EC, sys::fs::F_None); std::string EdgeDestinations; @@ -566,7 +566,7 @@ bool GCOVProfiler::emitProfileArcs() { bool Result = false; bool InsertIndCounterIncrCode = false; for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { - DICompileUnit CU(CU_Nodes->getOperandAsMDNode(i)); + DICompileUnit CU(CU_Nodes->getOperand(i)); DIArray SPs = CU.getSubprograms(); SmallVector<std::pair<GlobalVariable *, MDNode *>, 8> CountersBySP; for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) { @@ -847,7 +847,7 @@ Function *GCOVProfiler::insertCounterWriteout( NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu"); if (CU_Nodes) { for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { - DICompileUnit CU(CU_Nodes->getOperandAsMDNode(i)); + DICompileUnit CU(CU_Nodes->getOperand(i)); std::string FilenameGcda = mangleName(CU, "gcda"); uint32_t CfgChecksum = FileChecksums.empty() ? 0 : FileChecksums[i]; Builder.CreateCall3(StartFile, diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index 4536510c8e5..417f2a1649b 100644 --- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -231,7 +231,7 @@ bool ThreadSanitizer::doInitialization(Module &M) { } static bool isVtableAccess(Instruction *I) { - if (MDNode *Tag = I->getMDNode(LLVMContext::MD_tbaa)) + if (MDNode *Tag = I->getMetadata(LLVMContext::MD_tbaa)) return Tag->isTBAAVtableAccess(); return false; } diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp index 04a0d917224..eb325eb9417 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp @@ -305,7 +305,7 @@ bool ObjCARCContract::doInitialization(Module &M) { if (NamedMDNode *NMD = M.getNamedMetadata("clang.arc.retainAutoreleasedReturnValueMarker")) if (NMD->getNumOperands() == 1) { - const MDNode *N = NMD->getOperandAsMDNode(0); + const MDNode *N = NMD->getOperand(0); if (N->getNumOperands() == 1) if (const MDString *S = dyn_cast<MDString>(N->getOperand(0))) RetainRVMarker = S; diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp index 4846282e90e..3da2a543083 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -825,7 +825,7 @@ static MDString *AppendMDNodeToSourcePtr(unsigned NodeId, // reference to said Node. Otherwise just return 0. if (Instruction *Inst = dyn_cast<Instruction>(Ptr)) { MDNode *Node; - if (!(Node = Inst->getMDNode(NodeId))) { + if (!(Node = Inst->getMetadata(NodeId))) { // We do not have any node. Generate and attatch the hash MDString to the // instruction. @@ -1736,7 +1736,7 @@ ObjCARCOpt::VisitInstructionBottomUp(Instruction *Inst, NestingDetected = true; } - MDNode *ReleaseMetadata = Inst->getMDNode(ImpreciseReleaseMDKind); + MDNode *ReleaseMetadata = Inst->getMetadata(ImpreciseReleaseMDKind); Sequence NewSeq = ReleaseMetadata ? S_MovableRelease : S_Release; ANNOTATE_BOTTOMUP(Inst, Arg, S.GetSeq(), NewSeq); S.ResetSequenceProgress(NewSeq); @@ -2017,7 +2017,7 @@ ObjCARCOpt::VisitInstructionTopDown(Instruction *Inst, Sequence OldSeq = S.GetSeq(); - MDNode *ReleaseMetadata = Inst->getMDNode(ImpreciseReleaseMDKind); + MDNode *ReleaseMetadata = Inst->getMetadata(ImpreciseReleaseMDKind); switch (OldSeq) { case S_Retain: diff --git a/llvm/lib/Transforms/Scalar/Scalarizer.cpp b/llvm/lib/Transforms/Scalar/Scalarizer.cpp index 0ad7cea6392..6036c099be0 100644 --- a/llvm/lib/Transforms/Scalar/Scalarizer.cpp +++ b/llvm/lib/Transforms/Scalar/Scalarizer.cpp @@ -327,11 +327,14 @@ 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, Value *>, 4> MDs; + SmallVector<std::pair<unsigned, MDNode *>, 4> MDs; Op->getAllMetadataOtherThanDebugLoc(MDs); for (unsigned I = 0, E = CV.size(); I != E; ++I) { if (Instruction *New = dyn_cast<Instruction>(CV[I])) { - for (auto MI = MDs.begin(), ME = MDs.end(); MI != ME; ++MI) + for (SmallVectorImpl<std::pair<unsigned, MDNode *>>::iterator + 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/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index a1e42bbe70c..2d0b7dcc71c 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -297,9 +297,9 @@ static void CloneAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap) { for (Function::const_iterator I = CalledFunc->begin(), IE = CalledFunc->end(); I != IE; ++I) for (BasicBlock::const_iterator J = I->begin(), JE = I->end(); J != JE; ++J) { - if (const MDNode *M = J->getMDNode(LLVMContext::MD_alias_scope)) + if (const MDNode *M = J->getMetadata(LLVMContext::MD_alias_scope)) MD.insert(M); - if (const MDNode *M = J->getMDNode(LLVMContext::MD_noalias)) + if (const MDNode *M = J->getMetadata(LLVMContext::MD_noalias)) MD.insert(M); } @@ -359,31 +359,32 @@ static void CloneAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap) { if (!NI) continue; - if (MDNode *M = NI->getMDNode(LLVMContext::MD_alias_scope)) { + if (MDNode *M = NI->getMetadata(LLVMContext::MD_alias_scope)) { MDNode *NewMD = MDMap[M]; // If the call site also had alias scope metadata (a list of scopes to // which instructions inside it might belong), propagate those scopes to // the inlined instructions. if (MDNode *CSM = - CS.getInstruction()->getMDNode(LLVMContext::MD_alias_scope)) + CS.getInstruction()->getMetadata(LLVMContext::MD_alias_scope)) NewMD = MDNode::concatenate(NewMD, CSM); NI->setMetadata(LLVMContext::MD_alias_scope, NewMD); } else if (NI->mayReadOrWriteMemory()) { if (MDNode *M = - CS.getInstruction()->getMDNode(LLVMContext::MD_alias_scope)) + CS.getInstruction()->getMetadata(LLVMContext::MD_alias_scope)) NI->setMetadata(LLVMContext::MD_alias_scope, M); } - if (MDNode *M = NI->getMDNode(LLVMContext::MD_noalias)) { + if (MDNode *M = NI->getMetadata(LLVMContext::MD_noalias)) { MDNode *NewMD = MDMap[M]; // If the call site also had noalias metadata (a list of scopes with // which instructions inside it don't alias), propagate those scopes to // the inlined instructions. - if (MDNode *CSM = CS.getInstruction()->getMDNode(LLVMContext::MD_noalias)) + if (MDNode *CSM = + CS.getInstruction()->getMetadata(LLVMContext::MD_noalias)) NewMD = MDNode::concatenate(NewMD, CSM); NI->setMetadata(LLVMContext::MD_noalias, NewMD); } else if (NI->mayReadOrWriteMemory()) { - if (MDNode *M = CS.getInstruction()->getMDNode(LLVMContext::MD_noalias)) + if (MDNode *M = CS.getInstruction()->getMetadata(LLVMContext::MD_noalias)) NI->setMetadata(LLVMContext::MD_noalias, M); } } @@ -589,7 +590,7 @@ static void AddAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap, if (!NoAliases.empty()) NI->setMetadata(LLVMContext::MD_noalias, MDNode::concatenate( - NI->getMDNode(LLVMContext::MD_noalias), + NI->getMetadata(LLVMContext::MD_noalias), MDNode::get(CalledFunc->getContext(), NoAliases))); // Next, we want to figure out all of the sets to which we might belong. @@ -615,7 +616,7 @@ static void AddAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap, if (!Scopes.empty()) NI->setMetadata( LLVMContext::MD_alias_scope, - MDNode::concatenate(NI->getMDNode(LLVMContext::MD_alias_scope), + MDNode::concatenate(NI->getMetadata(LLVMContext::MD_alias_scope), MDNode::get(CalledFunc->getContext(), Scopes))); } } diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index c6229b1028c..a2ba2b8cc06 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -128,7 +128,7 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions, // Check to see if this branch is going to the same place as the default // dest. If so, eliminate it as an explicit compare. if (i.getCaseSuccessor() == DefaultDest) { - MDNode *MD = SI->getMDNode(LLVMContext::MD_prof); + MDNode *MD = SI->getMetadata(LLVMContext::MD_prof); unsigned NCases = SI->getNumCases(); // Fold the case metadata into the default if there will be any branches // left, unless the metadata doesn't match the switch. @@ -206,7 +206,7 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions, BranchInst *NewBr = Builder.CreateCondBr(Cond, FirstCase.getCaseSuccessor(), SI->getDefaultDest()); - MDNode *MD = SI->getMDNode(LLVMContext::MD_prof); + MDNode *MD = SI->getMetadata(LLVMContext::MD_prof); if (MD && MD->getNumOperands() == 3) { ConstantInt *SICase = dyn_cast<ConstantInt>(MD->getOperand(2)); ConstantInt *SIDef = dyn_cast<ConstantInt>(MD->getOperand(1)); @@ -1308,13 +1308,13 @@ bool llvm::removeUnreachableBlocks(Function &F) { } void llvm::combineMetadata(Instruction *K, const Instruction *J, ArrayRef<unsigned> KnownIDs) { - SmallVector<std::pair<unsigned, Value *>, 4> Metadata; + SmallVector<std::pair<unsigned, MDNode *>, 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 = cast<MDNode>(Metadata[i].second); + MDNode *JMD = J->getMetadata(Kind); + MDNode *KMD = Metadata[i].second; switch (Kind) { default: diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index bf7d5df3a58..6037b1ffc24 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -643,7 +643,7 @@ SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI, // Collect branch weights into a vector. SmallVector<uint32_t, 8> Weights; - MDNode *MD = SI->getMDNode(LLVMContext::MD_prof); + MDNode *MD = SI->getMetadata(LLVMContext::MD_prof); bool HasWeight = MD && (MD->getNumOperands() == 2 + SI->getNumCases()); if (HasWeight) for (unsigned MD_i = 1, MD_e = MD->getNumOperands(); MD_i < MD_e; @@ -738,7 +738,7 @@ static int ConstantIntSortPredicate(ConstantInt *const *P1, } static inline bool HasBranchWeights(const Instruction* I) { - MDNode *ProfMD = I->getMDNode(LLVMContext::MD_prof); + MDNode *ProfMD = I->getMetadata(LLVMContext::MD_prof); if (ProfMD && ProfMD->getOperand(0)) if (MDString* MDS = dyn_cast<MDString>(ProfMD->getOperand(0))) return MDS->getString().equals("branch_weights"); @@ -751,7 +751,7 @@ static inline bool HasBranchWeights(const Instruction* I) { /// metadata. static void GetBranchWeights(TerminatorInst *TI, SmallVectorImpl<uint64_t> &Weights) { - MDNode *MD = TI->getMDNode(LLVMContext::MD_prof); + MDNode *MD = TI->getMetadata(LLVMContext::MD_prof); assert(MD); for (unsigned i = 1, e = MD->getNumOperands(); i < e; ++i) { ConstantInt *CI = cast<ConstantInt>(MD->getOperand(i)); @@ -1970,7 +1970,7 @@ static bool ExtractBranchMetadata(BranchInst *BI, uint64_t &ProbTrue, uint64_t &ProbFalse) { assert(BI->isConditional() && "Looking for probabilities on unconditional branch?"); - MDNode *ProfileData = BI->getMDNode(LLVMContext::MD_prof); + MDNode *ProfileData = BI->getMetadata(LLVMContext::MD_prof); if (!ProfileData || ProfileData->getNumOperands() != 3) return false; ConstantInt *CITrue = dyn_cast<ConstantInt>(ProfileData->getOperand(1)); ConstantInt *CIFalse = dyn_cast<ConstantInt>(ProfileData->getOperand(2)); diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 31755427d77..a2f69d1f10b 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -208,11 +208,14 @@ void llvm::RemapInstruction(Instruction *I, ValueToValueMapTy &VMap, } // Remap attached metadata. - SmallVector<std::pair<unsigned, Value *>, 4> MDs; + SmallVector<std::pair<unsigned, MDNode *>, 4> MDs; I->getAllMetadata(MDs); - for (auto MI = MDs.begin(), ME = MDs.end(); MI != ME; ++MI) { - Value *Old = MI->second; - Value *New = MapValue(Old, VMap, Flags, TypeMapper, Materializer); + for (SmallVectorImpl<std::pair<unsigned, MDNode *>>::iterator + MI = MDs.begin(), + ME = MDs.end(); + MI != ME; ++MI) { + MDNode *Old = MI->second; + MDNode *New = MapValue(Old, VMap, Flags, TypeMapper, Materializer); if (New != Old) I->setMetadata(MI->first, New); } diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 0a472dc7d89..20e7ce63abf 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, Value *>, 4> Metadata; + SmallVector<std::pair<unsigned, MDNode *>, 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 5771582896d..16ba3167e8b 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -188,16 +188,16 @@ 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, Value *>, 4> Metadata; + SmallVector<std::pair<unsigned, MDNode *>, 4> Metadata; I0->getAllMetadataOtherThanDebugLoc(Metadata); for (unsigned i = 0, n = Metadata.size(); i != n; ++i) { unsigned Kind = Metadata[i].first; - MDNode *MD = cast_or_null<MDNode>(Metadata[i].second); + MDNode *MD = Metadata[i].second; for (int i = 1, e = VL.size(); MD && i != e; i++) { Instruction *I = cast<Instruction>(VL[i]); - MDNode *IMD = I->getMDNode(Kind); + MDNode *IMD = I->getMetadata(Kind); switch (Kind) { default: |