Chuck Zhao
2011-Aug-01 23:53 UTC
[LLVMdev] implicit Pass Type dependencies between Analysis Pass and Transformation Pass
i am organizing my LLVM Passes into an Analysis Pass and a few Optimization Passes, which takes the result from analysis pass to guide their transformations. I found a surprising pass type dependency between the analysis pass and optimization passes. E.g. Analysis-Pass Type Optimization-Pass Type Status in Optimization Pass when adding the Analysis Pass Function Pass Function Pass Fine Module Pass Module Pass Fine Module Pass Function Pass Stuck Function Pass Module Pass Stuck Function Pass Loop Pass Stuck Module Pass Loop Pass Stuck ... The "stuck" situation happens when calling AU.addRequired<AnalysisPass>() inside the OptimizationPass's getAnalysisUsage() function. The opt tool seems to run into an infinite loop (on trivial testcases, which should finish in a flash of a second). Seems the Pass type between Analysis Pass and Optimization Pass has to match. I wonder if this is documented somewhere? Is there a simple rule to guide this? E.g. if the Optimization Pass needs to be a LoopPass, does it mean the AnalysisPass _has to_ be a Loop Pass as well? Thank you Chuck
Duncan Sands
2011-Aug-02 06:21 UTC
[LLVMdev] implicit Pass Type dependencies between Analysis Pass and Transformation Pass
Hi Chuck,> Module Pass Function Pass > Stuckdid you build LLVM with assertions enabled? My guess is that you would get an assertion failure in this situation. Ciao, Duncan.
Devang Patel
2011-Aug-02 17:45 UTC
[LLVMdev] implicit Pass Type dependencies between Analysis Pass and Transformation Pass
Chuck, On Aug 1, 2011, at 4:53 PM, Chuck Zhao wrote:> if the Optimization Pass needs to be a LoopPass, does it mean the > AnalysisPass _has to_ be a Loop Pass as well?LoopDeletion is a LoopPass and it uses DominatorTree which is a FunctionPass. http://llvm.org/docs/WritingAnLLVMPass.html is a really good starting point. - Devang
Apparently Analagous Threads
- [LLVMdev] Infinite loop parsing opt command line options
- [LLVMdev] Interactions between module and loop passes
- [LLVMdev] Interactions between module and loop passes
- [LLVMdev] How to force MemoryDependenceAnalysis to run on original module
- [LLVMdev] Why should we have the LoopPass and LoopPassManager? Can we get rid of this complexity?