Skip to content

Commit f214211

Browse files
authored
Merge pull request #3606 from tautschnig/irep-related-fixes
irept-related fixes [blocks: #2035]
2 parents deb2bf3 + d4649bc commit f214211

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/util/format_expr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Author: Daniel Kroening, [email protected]
2727
#include "string2int.h"
2828
#include "string_utils.h"
2929

30+
#include <map>
3031
#include <ostream>
3132
#include <stack>
3233

src/util/irep_hash_container.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ void irep_hash_container_baset::pack(
5252

5353
if(full)
5454
{
55-
packed.reserve(1 + 1 + sub.size() + named_sub.size());
55+
// we pack: the irep id, the sub size, the subs, the named-sub size, and
56+
// each of the named subs with their ids
57+
packed.reserve(1 + 1 + sub.size() + 1 + named_sub.size() * 2);
5658

5759
packed.push_back(irep_id_hash()(irep.id()));
5860

@@ -72,7 +74,9 @@ void irep_hash_container_baset::pack(
7274
const std::size_t non_comment_count =
7375
irept::number_of_non_comments(named_sub);
7476

75-
packed.reserve(1 + 1 + sub.size() + non_comment_count);
77+
// we pack: the irep id, the sub size, the subs, the named-sub size, and
78+
// each of the non-comment named subs with their ids
79+
packed.reserve(1 + 1 + sub.size() + 1 + non_comment_count * 2);
7680

7781
packed.push_back(irep_id_hash()(irep.id()));
7882

src/util/merge_irep.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ bool to_be_merged_irept::operator == (const to_be_merged_irept &other) const
4444
const irept::named_subt &o_named_sub=other.get_named_sub();
4545

4646
if(sub.size()!=o_sub.size())
47-
return true;
47+
return false;
4848
if(named_sub.size()!=o_named_sub.size())
49-
return true;
49+
return false;
5050

5151
{
5252
irept::subt::const_iterator s_it=sub.begin();
@@ -148,7 +148,7 @@ const irept &merge_irept::merged(const irept &irep)
148148
dest_named_sub[it->first]=merged(it->second); // recursive call
149149
#endif
150150

151-
return *irep_store.insert(new_irep).first;
151+
return *irep_store.insert(std::move(new_irep)).first;
152152
}
153153

154154
void merge_full_irept::operator()(irept &irep)
@@ -185,5 +185,5 @@ const irept &merge_full_irept::merged(const irept &irep)
185185
dest_named_sub[it->first]=merged(it->second); // recursive call
186186
#endif
187187

188-
return *irep_store.insert(new_irep).first;
188+
return *irep_store.insert(std::move(new_irep)).first;
189189
}

0 commit comments

Comments
 (0)