[PATCH] D136332: [FuncSpec][NFC] Avoid redundant computations of DominatorTree/LoopInfo
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 24 03:51:53 PDT 2022
SjoerdMeijer added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:467
SpecializationInfo &S = Specializations.back().second;
- S.Gain += getSpecializationBonus(A, C);
+ S.Gain += getSpecializationBonus(A, C, LI);
S.Args.push_back({A, C});
----------------
Nit: if this is a simple getter function, not calculating anything, we can just pass `Solver.getLoopInfo(*F)` in here.
================
Comment at: llvm/lib/Transforms/Utils/SCCPSolver.cpp:342-347
+ const LoopInfo &getLoopInfo(Function &F) {
+ auto A = AnalysisResults.find(&F);
+ assert(A != AnalysisResults.end() && A->second.LI &&
+ "Need LoopInfo analysis results for function.");
+ return *A->second.LI;
+ }
----------------
ChuanqiXu wrote:
> I feel like the assertion may be triggered if we run specializer on the specialized functions. This **looks** possible when `FuncSpecializationMaxIters>1` but we only calculate the analysis once.
Or with the legacy pass manager? Is that how I should read the comment above:
// We cannot preserve the LI, DT, or PDT with the legacy pass ...
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136332/new/
https://reviews.llvm.org/D136332
More information about the llvm-commits
mailing list