[LLVMdev] IVUsers (LoopPass) analysis in a ModulePass?

Devang Patel dpatel at apple.com
Mon Sep 12 14:41:17 PDT 2011


Hi Tim,


> From: Tim Creech <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
> 
> Hi all,
>  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.
-
Devang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110912/6fa38c65/attachment.html>


More information about the llvm-dev mailing list