[LLVMdev] llvm alloca dependencies

John Criswell criswell at illinois.edu
Tue Jan 22 07:57:34 PST 2013


On 1/21/13 5:22 AM, Alexandru Ionut Diaconescu wrote:
> Hello everyone !
>
> I am trying to determine for certain Load instructions from my pass 
> their corresponding Alloca instructions (that can be in other previous 
> blocks). The chain can be something like : `TargetLoad(var) -> other 
> stores/loads that use var (or dependencies on var) -> alloca(var).` , 
> linked on several basic blocks. Do you know how can I do it?

This sounds like an alias analysis query that you're trying to do. There 
are a couple of options:

1) Cycle through all the allocas and ask if they alias with the loaded 
pointer.  You can use any of the alias analysis implementations 
available for LLVM.  Alternatively, I think LLVM might have a class 
called AliasSetTracker which can do something similar for you.

2) Use DSA from the poolalloc project.  The DSNodeEquivs pass can be 
used to determine if a load and an alloca alias.  Depending on your 
situation, DSA may give better or worse results than LLVM's current 
alias analysis algorithms.  I would think that DSA can do a better job 
for pointers stored into memory locations.

-- John T.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130122/a9092249/attachment.html>


More information about the llvm-dev mailing list