diff options
| author | Lang Hames <lhames@gmail.com> | 2019-05-09 22:03:58 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2019-05-09 22:03:58 +0000 |
| commit | 5e332f19928f6547d4f3a70df80884ef00145873 (patch) | |
| tree | 5113b066eb424cf481d95093ad248e0092add4c7 | |
| parent | dd61274f775a50875d389b68c44151b5742e0ae7 (diff) | |
| download | bcm5719-llvm-5e332f19928f6547d4f3a70df80884ef00145873.tar.gz bcm5719-llvm-5e332f19928f6547d4f3a70df80884ef00145873.zip | |
[ORC] Simplify logic for updating edges when should-discard atoms are pruned.
llvm-svn: 360384
| -rw-r--r-- | llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp index 8e4cfa05363..b3477f1ee4c 100644 --- a/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp @@ -433,28 +433,16 @@ void prune(AtomGraph &G) { // // We replace if all of the following hold: // (1) The atom is marked should-discard, - // (2) it is live, and - // (3) it has edges pointing to it. + // (2) it has live edges (i.e. edges from live atoms) pointing to it. // // Otherwise we simply delete the atom. - bool ReplaceWithExternal = DA->isLive() && DA->shouldDiscard(); - std::vector<Edge *> *EdgesToUpdateForDA = nullptr; - if (ReplaceWithExternal) { - auto ETUItr = EdgesToUpdate.find(DA); - if (ETUItr == EdgesToUpdate.end()) - ReplaceWithExternal = false; - else - EdgesToUpdateForDA = &ETUItr->second; - } G.removeDefinedAtom(*DA); - if (ReplaceWithExternal) { - assert(EdgesToUpdateForDA && - "Replacing atom: There should be edges to update"); - + auto EdgesToUpdateItr = EdgesToUpdate.find(DA); + if (EdgesToUpdateItr != EdgesToUpdate.end()) { auto &ExternalReplacement = G.addExternalAtom(DA->getName()); - for (auto *EdgeToUpdate : *EdgesToUpdateForDA) + for (auto *EdgeToUpdate : EdgesToUpdateItr->second) EdgeToUpdate->setTarget(ExternalReplacement); LLVM_DEBUG(dbgs() << "replaced with " << ExternalReplacement << "\n"); } else |

