[PATCH] D70376: [LVI] Restructure caching

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 13:54:27 PDT 2020


nikic added a comment.

@tejohnson Just to check whether this would improve anything, could you try this patch?

  diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  index cd2f4ca36f3..ef81699c77f 100644
  --- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  +++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  @@ -929,11 +929,19 @@ CorrelatedValuePropagationPass::run(Function &F, FunctionAnalysisManager &AM) {
   
     bool Changed = runImpl(F, LVI, DT, getBestSimplifyQuery(AM, F));
   
  -  if (!Changed)
  -    return PreservedAnalyses::all();
     PreservedAnalyses PA;
  -  PA.preserve<GlobalsAA>();
  -  PA.preserve<DominatorTreeAnalysis>();
  -  PA.preserve<LazyValueAnalysis>();
  +  if (!Changed) {
  +    PA = PreservedAnalyses::all();
  +  } else {
  +    PA.preserve<GlobalsAA>();
  +    PA.preserve<DominatorTreeAnalysis>();
  +    PA.preserve<LazyValueAnalysis>();
  +  }
  +
  +  // Keeping LVI alive is expensive, both because it uses a lot of memory, and
  +  // because invalidating values in LVI is expensive. While CVP does preserve
  +  // LVI, we know that passes after JumpThreading+CVP will not need the result
  +  // of this analysis, so we forcefully discard it early.
  +  PA.abandon<LazyValueAnalysis>();
     return PA;
   }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70376





More information about the llvm-commits mailing list