[PATCH] D48914: [PGOMemOPSize] Preserve the DominatorTree
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 4 00:18:02 PDT 2018
dmgreen added inline comments.
================
Comment at: lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp:346
- BasicBlock *DefaultBB = SplitBlock(BB, MI);
+ BasicBlock *DefaultBB = SplitBlock(BB, MI, &DT);
BasicBlock::iterator It(*MI);
----------------
Why not use DTU for the whole thing ;)
================
Comment at: lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp:432
auto &ORE = getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE();
- return PGOMemOPSizeOptImpl(F, BFI, ORE);
+ auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
+ return PGOMemOPSizeOptImpl(F, BFI, ORE, DT);
----------------
We can use getAnalysisIfAvailable to only get the DT if it's already been created by some other pass in the pipeline. That way we can preserve it if it already exists, but don't have to recalculate it if not.
================
Comment at: lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp:443
auto &ORE = FAM.getResult<OptimizationRemarkEmitterAnalysis>(F);
- bool Changed = PGOMemOPSizeOptImpl(F, BFI, ORE);
+ auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
+ bool Changed = PGOMemOPSizeOptImpl(F, BFI, ORE, DT);
----------------
I think the new pass manager equivalent to getAnalysisIfAvailable is getCachedResult<..>(F).
Repository:
rL LLVM
https://reviews.llvm.org/D48914
More information about the llvm-commits
mailing list