[clang] [clang][dataflow] In the CFG visualization, mark converged blocks. (PR #79999)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 09:20:37 PST 2024


================
@@ -158,13 +158,17 @@ class HTMLLogger : public Logger {
 
   StreamFactory Streams;
   std::unique_ptr<llvm::raw_ostream> OS;
-  std::optional<llvm::json::OStream> JOS;
+  std::string JSON;
+  llvm::raw_string_ostream JStringStream{JSON};
+  llvm::json::OStream JOS{JStringStream, /*Indent=*/2};
 
   const ControlFlowContext *CFG;
   // Timeline of iterations of CFG block visitation.
   std::vector<Iteration> Iters;
   // Indexes  in `Iters` of the iterations for each block.
   llvm::DenseMap<const CFGBlock *, llvm::SmallVector<size_t>> BlockIters;
+  // IDs of blocks that converged (on the last iteration).
+  llvm::DenseSet<unsigned> ConvergedBlocks;
----------------
Xazax-hun wrote:

I don't have a strong opinion, but I wonder if a BitVector would be a bit more efficient in most of the cases. 

https://github.com/llvm/llvm-project/pull/79999


More information about the cfe-commits mailing list