diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-01 00:10:31 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-01 00:10:31 +0000 |
commit | 3872d0084c4f479020ce01b4db5d1bd414c57fb8 (patch) | |
tree | fd1a9e83666fa84a3916b46a94cca32978b34794 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | 7c4fc4e5ae4c8145974397da295587e77c770f62 (diff) | |
download | llvm-3872d0084c4f479020ce01b4db5d1bd414c57fb8.zip llvm-3872d0084c4f479020ce01b4db5d1bd414c57fb8.tar.gz llvm-3872d0084c4f479020ce01b4db5d1bd414c57fb8.tar.bz2 |
IR: MDNode => Value: Instruction::getMetadata()
Change `Instruction::getMetadata()` to return `Value` as part of
PR21433.
Update most callers to use `Instruction::getMDNode()`, which wraps the
result in a `cast_or_null<MDNode>`.
llvm-svn: 221024
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index c158940..112bdcb 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->getMetadata(LLVMContext::MD_alias_scope)) + if (const MDNode *M = J->getMDNode(LLVMContext::MD_alias_scope)) MD.insert(M); - if (const MDNode *M = J->getMetadata(LLVMContext::MD_noalias)) + if (const MDNode *M = J->getMDNode(LLVMContext::MD_noalias)) MD.insert(M); } @@ -359,33 +359,31 @@ static void CloneAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap) { if (!NI) continue; - if (MDNode *M = NI->getMetadata(LLVMContext::MD_alias_scope)) { + if (MDNode *M = NI->getMDNode(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()->getMetadata(LLVMContext::MD_alias_scope)) + CS.getInstruction()->getMDNode(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()->getMetadata(LLVMContext::MD_alias_scope)) + CS.getInstruction()->getMDNode(LLVMContext::MD_alias_scope)) NI->setMetadata(LLVMContext::MD_alias_scope, M); } - if (MDNode *M = NI->getMetadata(LLVMContext::MD_noalias)) { + if (MDNode *M = NI->getMDNode(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()->getMetadata(LLVMContext::MD_noalias)) + if (MDNode *CSM = CS.getInstruction()->getMDNode(LLVMContext::MD_noalias)) NewMD = MDNode::concatenate(NewMD, CSM); NI->setMetadata(LLVMContext::MD_noalias, NewMD); } else if (NI->mayReadOrWriteMemory()) { - if (MDNode *M = - CS.getInstruction()->getMetadata(LLVMContext::MD_noalias)) + if (MDNode *M = CS.getInstruction()->getMDNode(LLVMContext::MD_noalias)) NI->setMetadata(LLVMContext::MD_noalias, M); } } @@ -589,9 +587,10 @@ static void AddAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap, } if (!NoAliases.empty()) - NI->setMetadata(LLVMContext::MD_noalias, MDNode::concatenate( - NI->getMetadata(LLVMContext::MD_noalias), - MDNode::get(CalledFunc->getContext(), NoAliases))); + NI->setMetadata(LLVMContext::MD_noalias, + MDNode::concatenate( + NI->getMDNode(LLVMContext::MD_noalias), + MDNode::get(CalledFunc->getContext(), NoAliases))); // Next, we want to figure out all of the sets to which we might belong. // We might belong to a set if the noalias argument is in the set of @@ -614,9 +613,10 @@ static void AddAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap, } if (!Scopes.empty()) - NI->setMetadata(LLVMContext::MD_alias_scope, MDNode::concatenate( - NI->getMetadata(LLVMContext::MD_alias_scope), - MDNode::get(CalledFunc->getContext(), Scopes))); + NI->setMetadata( + LLVMContext::MD_alias_scope, + MDNode::concatenate(NI->getMDNode(LLVMContext::MD_alias_scope), + MDNode::get(CalledFunc->getContext(), Scopes))); } } } |