[PATCH] D118038: [clang][dataflow] Enable merging distinct values in Environment::join

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 24 06:31:33 PST 2022


xazax.hun added a comment.

Interesting. So clients can affect how the environment is being merged. As a result, we potentially cannot run multiple clients in the same fixed-point iteration, each of them will require separate passes.

I think this is OK, just wanted to to be explicit.



================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:67
+    ///  `Val1` and `Val2` must be distinct.
+    virtual void merge(QualType Type, const Value &Val1, const Value &Val2,
+                       Value &MergedVal, Environment &Env) {}
----------------
Previously, when the values were distinct, we did not include anything in the merged environment. With the new model, we will end up creating "default" values for every one of them. I wonder if this is wasteful. We could potentially also defer this until we have some real world data and can benchmark this. But I think we could consider changing the return type to bool to specify if the merged value should be included in the resulting environment at all and this could return false by default.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118038/new/

https://reviews.llvm.org/D118038



More information about the cfe-commits mailing list