================ @@ -140,6 +140,15 @@ class DataflowAnalysisContext { /// Adds `Constraint` to the flow condition identified by `Token`. void addFlowConditionConstraint(Atom Token, const Formula &Constraint); + /// Adds `Deps` to the dependencies of the flow condition identified by + /// `Token`. Intended for use in deserializing contexts. The formula alone + /// doesn't have enough information to indicate its deps. + void addFlowConditionDeps(Atom Token, const llvm::DenseSet<Atom> &Deps) { ---------------- ymand wrote:
Here is deserialization: ``` static llvm::Error loadTokenDefinitions( const proto2::Map<uint32_t, FormulaProto> &AtomDefs, DataflowAnalysisContext &AC, dataflow::Arena &Arena, llvm::DenseMap<unsigned, dataflow::Atom> &AtomMap) { for (const auto &[AtomData, Proto] : AtomDefs) { auto DeserializedOrErr = Formula::deserialize(Proto.serialized(), Arena, AtomMap); if (!DeserializedOrErr) return DeserializedOrErr.takeError(); auto [It, Inserted] = AtomMap.try_emplace(AtomData, dataflow::Atom()); if (Inserted) It->second = Arena.makeAtom(); AC.addFlowConditionConstraint(It->second, **DeserializedOrErr); } return llvm::Error::success(); } static llvm::Error loadLogicalContext( const LogicalContext &LC, DataflowAnalysisContext &AC, dataflow::Arena &Arena, llvm::DenseMap<unsigned, dataflow::Atom> &AtomMap) { if (LC.has_ground_truth()) { auto GroundTruth = Formula::deserialize(LC.ground_truth().serialized(), Arena, AtomMap); if (!GroundTruth) return GroundTruth.takeError(); AC.addInvariant(**GroundTruth); } for (const auto &[AtomData, DepSet] : LC.atom_deps()) { auto [It, Inserted] = AtomMap.try_emplace(AtomData, dataflow::Atom()); if (Inserted) It->second = Arena.makeAtom(); llvm::DenseSet<dataflow::Atom> Deps; for (uint32_t DepAtomData : DepSet.atoms()) { auto [DepIt, DepInserted] = AtomMap.try_emplace(DepAtomData, dataflow::Atom()); if (DepInserted) DepIt->second = Arena.makeAtom(); Deps.insert(DepIt->second); } AC.addFlowConditionDeps(It->second, Deps); } return loadTokenDefinitions(LC.atom_defs(), AC, Arena, AtomMap); } ``` https://github.com/llvm/llvm-project/pull/152487 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits