diff --git a/opt/object-sensitive-dce/SideEffectSummary.cpp b/opt/object-sensitive-dce/SideEffectSummary.cpp index 3ce4543030..39ec8d0701 100644 --- a/opt/object-sensitive-dce/SideEffectSummary.cpp +++ b/opt/object-sensitive-dce/SideEffectSummary.cpp @@ -345,6 +345,7 @@ s_expr to_s_expr(const Summary& summary) { std::vector s_exprs; s_exprs.emplace_back(std::to_string(summary.effects)); std::vector mod_param_s_exprs; + mod_param_s_exprs.reserve(summary.modified_params.size()); for (auto idx : summary.modified_params) { mod_param_s_exprs.emplace_back(idx); } diff --git a/opt/outliner/InstructionSequenceOutliner.cpp b/opt/outliner/InstructionSequenceOutliner.cpp index 1da8f7e840..ed09d441dc 100644 --- a/opt/outliner/InstructionSequenceOutliner.cpp +++ b/opt/outliner/InstructionSequenceOutliner.cpp @@ -1738,6 +1738,7 @@ class OutlinedMethodCreator { auto manager = g_redex->get_position_pattern_switch_manager(); // Order methods to make sure we get deterministic pattern-ids. std::vector ordered_methods; + ordered_methods.reserve(ci.methods.size()); for (auto& p : ci.methods) { ordered_methods.push_back(p.first); } diff --git a/opt/virtual_merging/VirtualMerging.cpp b/opt/virtual_merging/VirtualMerging.cpp index 8d13972cb1..2c607f323d 100644 --- a/opt/virtual_merging/VirtualMerging.cpp +++ b/opt/virtual_merging/VirtualMerging.cpp @@ -1375,6 +1375,8 @@ void VirtualMerging::merge_methods( // Part 5: Remove methods within classes. void VirtualMerging::remove_methods() { std::vector classes_with_virtual_methods_to_remove; + classes_with_virtual_methods_to_remove.reserve( + m_virtual_methods_to_remove.size()); for (auto& p : m_virtual_methods_to_remove) { classes_with_virtual_methods_to_remove.push_back(p.first); }