implicit Pass Type dependencies between Analysis Pass and Transformation Pass

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

implicit Pass Type dependencies between Analysis Pass and Transformation Pass

Chuck Zhao
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





_______________________________________________
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: implicit Pass Type dependencies between Analysis Pass and Transformation Pass

Duncan Sands
Hi Chuck,

> Module Pass                          Function Pass
>                            Stuck

did you build LLVM with assertions enabled?  My guess is that you would get
an assertion failure in this situation.

Ciao, Duncan.
_______________________________________________
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: implicit Pass Type dependencies between Analysis Pass and Transformation Pass

Devang Patel
In reply to this post by Chuck Zhao
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
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev