This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Store flow condition constraints in a single `FlowConditionConstraints` map.
ClosedPublic

Authored by wyt on Jun 22 2022, 9:58 AM.

Details

Summary

A flow condition is represented with an atomic boolean token, and it is bound to a set of constraints: (FC <=> C1 ^ C2 ^ ...). \
This was internally represented as (FC v !C1 v !C2 v ...) ^ (C1 v !FC) ^ (C2 v !FC) ^ ... and tracked by 2 maps:

  • FlowConditionFirstConjunct stores the first conjunct (FC v !C1 v !C2 v ...)
  • FlowConditionRemainingConjuncts stores the remaining conjuncts (C1 v !FC) ^ (C2 v !FC) ^ ...

This patch simplifies the tracking of the constraints by using a single FlowConditionConstraints map which stores (C1 ^ C2 ^ ...), eliminating the use of two maps.

Diff Detail

Event Timeline

wyt created this revision.Jun 22 2022, 9:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2022, 9:58 AM
wyt requested review of this revision.Jun 22 2022, 9:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2022, 9:58 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sgatev accepted this revision.Jun 22 2022, 10:13 AM
sgatev added inline comments.
clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
138–150
142–144
This revision is now accepted and ready to land.Jun 22 2022, 10:13 AM
xazax.hun accepted this revision.Jun 22 2022, 2:54 PM

I found a small nit inline, otherwise looks good.

clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
76

Do you actually need a second lookup? Couldn't you use Res.first to update the corresponding value?

wyt updated this revision to Diff 439714.Jun 24 2022, 5:49 AM
wyt marked 3 inline comments as done.

Address comments.

gribozavr2 accepted this revision.Jun 24 2022, 12:36 PM