[LLVMdev] PassManager Error

Devang Patel dpatel at apple.com
Fri Jul 27 16:09:00 PDT 2007


On Jul 27, 2007, at 3:39 PM, David Greene wrote:

> On Friday 27 July 2007 15:15, Devang Patel wrote:
>
>> Now, if pass sequence is - ModuleLevelPass A, FunctionLevelPass B,
>> ModuleLevelPass D, FunctionLevelPass C then
>>
>> For each Module
>> 	run ModuleLevelPass A
>> 	for each function in this module
>> 		run FunctionLevelPass B
>> 	run ModuleLevelPass D
>> 	for each function in this module
>> 		run FunctionLevelPass C
>>
>>
>> In this situation, while processing 'foo' FunctionLevelPass C can not
>> use analysis info generated by FunctionLevelPass B for 'foo'.
>
> Why?  I expect the answer is something like, "because B doesn't exist
> anymore,"  or, "because you processed function 'bar' with B after  
> 'foo.'"
> But why?  B doesn't _have_ to exist and it shouldn't necessarily  
> matter
> in what order PassManager processes functions.  Only the information
> that pass B generates for foo need exist.

That is not true in LLVM. For example, DominatorTree pass maintains  
Dominator
info.

> If you're running module-level passes anyway, you're probably  
> burning a bit
> of memory to hold state, so maybe keeping around information for  
> all functions
> is feasible.  I don't know.

In general, it is not a good idea to keep info for all components  
around all time for many reasons. Too many to list here.

> Yes, I understand that these questions imply rethinking how  
> PassManager
> works.  That's why I'm asking them.  I reordered my code and got  
> things to
> work but it's always good to take a step back from time-to-time and  
> ask
> fundamental questions.  Even if no changes are immediately  
> forthcoming,
> it at least helps to identify areas of potential future work.

It is not just pass manager, you're asking question regarding LLVM's  
core design.

-
Devang




More information about the llvm-dev mailing list