From aeaab9925edbd30c84f52f4f38d001526ecaf8ee Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 19 Nov 2018 23:21:25 +0000 Subject: [PATCH] [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 llvm-svn: 347272 --- lld/wasm/Writer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index b5abb6b..a755a0d 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -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"); -- 2.7.4