[llvm] r258407 - Use early return to simplify code (NFC)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 21 09:16:53 PST 2016
Author: tejohnson
Date: Thu Jan 21 11:16:53 2016
New Revision: 258407
URL: http://llvm.org/viewvc/llvm-project?rev=258407&view=rev
Log:
Use early return to simplify code (NFC)
Follow on to r258405.
Modified:
llvm/trunk/lib/Linker/IRMover.cpp
Modified: llvm/trunk/lib/Linker/IRMover.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/IRMover.cpp?rev=258407&r1=258406&r2=258407&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp (original)
+++ llvm/trunk/lib/Linker/IRMover.cpp Thu Jan 21 11:16:53 2016
@@ -660,16 +660,15 @@ Metadata *IRLinker::mapTemporaryMetadata
// 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()) {
- unsigned Idx = I->second;
- MDNode *Node = cast<MDNode>(MD);
- assert(Node->isTemporary());
- // If we created a temp MD when importing a different function from
- // this module, reuse the same temporary metadata.
- auto IterBool = ValIDToTempMDMap->insert(std::make_pair(Idx, Node));
- return IterBool.first->second;
- }
- return nullptr;
+ if (I == MetadataToIDs.end())
+ return nullptr;
+ unsigned Idx = I->second;
+ MDNode *Node = cast<MDNode>(MD);
+ assert(Node->isTemporary());
+ // If we created a temp MD when importing a different function from
+ // this module, reuse the same temporary metadata.
+ auto IterBool = ValIDToTempMDMap->insert(std::make_pair(Idx, Node));
+ return IterBool.first->second;
}
void IRLinker::replaceTemporaryMetadata(const Metadata *OrigMD,
@@ -685,18 +684,18 @@ void IRLinker::replaceTemporaryMetadata(
// 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()) {
- unsigned Idx = I->second;
- auto VI = ValIDToTempMDMap->find(Idx);
- // Nothing to do if we didn't need to create a temporary metadata during
- // function importing.
- if (VI == ValIDToTempMDMap->end())
- return;
- MDNode *TempMD = VI->second;
- TempMD->replaceAllUsesWith(NewMD);
- MDNode::deleteTemporary(TempMD);
- ValIDToTempMDMap->erase(VI);
- }
+ 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
+ // function importing.
+ if (VI == ValIDToTempMDMap->end())
+ return;
+ MDNode *TempMD = VI->second;
+ TempMD->replaceAllUsesWith(NewMD);
+ MDNode::deleteTemporary(TempMD);
+ ValIDToTempMDMap->erase(VI);
}
bool IRLinker::isMetadataNeeded(Metadata *MD) {
More information about the llvm-commits
mailing list