forked from OSchip/llvm-project
Use early return to simplify code (NFC)
Follow on to r258405. llvm-svn: 258407
This commit is contained in:
parent
61035fa3cb
commit
f5aa64f25f
|
@ -660,7 +660,8 @@ Metadata *IRLinker::mapTemporaryMetadata(Metadata *MD) {
|
|||
// If this temporary metadata has a value id recorded during function
|
||||
// parsing, record that in the ValIDToTempMDMap if one was provided.
|
||||
auto I = MetadataToIDs.find(MD);
|
||||
if (I != MetadataToIDs.end()) {
|
||||
if (I == MetadataToIDs.end())
|
||||
return nullptr;
|
||||
unsigned Idx = I->second;
|
||||
MDNode *Node = cast<MDNode>(MD);
|
||||
assert(Node->isTemporary());
|
||||
|
@ -668,8 +669,6 @@ Metadata *IRLinker::mapTemporaryMetadata(Metadata *MD) {
|
|||
// this module, reuse the same temporary metadata.
|
||||
auto IterBool = ValIDToTempMDMap->insert(std::make_pair(Idx, Node));
|
||||
return IterBool.first->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void IRLinker::replaceTemporaryMetadata(const Metadata *OrigMD,
|
||||
|
@ -685,7 +684,8 @@ void IRLinker::replaceTemporaryMetadata(const Metadata *OrigMD,
|
|||
// metadata has a value id recorded during metadata parsing, replace
|
||||
// the temporary metadata with the final mapped metadata now.
|
||||
auto I = MetadataToIDs.find(OrigMD);
|
||||
if (I != MetadataToIDs.end()) {
|
||||
if (I == MetadataToIDs.end())
|
||||
return;
|
||||
unsigned Idx = I->second;
|
||||
auto VI = ValIDToTempMDMap->find(Idx);
|
||||
// Nothing to do if we didn't need to create a temporary metadata during
|
||||
|
@ -696,7 +696,6 @@ void IRLinker::replaceTemporaryMetadata(const Metadata *OrigMD,
|
|||
TempMD->replaceAllUsesWith(NewMD);
|
||||
MDNode::deleteTemporary(TempMD);
|
||||
ValIDToTempMDMap->erase(VI);
|
||||
}
|
||||
}
|
||||
|
||||
bool IRLinker::isMetadataNeeded(Metadata *MD) {
|
||||
|
|
Loading…
Reference in New Issue