[LLVMdev] How to force MemoryDependenceAnalysis to run on original module

Chris Lattner clattner at apple.com
Fri Aug 21 08:06:34 PDT 2009


On Aug 21, 2009, at 3:04 AM, Marc Brünink wrote:
>> This isn't really possible.  The issue is that MemDep doesn't just
>> "analyze your function".  It is designed to be as lazy as possible,
>> which means that it only does analysis when a query is performed.   
>> This
>> means that if you have MemDep->Pass1->Pass2 and Pass2 uses MemDep  
>> info
>> that you need to make Pass1 preserve that memdep info.
>
>
> Hi,
>
> actually my problem is easier. So I still have hope that it is  
> possible:
>
> MemDep->Pass1->Pass2
>
> Pass1 uses MemDep. Pass2 only uses Pass1. Eventually, Pass2 changes  
> the
> code. Unfortunately, non-local dependencies of MemDep might point to
> code changed by Pass2. Therefore, Pass1 might see changes applied by
> Pass2. This breaks encapsulation.
>
> So I want to make sure the PassManager runs Pass1 on the whole module,
> before Pass2's runOnFunction is called the first time.

Not impossible at all.  I assume that Pass1 is your pass, just make  
the "Pass1::runOnFunction" method do everything you need.

If Pass2 ends up calling pass1 in various ways that require it to do  
things after its runonfunciton is complete, just make pass1  
"transitively depend on" memdep, and give pass1 an update interface  
that is a superset of what memdep needs.

-Chris



More information about the llvm-dev mailing list