[PATCH] D70376: [LVI] Restructure caching

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 14:58:11 PDT 2020


tejohnson added a comment.

In D70376#2148418 <https://reviews.llvm.org/D70376#2148418>, @nikic wrote:

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


Yep - it seems to fix the issue!

> 
> 
>   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