Dear All,
The attached code (which is a contrived test case) hits the following
assertion:
test:
/home/vadve/criswell/src/llvm22/include/llvm/PassAnalysisSupport.h:226:
AnalysisType& llvm::Pass::getAnalysisID(const llvm::PassInfo*,
llvm::Function&) [with AnalysisType = Pass1]: Assertion `ResultPass &&
"getAnalysis*() called on an analysis that was not " "'required' by
pass!"' failed.
Abort
Does anyone see anything wrong with my use of the pass manager
interface? As far as I can tell, the code looks correct.
-- John T.
test.cpp (1.26 KB)
Your pass manager interface is OK.
You are requesting PassManager to make a Function level analysis pass (Pass1) available to Module level transformation pass (BottomPass). In real life you could use it to request Dominator information for a module level pass. This is supported and it works. The reason it fails for your test case is that the function "main" is just a declaration. There is no analysis info to generate.
If you add a "main" function body in your module then it should work. Or you should check whether F.isDeclaration() is true or not before invoking getAnalysis<Pass1>(F);
I agree, the assertion message is not very helpful here.
Devang Patel wrote:
Thanks!. I didn't realize that functions needed bodies in order to pull up their analysis information.
-- John T.