[PATCH] D124395: [clang][dataflow] Optimize flow condition representation

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 14:01:17 PDT 2022

xazax.hun added a comment.

Nice! Did you do some measurements? Does this improve the performance or decrease the memory consumption?

Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:160
+  void addFlowConditionConstraint(AtomicBoolValue &Token,
+                                  BoolValue &Constraint);
Could this be const?

Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:213
+  //
+  // Flow conditions can depend on other flow conditions (constraints can refer
+  // to flow condition tokens). The graph of flow condition dependencies is
I think an example would be nice what "depending on" a flow condition means. A simplistic example with a nested if would probably be the easiest to understand.

Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:184-185
+  FlowConditionToken = &DACtx->makeFlowConditionToken();
+  DACtx->addFlowConditionDependency(*FlowConditionToken,
+                                    *Other.FlowConditionToken);
+  DACtx->addFlowConditionConstraint(*FlowConditionToken,
Do we ever expect to call these functions independently of each other? If no, maybe `addFlowConditionDependency` should add the constraint as well.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list