[LLVMdev] [Polly] Move Polly's execution later

Tobias Grosser tobias at grosser.es
Thu Sep 19 07:59:25 PDT 2013

On 09/19/2013 04:46 PM, Star Tan wrote:
> Hi Tobias,
> I am trying to move Polly later.
> LLVM provides some predefined ExtensionPointTy:
>      EP_EarlyAsPossible,
>      EP_ModuleOptimizerEarly,
>      EP_LoopOptimizerEnd,
>      EP_ScalarOptimizerLate,
>      ...
> Currently Polly uses "EP_EarlyAsPossible" to run as early as possible.  As what you suggested:
>> Instead of removing canonicalization passes, I believe we may want to
>> move Polly to a later place in the pass manager. Possibly at the
>> beginning of the loop optimizer right before PM.add(createLoopRotatePass());
> I want to move it to the point immediate after someone Loop optimization pass, e.g. MPM.add(createLoopRotatePass()).  However no predefined ExtensionPointTy is available for this purpose. Instead, the "EP_ModuleOptimizerEarly" would move Polly before all loop optimization passes.
> In my option, there are two solutions: one is to use "EP_ModuleOptimizerEarly" (only modify the tool/polly/lib/RegisterPasses.cpp) to move Polly before all loop optimization passes; the other is to add a new ExtensionPointTy, e.g. "EP_LoopRotateEnd" and move Polly exactly immediate after the "LoopRotate" pass (need to modify tool/polly/lib/RegisterPasses.cpp, include/llvm/Transforms/IPO/PassManagerBuilder.h and lib/Transforms/IPO/PassManagerBuilder.cpp). We can use the second way to investigate other points to start Polly.
> Is my understanding correct? Do you have any further suggestion?

Yes, fully correct. I would play with solution two. Why would you add 
Polly after the loop rotate pass?

I would possibly add it at the beginning of the loop optimizer (right 
before the loop rotation pass) possibly experimenting with a new 
extension point called EP_LoopOptimizerBegin.


More information about the llvm-dev mailing list