[PATCH] D140308: [clang][dataflow][NFC] Fix comments related to widening.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 19 13:02:06 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd2e4aaf6ac3b: [clang][dataflow][NFC] Fix comments related to widening. (authored by ymandel).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140308/new/
https://reviews.llvm.org/D140308
Files:
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
Index: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -370,15 +370,18 @@
auto Effect = LatticeJoinEffect::Unchanged;
- // By the API, `PrevEnv` <= `*this`, meaning `join(PrevEnv, *this) =
- // *this`. That guarantees that these maps are subsets of the maps in
- // `PrevEnv`. So, we don't need change their current values to widen (in
- // contrast to `join`).
+ // By the API, `PrevEnv` is a previous version of the environment for the same
+ // block, so we have some guarantees about its shape. In particular, it will
+ // be the result of a join or widen operation on previous values for this
+ // block. For `DeclToLoc` and `ExprToLoc`, join guarantees that these maps are
+ // subsets of the maps in `PrevEnv`. So, as long as we maintain this property
+ // here, we don't need change their current values to widen.
//
- // FIXME: The above is violated for `MemberLocToStruct`, because `join` can
- // cause the map size to increase (when we add fresh data in places of
- // conflict). Once this issue with join is resolved, re-enable the assertion
- // below or replace with something that captures the desired invariant.
+ // FIXME: `MemberLocToStruct` does not share the above property, because
+ // `join` can cause the map size to increase (when we add fresh data in places
+ // of conflict). Once this issue with join is resolved, re-enable the
+ // assertion below or replace with something that captures the desired
+ // invariant.
assert(DeclToLoc.size() <= PrevEnv.DeclToLoc.size());
assert(ExprToLoc.size() <= PrevEnv.ExprToLoc.size());
// assert(MemberLocToStruct.size() <= PrevEnv.MemberLocToStruct.size());
Index: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
===================================================================
--- clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
+++ clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -137,10 +137,6 @@
///
/// Requirements:
///
- /// `Prev` must precede `Current` in the value ordering. Widening is *not*
- /// called when the current value is already equivalent to the previous
- /// value.
- ///
/// `Prev` and `Current` must model values of type `Type`.
///
/// `Prev` and `Current` must be assigned to the same storage location in
@@ -229,7 +225,7 @@
///
/// Requirements:
///
- /// `PrevEnv` must precede `this` in the environment ordering.
+ /// `PrevEnv` must be the immediate previous version of the environment.
/// `PrevEnv` and `this` must use the same `DataflowAnalysisContext`.
LatticeJoinEffect widen(const Environment &PrevEnv,
Environment::ValueModel &Model);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140308.484048.patch
Type: text/x-patch
Size: 2934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221219/8b197ae8/attachment.bin>
More information about the cfe-commits
mailing list