[LLVMdev] Memory Dependence Analysis: getNonLocalDependency()

Owen Anderson resistor at mac.com
Mon Jul 28 19:00:41 PDT 2008


On Jul 28, 2008, at 5:53 PM, Prakash Prabhu wrote:

> Thanks for the quick reply, Owen. I went through the code in  
> MemoryDependenceAnalysis.cpp again. Since DenseMap<BasicBlock*,  
> Value*> maps a BasicBlock to a single Value (Instruction) and it is  
> populated by a DFS on the reverse Control Flow Graph starting at the  
> query instruction's block, is it correct to say that the last  
> dependent instruction in each visited basic block is what is  
> mapped ? For example, if a basicblock B has two instructions:
>
> B:
>
> store i32 1, i32* %i, align 4                           (say inst1)
> ...
> load i32* %i, align 4           ; <i32>:39 [#uses=1]  (say inst2)
>
> and suppose i had one more Store instruction to %i outside B which  
> is the query, then when B is visited, in the DenseMap only the  
> mapping <B, inst2> is added and not <B, inst1> ?
>
> I am guessing that this information is sufficient for most code- 
> hoisting optimizations since just the knowledge that a basic block  
> has some load/store instruction accessing the same (modulo the  
> pointer analysis) address is sufficient to prevent the  
> transformation from causing an unsafe code-movement ?
>

Yup, that's exactly right.

--Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080728/2a934dd7/attachment.bin>


More information about the llvm-dev mailing list