diff options
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/IR/DiagnosticInfo.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/IR/Metadata.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 6 |
5 files changed, 11 insertions, 12 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index b4f327bab5c..0c0c51bd46c 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -579,7 +579,7 @@ void llvm::UpgradeCallsToIntrinsic(Function* F) { } void llvm::UpgradeInstWithTBAATag(Instruction *I) { - MDNode *MD = I->getMetadata(LLVMContext::MD_tbaa); + MDNode *MD = I->getMDNode(LLVMContext::MD_tbaa); assert(MD && "UpgradeInstWithTBAATag should have a TBAA tag"); // Check if the tag uses struct-path aware TBAA format. if (isa<MDNode>(MD->getOperand(0)) && MD->getNumOperands() >= 3) diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp index 37cce2b0d78..c0552c90ae6 100644 --- a/llvm/lib/IR/DiagnosticInfo.cpp +++ b/llvm/lib/IR/DiagnosticInfo.cpp @@ -96,7 +96,7 @@ DiagnosticInfoInlineAsm::DiagnosticInfoInlineAsm(const Instruction &I, DiagnosticSeverity Severity) : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(0), MsgStr(MsgStr), Instr(&I) { - if (const MDNode *SrcLoc = I.getMetadata("srcloc")) { + if (const MDNode *SrcLoc = I.getMDNode("srcloc")) { if (SrcLoc->getNumOperands() != 0) if (const ConstantInt *CI = dyn_cast<ConstantInt>(SrcLoc->getOperand(0))) LocCookie = CI->getZExtValue(); diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 1497aa885c5..6aaea75896e 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -791,7 +791,7 @@ void BranchInst::swapSuccessors() { // Update profile metadata if present and it matches our structural // expectations. - MDNode *ProfileData = getMetadata(LLVMContext::MD_prof); + MDNode *ProfileData = getMDNode(LLVMContext::MD_prof); if (!ProfileData || ProfileData->getNumOperands() != 3) return; @@ -2072,8 +2072,7 @@ void BinaryOperator::andIRFlags(const Value *V) { /// An accuracy of 0.0 means that the operation should be performed with the /// default precision. float FPMathOperator::getFPAccuracy() const { - const MDNode *MD = - cast<Instruction>(this)->getMetadata(LLVMContext::MD_fpmath); + const MDNode *MD = cast<Instruction>(this)->getMDNode(LLVMContext::MD_fpmath); if (!MD) return 0.0; ConstantFP *Accuracy = cast<ConstantFP>(MD->getOperand(0)); diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 60cd2fc9061..6c335c78729 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -605,16 +605,16 @@ void Instruction::setMetadata(StringRef Kind, Value *MD) { setMetadata(getContext().getMDKindID(Kind), MD); } -MDNode *Instruction::getMetadataImpl(StringRef Kind) const { +Value *Instruction::getMetadataImpl(StringRef Kind) const { return getMetadataImpl(getContext().getMDKindID(Kind)); } MDNode *Instruction::getMDNodeImpl(unsigned KindID) const { - return getMetadataImpl(KindID); + return cast_or_null<MDNode>(getMetadataImpl(KindID)); } MDNode *Instruction::getMDNodeImpl(StringRef Kind) const { - return getMetadataImpl(Kind); + return cast_or_null<MDNode>(getMetadataImpl(Kind)); } void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) { @@ -729,7 +729,7 @@ void Instruction::setAAMetadata(const AAMDNodes &N) { setMetadata(LLVMContext::MD_noalias, N.NoAlias); } -MDNode *Instruction::getMetadataImpl(unsigned KindID) const { +Value *Instruction::getMetadataImpl(unsigned KindID) const { // Handle 'dbg' as a special case since it is not stored in the hash table. if (KindID == LLVMContext::MD_dbg) return DbgLoc.getAsMDNode(getContext()); diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index b7c2ee24111..e2fb62fdeef 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2267,7 +2267,7 @@ void Verifier::visitInstruction(Instruction &I) { } } - if (MDNode *MD = I.getMetadata(LLVMContext::MD_fpmath)) { + if (MDNode *MD = I.getMDNode(LLVMContext::MD_fpmath)) { Assert1(I.getType()->isFPOrFPVectorTy(), "fpmath requires a floating point result!", &I); Assert1(MD->getNumOperands() == 1, "fpmath takes one operand!", &I); @@ -2281,7 +2281,7 @@ void Verifier::visitInstruction(Instruction &I) { } } - if (MDNode *Range = I.getMetadata(LLVMContext::MD_range)) { + if (MDNode *Range = I.getMDNode(LLVMContext::MD_range)) { Assert1(isa<LoadInst>(I) || isa<CallInst>(I) || isa<InvokeInst>(I), "Ranges are only for loads, calls and invokes!", &I); visitRangeMetadata(I, Range, I.getType()); @@ -2587,7 +2587,7 @@ void DebugInfoVerifier::verifyDebugInfo() { void DebugInfoVerifier::processInstructions(DebugInfoFinder &Finder) { for (const Function &F : *M) for (auto I = inst_begin(&F), E = inst_end(&F); I != E; ++I) { - if (MDNode *MD = I->getMetadata(LLVMContext::MD_dbg)) + if (MDNode *MD = I->getMDNode(LLVMContext::MD_dbg)) Finder.processLocation(*M, DILocation(MD)); if (const CallInst *CI = dyn_cast<CallInst>(&*I)) processCallInst(Finder, *CI); |