[llvm] 9a47bca - [ORC][NFC] Refactor loop to determine name of init symbol in IRMaterializationUnit
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 14 02:35:08 PDT 2020
Author: Stefan Gränitz
Date: 2020-08-14T11:34:44+02:00
New Revision: 9a47bcae7c564bb83de659be601509241f31cc11
URL: https://github.com/llvm/llvm-project/commit/9a47bcae7c564bb83de659be601509241f31cc11
DIFF: https://github.com/llvm/llvm-project/commit/9a47bcae7c564bb83de659be601509241f31cc11.diff
LOG: [ORC][NFC] Refactor loop to determine name of init symbol in IRMaterializationUnit
This loop caused me a little headache once, because I didn't see the assigned variable is a member. The refactored version appears more readable to me.
Differential Revision: https://reviews.llvm.org/D85922
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/Layer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/Layer.cpp b/llvm/lib/ExecutionEngine/Orc/Layer.cpp
index 61e7ab5ae68b..0a5d5577e99e 100644
--- a/llvm/lib/ExecutionEngine/Orc/Layer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Layer.cpp
@@ -83,17 +83,14 @@ IRMaterializationUnit::IRMaterializationUnit(
if (!llvm::empty(getStaticInitGVs(M))) {
size_t Counter = 0;
- while (true) {
+ do {
std::string InitSymbolName;
raw_string_ostream(InitSymbolName)
<< "$." << M.getModuleIdentifier() << ".__inits." << Counter++;
InitSymbol = ES.intern(InitSymbolName);
- if (SymbolFlags.count(InitSymbol))
- continue;
- SymbolFlags[InitSymbol] =
- JITSymbolFlags::MaterializationSideEffectsOnly;
- break;
- }
+ } while (SymbolFlags.count(InitSymbol));
+
+ SymbolFlags[InitSymbol] = JITSymbolFlags::MaterializationSideEffectsOnly;
}
});
}
More information about the llvm-commits
mailing list