[lld] r347272 - [WebAssembly] Make starting indices calcaulation simpler (NFC)
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 19 15:21:25 PST 2018
Author: aheejin
Date: Mon Nov 19 15:21:25 2018
New Revision: 347272
URL: http://llvm.org/viewvc/llvm-project?rev=347272&view=rev
Log:
[WebAssembly] Make starting indices calcaulation simpler (NFC)
Summary:
At the beginning of `assignIndexes() function, when `FunctionIndex` and
`GlobalIndex` variables are created, `InputFunctions` and `InputGlobals`
vectors are guaranteed to be empty, because those vectors are only
populated in `assignIndexes()` function. Current code looks like they
are nonempty, so this patch deletes them for better readability.
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D54687
Modified:
lld/trunk/wasm/Writer.cpp
Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=347272&r1=347271&r2=347272&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Mon Nov 19 15:21:25 2018
@@ -891,7 +891,8 @@ void Writer::calculateTypes() {
}
void Writer::assignIndexes() {
- uint32_t FunctionIndex = NumImportedFunctions + InputFunctions.size();
+ assert(InputFunctions.empty());
+ uint32_t FunctionIndex = NumImportedFunctions;
auto AddDefinedFunction = [&](InputFunction *Func) {
if (!Func->Live)
return;
@@ -940,7 +941,8 @@ void Writer::assignIndexes() {
HandleRelocs(P);
}
- uint32_t GlobalIndex = NumImportedGlobals + InputGlobals.size();
+ assert(InputGlobals.empty());
+ uint32_t GlobalIndex = NumImportedGlobals;
auto AddDefinedGlobal = [&](InputGlobal *Global) {
if (Global->Live) {
LLVM_DEBUG(dbgs() << "AddDefinedGlobal: " << GlobalIndex << "\n");
More information about the llvm-commits
mailing list