[PATCH] D131646: [clang][dataflow] Restructure loops to call widen on back edges

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 05:47:52 PDT 2022


ymandel accepted this revision.
ymandel added a comment.
This revision is now accepted and ready to land.

Nice!



================
Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:180
+      assert(Block->pred_size() == 2);
+      BackEdge = Pred;
+    }
----------------
Might it be worth simply returning the backedge when you find it? Or is the assertion (above) sufficiently important to keep it as is?


================
Comment at: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp:275
+  )";
+  auto BlockStates = llvm::cantFail(runAnalysis<ConvergesOnWidenAnalysis>(
+      Code, [](ASTContext &C) { return ConvergesOnWidenAnalysis(C); }));
----------------
Might a (googletest) assertion here be better than `llvm::cantFail`? I would think that this line is the crux of checking whether it converges or not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131646/new/

https://reviews.llvm.org/D131646



More information about the cfe-commits mailing list