This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Merge distinct pointer values in Environment::join
ClosedPublic

Authored by sgatev on Jan 28 2022, 8:25 AM.

Details

Summary

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Diff Detail

Event Timeline

sgatev created this revision.Jan 28 2022, 8:25 AM
sgatev requested review of this revision.Jan 28 2022, 8:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2022, 8:25 AM
ymandel accepted this revision.Jan 28 2022, 10:55 AM
This revision is now accepted and ready to land.Jan 28 2022, 10:55 AM
xazax.hun added inline comments.Jan 29 2022, 2:23 AM
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
114

Shouldn't we ensure that operator== return true when we have two PointerValues with the same pointee above? That would make this piece of code redundant.

xazax.hun added inline comments.Jan 29 2022, 2:29 AM
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
114

Never mind, just realized the above is comparing pointers. But I still think we might want to have a separate operator== for Values as we might want to compare values in many separate places.

xazax.hun added inline comments.Jan 29 2022, 2:51 AM
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
114

Or alternatively, Values could be internalized, and all PointerValues with the same pointee could have the same address.

sgatev marked 2 inline comments as done.Jan 29 2022, 3:00 AM
sgatev added inline comments.
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
114

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.

xazax.hun added inline comments.Jan 29 2022, 3:06 AM
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
114

Oh, I see. In this case let's merge this and looking forward to the next one :)

xazax.hun accepted this revision.Jan 29 2022, 3:06 AM
sgatev marked 2 inline comments as done.Jan 29 2022, 8:16 AM
This revision was landed with ongoing or failed builds.Jan 29 2022, 8:34 AM
This revision was automatically updated to reflect the committed changes.