diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index b239aeb7674..00df27f7c69 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -181,6 +181,13 @@ void SlotCalculator::processModule() { } } + + // Compute the ModuleLevel entries. + ModuleLevel.resize(getNumPlanes()); + for (unsigned i = 0, e = getNumPlanes(); i != e; ++i) + ModuleLevel[i] = getPlane(i).size(); + ModuleTypeLevel = Types.size(); + SC_DEBUG("end processModule!\n"); } @@ -278,17 +285,8 @@ unsigned SlotCalculator::getOrCreateTypeSlot(const Type *Ty) { void SlotCalculator::incorporateFunction(const Function *F) { - assert((ModuleLevel.empty() || - ModuleTypeLevel == 0) && "Module already incorporated!"); - SC_DEBUG("begin processFunction!\n"); - // Update the ModuleLevel entries to be accurate. - ModuleLevel.resize(getNumPlanes()); - for (unsigned i = 0, e = getNumPlanes(); i != e; ++i) - ModuleLevel[i] = getPlane(i).size(); - ModuleTypeLevel = Types.size(); - // Iterate over function arguments, adding them to the value table... for(Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) @@ -309,8 +307,6 @@ void SlotCalculator::incorporateFunction(const Function *F) { } void SlotCalculator::purgeFunction() { - assert((ModuleLevel.size() != 0 || - ModuleTypeLevel != 0) && "Module not incorporated!"); unsigned NumModuleTypes = ModuleLevel.size(); SC_DEBUG("begin purgeFunction!\n"); @@ -332,10 +328,6 @@ void SlotCalculator::purgeFunction() { } } - // We don't need this state anymore, free it up. - ModuleLevel.clear(); - ModuleTypeLevel = 0; - // Finally, remove any type planes defined by the function... while (Table.size() > NumModuleTypes) { TypePlane &Plane = Table.back();