1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[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
This commit is contained in:
Stefan Gränitz 2020-08-13 21:11:59 +02:00
parent e03618a9ec
commit cc0c266c03

View File

@ -83,17 +83,14 @@ IRMaterializationUnit::IRMaterializationUnit(
if (!llvm::empty(getStaticInitGVs(M))) { if (!llvm::empty(getStaticInitGVs(M))) {
size_t Counter = 0; size_t Counter = 0;
while (true) { do {
std::string InitSymbolName; std::string InitSymbolName;
raw_string_ostream(InitSymbolName) raw_string_ostream(InitSymbolName)
<< "$." << M.getModuleIdentifier() << ".__inits." << Counter++; << "$." << M.getModuleIdentifier() << ".__inits." << Counter++;
InitSymbol = ES.intern(InitSymbolName); InitSymbol = ES.intern(InitSymbolName);
if (SymbolFlags.count(InitSymbol)) } while (SymbolFlags.count(InitSymbol));
continue;
SymbolFlags[InitSymbol] = SymbolFlags[InitSymbol] = JITSymbolFlags::MaterializationSideEffectsOnly;
JITSymbolFlags::MaterializationSideEffectsOnly;
break;
}
} }
}); });
} }