Pass dependency error

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 {


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().getKernels();
for ( auto* kernel : kernels)

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.


I’m not too familiar with the legacy PM, but perhaps you’re missing a INITIALIZE_PASS_DEPENDENCY?

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.