Szelethus created this revision. Szelethus added reviewers: xazax.hun, NoQ, vsavchenko, balazske, martong, baloghadamsoftware, steakhal. Szelethus added a project: clang. Herald added subscribers: cfe-commits, ASDenysPetrov, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, whisperity. Szelethus requested review of this revision.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D87519 Files: clang/lib/Analysis/LiveVariables.cpp Index: clang/lib/Analysis/LiveVariables.cpp =================================================================== --- clang/lib/Analysis/LiveVariables.cpp +++ clang/lib/Analysis/LiveVariables.cpp @@ -13,6 +13,7 @@ #include "clang/Analysis/Analyses/LiveVariables.h" #include "clang/AST/Stmt.h" #include "clang/AST/StmtVisitor.h" +#include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/AnalysisDeclContext.h" #include "clang/Analysis/CFG.h" #include "clang/Analysis/FlowSensitive/DataflowWorklist.h" @@ -502,6 +503,9 @@ CFG *cfg = AC.getCFG(); if (!cfg) return nullptr; + assert(AC.getAnalysis<PostOrderCFGView>() && + "If the CFG exists, we should be able to create a post order view of " + "it!"); // The analysis currently has scalability issues for very large CFGs. // Bail out if it looks too large. @@ -510,13 +514,12 @@ LiveVariablesImpl *LV = new LiveVariablesImpl(AC, killAtAssign); - // Construct the dataflow worklist. Enqueue the exit block as the + // Construct the dataflow worklist. Enqueue the exit block as the // start of the analysis. BackwardDataflowWorklist worklist(*cfg, AC); llvm::BitVector everAnalyzedBlock(cfg->getNumBlockIDs()); - // FIXME: we should enqueue using post order. - for (const CFGBlock *B : cfg->nodes()) { + for (const CFGBlock *B : *AC.getAnalysis<PostOrderCFGView>()) { worklist.enqueueBlock(B); }
Index: clang/lib/Analysis/LiveVariables.cpp =================================================================== --- clang/lib/Analysis/LiveVariables.cpp +++ clang/lib/Analysis/LiveVariables.cpp @@ -13,6 +13,7 @@ #include "clang/Analysis/Analyses/LiveVariables.h" #include "clang/AST/Stmt.h" #include "clang/AST/StmtVisitor.h" +#include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/AnalysisDeclContext.h" #include "clang/Analysis/CFG.h" #include "clang/Analysis/FlowSensitive/DataflowWorklist.h" @@ -502,6 +503,9 @@ CFG *cfg = AC.getCFG(); if (!cfg) return nullptr; + assert(AC.getAnalysis<PostOrderCFGView>() && + "If the CFG exists, we should be able to create a post order view of " + "it!"); // The analysis currently has scalability issues for very large CFGs. // Bail out if it looks too large. @@ -510,13 +514,12 @@ LiveVariablesImpl *LV = new LiveVariablesImpl(AC, killAtAssign); - // Construct the dataflow worklist. Enqueue the exit block as the + // Construct the dataflow worklist. Enqueue the exit block as the // start of the analysis. BackwardDataflowWorklist worklist(*cfg, AC); llvm::BitVector everAnalyzedBlock(cfg->getNumBlockIDs()); - // FIXME: we should enqueue using post order. - for (const CFGBlock *B : cfg->nodes()) { + for (const CFGBlock *B : *AC.getAnalysis<PostOrderCFGView>()) { worklist.enqueueBlock(B); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits