[llvm-dev] Pass dependency error

Ees via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 2 02:00:02 PDT 2020


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>


More information about the llvm-dev mailing list