summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/IRMover.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-01-21 17:16:53 +0000
committerTeresa Johnson <tejohnson@google.com>2016-01-21 17:16:53 +0000
commitf5aa64f25fc250911cccea9840436eab3f14f4c0 (patch)
tree1ecfd8ab634978b3c87762e3c15c7b13b154307c /llvm/lib/Linker/IRMover.cpp
parent61035fa3cb77245e181f6d198561f3454cfc0ca3 (diff)
downloadbcm5719-llvm-f5aa64f25fc250911cccea9840436eab3f14f4c0.tar.gz
bcm5719-llvm-f5aa64f25fc250911cccea9840436eab3f14f4c0.zip
Use early return to simplify code (NFC)
Follow on to r258405. llvm-svn: 258407
Diffstat (limited to 'llvm/lib/Linker/IRMover.cpp')
-rw-r--r--llvm/lib/Linker/IRMover.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index daf3d7c0ca5..e737f7412d1 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -660,16 +660,15 @@ 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()) {
- 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(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()) {
- 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) {
OpenPOWER on IntegriCloud