I'm seeing some very unexpected behavior in a ModulePass I've created. To support both the legacy and new pass managers, I've abstracted away the code to get the passes it depends on: bool MyPass::runOnModule(Module &M) override { auto DominatorGetter = [this] (Function &F) -> DominatorTree & { return this->getAnalysis<DominatorTreeWrapperPass>(F).getDomTree(); }; auto PostDominatorGetter = [this] (Function &F) -> PostDominatorTree & { return this-> getAnalysis<PostDominatorTreeWrapperPass>(F).getPostDomTree(); }; auto LoopInfoGetter = [this] (Function &F) -> LoopInfo & { return this->getAnalysis<LoopInfoWrapperPass>(F).getLoopInfo(); }; auto SCEVGetter = [this] (Function &F) -> ScalarEvolution & { return this->getAnalysis<ScalarEvolutionWrapperPass>(F).getSE(); }; auto AssumptionCacheGetter = [this] (Function &F) -> AssumptionCache & { return this->getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); }; auto OREGetter = [this] (Function &F) -> OptimizationRemarkEmitter & { return this-> getAnalysis<OptimizationRemarkEmitterWrapperPass>(F).getORE(); }; }
What is the behavior that you are not expecting? Cheers, Philip On Tue, Mar 26, 2019 at 9:26 PM David Greene via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I'm seeing some very unexpected behavior in a ModulePass I've created. > To support both the legacy and new pass managers, I've abstracted away > the code to get the passes it depends on: > > bool MyPass::runOnModule(Module &M) override { > auto DominatorGetter = [this] (Function &F) -> DominatorTree & { > return this->getAnalysis<DominatorTreeWrapperPass>(F).getDomTree(); > }; > > auto PostDominatorGetter = [this] (Function &F) -> PostDominatorTree > & { > return this-> > getAnalysis<PostDominatorTreeWrapperPass>(F).getPostDomTree(); > }; > > auto LoopInfoGetter = [this] (Function &F) -> LoopInfo & { > return this->getAnalysis<LoopInfoWrapperPass>(F).getLoopInfo(); > }; > > auto SCEVGetter = [this] (Function &F) -> ScalarEvolution & { > return this->getAnalysis<ScalarEvolutionWrapperPass>(F).getSE(); > }; > > auto AssumptionCacheGetter = [this] (Function &F) -> > AssumptionCache & { > return > this->getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); > }; > > auto OREGetter = [this] (Function &F) -> OptimizationRemarkEmitter & > { > return this-> > getAnalysis<OptimizationRemarkEmitterWrapperPass>(F).getORE(); > }; > } > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190326/95401bce/attachment.html>
Philip Pfaffe via llvm-dev <llvm-dev at lists.llvm.org> writes:> What is the behavior that you are not expecting?Sorry, I hit send too quickly. I posted a later message with all the details. -David> Cheers, > Philip > > On Tue, Mar 26, 2019 at 9:26 PM David Greene via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I'm seeing some very unexpected behavior in a ModulePass I've created. > To support both the legacy and new pass managers, I've abstracted away > the code to get the passes it depends on: > > bool MyPass::runOnModule(Module &M) override { > auto DominatorGetter = [this] (Function &F) -> DominatorTree & { > return this->getAnalysis<DominatorTreeWrapperPass>(F).getDomTree(); > }; > > auto PostDominatorGetter = [this] (Function &F) -> PostDominatorTree & { > return this-> > getAnalysis<PostDominatorTreeWrapperPass>(F).getPostDomTree(); > }; > > auto LoopInfoGetter = [this] (Function &F) -> LoopInfo & { > return this->getAnalysis<LoopInfoWrapperPass>(F).getLoopInfo(); > }; > > auto SCEVGetter = [this] (Function &F) -> ScalarEvolution & { > return this->getAnalysis<ScalarEvolutionWrapperPass>(F).getSE(); > }; > > auto AssumptionCacheGetter = [this] (Function &F) -> > AssumptionCache & { > return > this->getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); > }; > > auto OREGetter = [this] (Function &F) -> OptimizationRemarkEmitter & { > return this-> > getAnalysis<OptimizationRemarkEmitterWrapperPass>(F).getORE(); > }; > } > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev