Skip to content

Commit 200db1d

Browse files
committed
[fix] Clean memory operations
1 parent 1e08227 commit 200db1d

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

include/klee/ADT/SparseStorage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class SparseStorage {
7979
}
8080

8181
bool operator==(const SparseStorage<ValueType> &another) const {
82-
return defaultValue == another.defaultValue && compare(another) == 0;
82+
return eq(defaultValue, another.defaultValue) && compare(another) == 0;
8383
}
8484

8585
bool operator!=(const SparseStorage<ValueType> &another) const {
@@ -131,7 +131,7 @@ class SparseStorage {
131131

132132
void reset(ValueType newDefault) {
133133
defaultValue = newDefault;
134-
internalStorage.clear();
134+
reset();
135135
}
136136

137137
void print(llvm::raw_ostream &os, Density) const;

lib/Core/Memory.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,6 @@ ref<Expr> ObjectState::read8(ref<Expr> offset) const {
183183
}
184184

185185
void ObjectState::write8(unsigned offset, uint8_t value) {
186-
auto byte = knownSymbolics.load(offset);
187-
if (byte) {
188-
auto ce = dyn_cast<ConstantExpr>(byte);
189-
if (ce && ce->getZExtValue(8) == value) {
190-
return;
191-
}
192-
}
193186
knownSymbolics.store(offset, ConstantExpr::create(value, Expr::Int8));
194187
unflushedMask.store(offset, true);
195188
}
@@ -199,10 +192,6 @@ void ObjectState::write8(unsigned offset, ref<Expr> value) {
199192
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(value)) {
200193
write8(offset, (uint8_t)CE->getZExtValue(8));
201194
} else {
202-
auto byte = knownSymbolics.load(offset);
203-
if (byte && byte == value) {
204-
return;
205-
}
206195
knownSymbolics.store(offset, value);
207196
unflushedMask.store(offset, true);
208197
}

lib/Solver/Z3Builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ Z3ASTHandle Z3Builder::getInitialArray(const Array *root) {
284284
}
285285
constant_array_assertions[root] = std::move(array_assertions);
286286
} else {
287-
for (auto [index, value] : source->constantValues.storage()) {
287+
for (auto &[index, value] : source->constantValues.storage()) {
288288
int width_out;
289289
Z3ASTHandle array_value = construct(value, &width_out);
290290
assert(width_out == (int)root->getRange() &&

0 commit comments

Comments
 (0)