[LLVMdev] IVUsers (LoopPass) analysis in a ModulePass?
Timothy Mattausch Creech
tcreech at umd.edu
Mon Sep 12 20:23:59 PDT 2011
Thanks for your reply. In my case it is helpful just to know that what I'm trying is unsupported.
You're right that we don't really strictly need this arrangement. Ideally, I think our ModulePass should actually be converted to a LoopPass. I think this is how we'll move forward.
On Sep 12, 2011, at 5:41 PM, Devang Patel wrote:
From: Tim Creech <tcreech at umd.edu<mailto:tcreech at umd.edu>>
Subject: [LLVMdev] IVUsers (LoopPass) analysis in a ModulePass?
Date: September 1, 2011 11:46:28 AM PDT
To: llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu>
I have a loadable ModulePass which does transformations, and I would like to
use IVUsers analysis within it. I noticed when I try to do this (via
the usual addRequired<IVUsers>() and getAnalysis<IVUsers>(*F)), opt
fails an assert:
All LoopPass, including IVUsers, uses runOnLoop(L, LPM) as an external interface to collect loop analysis or transform a loop. This is the hook used by pass manager. In your case getAnalysis<IVUsers>(*F) (where I assume F is a function ptr) is not what IVUsers supports. This works for FunctionPass because pass manager can do runOnFunction(F).
opt: /home/tcreech/build/llvm-2.9/include/llvm/PassAnalysisSupport.h:239: AnalysisType& llvm::Pass::getAnalysisID(const void*, llvm::Function&) [with AnalysisType = llvm::LoopInfo]: Assertion `ResultPass && "Unable to find requested analysis info"' failed.
...where I was using LoopInfo analysis without trouble before trying to
run IVUsers analysis as well. I suspect that I'm somehow doing something
that LLVM just doesn't allow. I know that LLVM allows getting
FunctionPass analysis from a ModulePass, but can I also get LoopPass
analysis from a ModulePass?
As you can image, this is not something that is supported by current pass manager implement.
Are you sure you need LoopPass to run your ModulePass ? Typically, ModulePass work at a module level e.g. inline functions, change function signatures etc.. Why would a ModulePass need a LoopPass analysis ? I am curious.
If you're interested in updating pass manager to support your needs then I can give you some hints.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev