void BasicBlock::removeNops(Procedure& procedure) { unsigned sourceIndex = 0; unsigned targetIndex = 0; while (sourceIndex < size()) { Value* value = m_values[sourceIndex++]; if (value->opcode() == Nop) procedure.deleteValue(value); else m_values[targetIndex++] = value; } m_values.resize(targetIndex); }
void BasicBlock::removeLast(Procedure& proc) { ASSERT(!m_values.isEmpty()); proc.deleteValue(m_values.takeLast()); }