li.zhe.hua created this revision.
Herald added subscribers: martong, xazax.hun.
Herald added a reviewer: NoQ.
Herald added a project: All.
li.zhe.hua requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

In DXXXXXXX, we implement widen by taking the block state upon entry
into the loop and copying it to the block that represents the
back-edge in order to initialize the state for the "0th" iteration of
the loop. If the loop is the first thing after the entry block,
skipping the entry block means we don't have an opportunity to do this
initialization, so we want to analyze the entry block, even as it has
zero statements, to keep the logic consistent.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131644

Files:
  clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp


Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
+++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
@@ -342,11 +342,8 @@
   std::vector<llvm::Optional<TypeErasedDataflowAnalysisState>> BlockStates(
       CFCtx.getCFG().size(), llvm::None);
 
-  // The entry basic block doesn't contain statements so it can be skipped.
   const CFGBlock &Entry = CFCtx.getCFG().getEntry();
-  BlockStates[Entry.getBlockID()] = {Analysis.typeErasedInitialElement(),
-                                     InitEnv};
-  Worklist.enqueueSuccessors(&Entry);
+  Worklist.enqueueBlock(&Entry);
 
   // Bugs in lattices and transfer functions can prevent the analysis from
   // converging. To limit the damage (infinite loops) that these bugs can 
cause,


Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
+++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
@@ -342,11 +342,8 @@
   std::vector<llvm::Optional<TypeErasedDataflowAnalysisState>> BlockStates(
       CFCtx.getCFG().size(), llvm::None);
 
-  // The entry basic block doesn't contain statements so it can be skipped.
   const CFGBlock &Entry = CFCtx.getCFG().getEntry();
-  BlockStates[Entry.getBlockID()] = {Analysis.typeErasedInitialElement(),
-                                     InitEnv};
-  Worklist.enqueueSuccessors(&Entry);
+  Worklist.enqueueBlock(&Entry);
 
   // Bugs in lattices and transfer functions can prevent the analysis from
   // converging. To limit the damage (infinite loops) that these bugs can cause,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to