From 87deb5677f9cdd6ab9fef3cc4f1cb966fee8700d Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Sun, 24 Dec 2023 12:16:28 +0000 Subject: [PATCH] improve alias analysis to reject blocks that are smaller than access size --- ir/memory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ir/memory.cpp b/ir/memory.cpp index 6e7ba323d..8b069570a 100644 --- a/ir/memory.cpp +++ b/ir/memory.cpp @@ -838,7 +838,9 @@ bool Memory::mayalias(bool local, unsigned bid0, const expr &offset0, if (auto sz = (local ? local_blk_size : non_local_blk_size).lookup(bid)) { expr offset = offset0.sextOrTrunc(bits_size_t); - if (offset.uge(*sz).isTrue() || (*sz - offset).ult(bytes).isTrue()) + if (offset.uge(*sz).isTrue() || + sz->ult(bytes).isTrue() || + (*sz - offset).ult(bytes).isTrue()) return false; } else if (local) // allocated in another branch return false;