<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi all,</p>
<p>I am getting the infamous error:</p>
<p>Assertion `ResultPass && "getAnalysis*() called on an
analysis that was not " "'required' by pass!"' <br>
</p>
<p>but i really don't understand why.</p>
<p>I have:</p>
<div style="color: #353535;background-color: #f8f8f8;font-family: '">
<div><span style="color: #386ac3;">void</span><span style="color:
#353535;"> InstrumentationPass</span><span style="color:
#353535;">::</span><span style="color: #8431c5;">getAnalysisUsage</span><span
style="color: #353535;">(</span><span style="color: #8431c5;">llvm</span><span
style="color: #353535;">::</span><span style="color: #163fe4;">AnalysisUsage</span><span
style="color: #353535;"> </span><span style="color: #386ac3;">&</span><span
style="color: #e06c75;">AU</span><span style="color: #353535;">)
</span><span style="color: #386ac3;">const</span><span
style="color: #353535;"> {</span></div>
<div><span style="color: #353535;"> AU.</span><span
style="color: #8431c5;">setPreservesAll</span><span
style="color: #353535;">();<br>
</span></div>
<div><span style="color: #353535;"> AU.addRequired</span><span
style="color: #386ac3;"><</span><span style="color:
#353535;">DetectKernelsPass</span><span style="color:
#386ac3;">></span><span style="color: #353535;">();</span></div>
<div><span style="color: #353535;"> AU.addRequired</span><span
style="color: #386ac3;"><</span><span style="color:
#353535;">SimplifyGEPPass</span><span style="color: #386ac3;">></span><span
style="color: #353535;">()</span></div>
</div>
<p>DetectKernelsPass (ModulePass) is a simple analysis pass that
gathers kernel functions. SimplifyGEPPass (FunctionPass) performs
some transformations.<br>
</p>
<p>InstrumentationPass (ModulePass) is using the others like:</p>
<div style="color: #353535;background-color: #f8f8f8;font-family: '">auto
kernels = getAnalysis<DetectKernelsPass>().getKernels();</div>
<div style="color: #353535;background-color: #f8f8f8;font-family: '">for
( auto* kernel : kernels)</div>
<div style="color: #353535;background-color: #f8f8f8;font-family: '">
getAnalysis<SimplifyGEPPass>().runOnFunction(*kernel);<br>
</div>
<p><br>
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? <br>
</p>
<p>I also tried some llvm pass (MemorySSAWrapperPass) but i'm
getting the same error:</p>
<p>AnalysisType &llvm::Pass::getAnalysisID(llvm::AnalysisID)
const [AnalysisType = llvm::MemorySSAWrapperPass]: Assertion
`ResultPass && "getAnalysis*() called on an analysis that
was not " "'required' by pass!"' f<br>
</p>
<p>I would really appreciate some help with this.</p>
<p>PS. I'm on LLVM 10, building the passes out of tree.</p>
<p>Ees<br>
</p>
</body>
</html>