Hi all, I am getting the infamous error: Assertion `ResultPass && "getAnalysis*() called on an analysis that was not " "'required' by pass!"' but i really don't understand why. I have: voidInstrumentationPass::getAnalysisUsage(llvm::AnalysisUsage&AU) const{ AU.setPreservesAll(); AU.addRequired<DetectKernelsPass>(); AU.addRequired<SimplifyGEPPass>() DetectKernelsPass (ModulePass) is a simple analysis pass that gathers kernel functions. SimplifyGEPPass (FunctionPass) performs some transformations. InstrumentationPass (ModulePass) is using the others like: auto kernels = getAnalysis<DetectKernelsPass>().getKernels(); for ( auto* kernel : kernels) getAnalysis<SimplifyGEPPass>().runOnFunction(*kernel); DetectKernelsPass works fine but i am getting the error for SimplifyGEPPass and i can't figure out why. Are FunctionPasses not supposed to be used inside ModulePasses like that? I also tried some llvm pass (MemorySSAWrapperPass) but i'm getting the same error: AnalysisType &llvm::Pass::getAnalysisID(llvm::AnalysisID) const [AnalysisType = llvm::MemorySSAWrapperPass]: Assertion `ResultPass && "getAnalysis*() called on an analysis that was not " "'required' by pass!"' f I would really appreciate some help with this. PS. I'm on LLVM 10, building the passes out of tree. Ees -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201002/47cd07e6/attachment.html>
I'm not too familiar with the legacy PM, but perhaps you're missing a INITIALIZE_PASS_DEPENDENCY? On Fri, Oct 2, 2020 at 2:00 AM Ees via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi all, > > I am getting the infamous error: > > Assertion `ResultPass && "getAnalysis*() called on an analysis that was > not " "'required' by pass!"' > > but i really don't understand why. > > I have: > void InstrumentationPass::getAnalysisUsage(llvm::AnalysisUsage &AU) const > { > AU.setPreservesAll(); > AU.addRequired<DetectKernelsPass>(); > AU.addRequired<SimplifyGEPPass>() > > DetectKernelsPass (ModulePass) is a simple analysis pass that gathers > kernel functions. SimplifyGEPPass (FunctionPass) performs some > transformations. > > InstrumentationPass (ModulePass) is using the others like: > auto kernels = getAnalysis<DetectKernelsPass>().getKernels(); > for ( auto* kernel : kernels) > getAnalysis<SimplifyGEPPass>().runOnFunction(*kernel); > > > DetectKernelsPass works fine but i am getting the error for > SimplifyGEPPass and i can't figure out why. Are FunctionPasses not supposed > to be used inside ModulePasses like that? > > I also tried some llvm pass (MemorySSAWrapperPass) but i'm getting the > same error: > > AnalysisType &llvm::Pass::getAnalysisID(llvm::AnalysisID) const > [AnalysisType = llvm::MemorySSAWrapperPass]: Assertion `ResultPass && > "getAnalysis*() called on an analysis that was not " "'required' by pass!"' > f > > I would really appreciate some help with this. > > PS. I'm on LLVM 10, building the passes out of tree. > > Ees > _______________________________________________ > 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/20201002/f54d4b62/attachment.html>
Is this needed if i'm building out of tree? In any case, i am not doing INITIALIZE_PASS_DEPENDENCY for DetectKernelsPass and it does not complain about it. It basically only complains for any Function pass i try to use. Ees On 02-10-2020 19:54, Arthur Eubanks wrote:> I'm not too familiar with the legacy PM, but perhaps you're missing a > INITIALIZE_PASS_DEPENDENCY? > > On Fri, Oct 2, 2020 at 2:00 AM Ees via llvm-dev > <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > Hi all, > > I am getting the infamous error: > > Assertion `ResultPass && "getAnalysis*() called on an analysis > that was not " "'required' by pass!"' > > but i really don't understand why. > > I have: > > voidInstrumentationPass::getAnalysisUsage(llvm::AnalysisUsage&AU) > const{ > AU.setPreservesAll(); > AU.addRequired<DetectKernelsPass>(); > AU.addRequired<SimplifyGEPPass>() > > DetectKernelsPass (ModulePass) is a simple analysis pass that > gathers kernel functions. SimplifyGEPPass (FunctionPass) performs > some transformations. > > InstrumentationPass (ModulePass) is using the others like: > > auto kernels = getAnalysis<DetectKernelsPass>().getKernels(); > for ( auto* kernel : kernels) > getAnalysis<SimplifyGEPPass>().runOnFunction(*kernel); > > > DetectKernelsPass works fine but i am getting the error for > SimplifyGEPPass and i can't figure out why. Are FunctionPasses not > supposed to be used inside ModulePasses like that? > > I also tried some llvm pass (MemorySSAWrapperPass) but i'm getting > the same error: > > AnalysisType &llvm::Pass::getAnalysisID(llvm::AnalysisID) const > [AnalysisType = llvm::MemorySSAWrapperPass]: Assertion `ResultPass > && "getAnalysis*() called on an analysis that was not " > "'required' by pass!"' f > > I would really appreciate some help with this. > > PS. I'm on LLVM 10, building the passes out of tree. > > Ees > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto: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/20201002/2805f91a/attachment.html>