<div dir="ltr">Hi,<br><br>I have a question about the memory dependence analysis. I am trying to use it to selectively enumerate a set of pairs of (load, store) instructions for every function by calling getNonLocalDependency() on the MemoryDependenceAnalysis. This populates a DenseMap<BasicBlock*, Value*>. I just looked up an usage of this in GVN.cpp:<br>
<br>MD->getNonLocalDependency(C, deps);<br><br>for (DenseMap<BasicBlock*, Value*>::iterator I = deps.begin(),<br> E = deps.end(); I != E; ++I) {<br> if (I->second == MemoryDependenceAnalysis::None) {<br>
....<br> } else if (I->second != MemoryDependenceAnalysis::NonLocal) {<br> ....<br> } else {<br> ....<br> }<br> }<br> }<br><br>From the documentation, I got to know that MD can return the set of inter-block dependencies for any instruction (which is great!).<br>
My question is: what does None, Local and NonLocal (special markers defined in MemoryDependenceAnalysis.cpp) mean in this context ? <br>Given a store statement, my objective is to identify other load statements that it is dependent on ? I tried this code and it seems to run, but I wanted to make sure I am not missing anything (as a consequence of not knowing the semantics of None, Local and NonLocal) :<br>
<br> for (DenseMap<BasicBlock*, Value*>::iterator B = depMap.begin(),<br> E = depMap.end(); B != E; B++)<br> {<br> if (B->second == MemoryDependenceAnalysis::None || B->second == MemoryDependenceAnalysis::NonLocal)<br>
continue;<br> Value* depV = B->second;<br> if (isa<LoadInst>(depV))<br> {<br> ...<br> }<br> }<br><br>Thanks in advance for any pointers!<br><br>- Prakash<br>
</div>