IVUsers (LoopPass) analysis in a ModulePass?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

IVUsers (LoopPass) analysis in a ModulePass?

Timothy Mattausch Creech
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:

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?

Thanks in advance for any help,
Tim Creech

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: IVUsers (LoopPass) analysis in a ModulePass?

Devang Patel
Hi Tim,


From: Tim Creech <[hidden email]>
Subject: [LLVMdev] IVUsers (LoopPass) analysis in a ModulePass?
Date: September 1, 2011 11:46:28 AM PDT
To: [hidden email]

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

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: IVUsers (LoopPass) analysis in a ModulePass?

Timothy Mattausch Creech
Hi Devang,
  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.

Thanks again,
Tim

On Sep 12, 2011, at 5:41 PM, Devang Patel wrote:

Hi Tim,


From: Tim Creech <[hidden email]>
Subject: [LLVMdev] IVUsers (LoopPass) analysis in a ModulePass?
Date: September 1, 2011 11:46:28 AM PDT
To: [hidden email]

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


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev