Skip to content

Commit

Permalink
fix perf regression introduced with last Pointer class refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Aug 13, 2024
1 parent 081d296 commit 8404196
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ir/instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3858,7 +3858,7 @@ StateValue GEP::toSMT(State &s) const {

// try to simplify the pointer
if (all_zeros.isFalse())
ptr.inbounds();
ptr.inbounds(true);
}

return { std::move(ptr).release(), non_poison() };
Expand Down
5 changes: 4 additions & 1 deletion ir/pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ expr Pointer::isInbounds(bool strict) const {
return (strict ? offset.ult(size) : offset.ule(size)) && !offset.isNegative();
}

expr Pointer::inbounds() {
expr Pointer::inbounds(bool simplify_ptr) {
if (!simplify_ptr)
return isInbounds(false);

DisjointExpr<expr> ret(expr(false)), all_ptrs;
for (auto &[ptr_expr, domain] : DisjointExpr<expr>(p, 3)) {
expr inb = Pointer(m, ptr_expr).isInbounds(false);
Expand Down
2 changes: 1 addition & 1 deletion ir/pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Pointer {
smt::expr isInboundsOf(const Pointer &block, const smt::expr &bytes) const;
smt::expr isInboundsOf(const Pointer &block, unsigned bytes) const;
smt::expr isInbounds(bool strict) const;
smt::expr inbounds();
smt::expr inbounds(bool simplify_ptr = false);

smt::expr blockAlignment() const; // log(bits)
smt::expr isBlockAligned(uint64_t align, bool exact = false) const;
Expand Down

0 comments on commit 8404196

Please sign in to comment.