[PATCH] D118480: [clang][dataflow] Merge distinct pointer values in Environment::join
Stanislav Gatev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 29 03:00:54 PST 2022
sgatev marked 2 inline comments as done.
sgatev added inline comments.
================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:114
+ if (auto *FirstVal = dyn_cast<PointerValue>(Val)) {
+ auto *SecondVal = cast<PointerValue>(It->second);
----------------
xazax.hun wrote:
> xazax.hun wrote:
> > xazax.hun wrote:
> > > Shouldn't we ensure that `operator==` return true when we have two `PointerValue`s with the same pointee above? That would make this piece of code redundant.
> > Never mind, just realized the above is comparing pointers. But I still think we might want to have a separate `operator==` for `Value`s as we might want to compare values in many separate places.
> Or alternatively, Values could be internalized, and all `PointerValue`s with the same pointee could have the same address.
Right. Currently, all tests that assign values in loops (including the test introduced in this patch) are hitting the maximum iterations limit because we don't have a way to tell the framework how to compare distinct values (e.g. there's no need to continue iterating if the `has_value` properties of distinct optional values are the same). This will be the focus of my next patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118480/new/
https://reviews.llvm.org/D118480
More information about the cfe-commits
mailing list