[PATCH] D49988: [ADCE] Remove the need of DomTree

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 08:57:38 PDT 2018


kuhar added inline comments.


================
Comment at: lib/Transforms/Scalar/ADCE.cpp:675
 PreservedAnalyses ADCEPass::run(Function &F, FunctionAnalysisManager &FAM) {
-  auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
+  auto *DT = FAM.getCachedResult<DominatorTreeAnalysis>(F);
   auto &PDT = FAM.getResult<PostDominatorTreeAnalysis>(F);
----------------
Can you add a comment explaining that you only get DT to preserve it, and only when it's already available?


================
Comment at: lib/Transforms/Scalar/ADCE.cpp:702
+    auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>();
+    auto *DT = DTWP ? &DTWP->getDomTree() : nullptr;
     auto &PDT = getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
----------------
Same as above


Repository:
  rL LLVM

https://reviews.llvm.org/D49988





More information about the llvm-commits mailing list