<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/8/8 Preston Briggs <span dir="ltr"><<a href="mailto:preston.briggs@gmail.com" target="_blank">preston.briggs@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div></div><div>Hi,</div>
<div><br></div><div>The DependenceAnalysis pass isn't reliable yet; it has several errors that need to be corrected. These manifest by the analysis claiming there's no dependence when one in fact exists.</div><div>
<br></div><div>Your proposed scheme of testing every pair of instructions is asymptotically expensive, requiring O(n^2) tests, where each test is already fairly expensive. I describe (or start to describe) a better approach <a href="https://sites.google.com/site/parallelizationforllvm/building-the-dependence-graph" target="_blank">here</a>.</div>
<div><br></div><div>In the meantime, you should be getting better results than you report. You'll want to use several other passes in conjunction with DA. Try something like</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div><code style="color:rgb(0,96,0);font-size:13px;line-height:13px">opt -basicaa -mem2reg -simplifycfg -loop-simplify -loop-rotate -simplifycfg -instcombine -indvars</code><code style="color:rgb(0,96,0);font-size:13px;line-height:13px"> -da</code></div>
</blockquote><div><br></div><div>Also, a confused dependences mean that the analysis wasn't able to prove anything; a FullDependence means the analysis was able to prove some facts, though it wasn't actually able to disprove the dependence. It's not reasonable to cast a Dependence to a FullDependence.</div>
<span class=""><font color="#888888">
<div><br></div><div>Preston</div><div><br></div></font></span></div>
</blockquote></div><br></div><div class="gmail_extra">Hi,<br><br></div><div class="gmail_extra">I assume that DA is tool capable to give me an list of Dependencies in code or at least a easy way to test instructions without much knowledge about ZIV SIV, and other tests that has to be done find out dependencies?<br>
</div><div class="gmail_extra">Personally i'm an PHP programmer and i feel lack of proper (at least for me) documentation with good use examples about LLVM, and it's modules like analysis, transforms etc.<br><br></div>
<div class="gmail_extra">I agree that testing every pair is asymptotically expensive, requiring O(n^2), but it doesnt matter for me for now.<br><br></div><div class="gmail_extra">This is code i came up for now:<br><br>virtual bool runOnFunction(Function &F) {<br>
<br> DependenceAnalysis &DA = this->getAnalysis<DependenceAnalysis>();<br> <br> std::vector<Instruction*> instructions;<br> <br> for( inst_iterator I = inst_begin(F); I != inst_end(F); I++ ) {<br>
if( isa<StoreInst>( *I ) || isa<LoadInst>( *I ) ) {<br> errs() << "Instruction " << *I << '\n';<br> <br> for(std::vector<Instruction*>::iterator it = instructions.begin(); it != instructions.end(); it++) {<br>
Dependence *dep = DA.depends(&*I,*it,false);<br> if( dep == NULL ) {<br> //errs() << " no dependence." << '\n';<br> } else if( dep->isConfused() == true ) {<br>
if( dep->isInput() ) {<br> errs() << '\t' << **it << " input dependence." << '\n';<br> } else if( dep->isOutput() ) {<br>
errs() << '\t' << **it << " output dependence." << '\n';<br> } else if( dep->isFlow() ) {<br> errs() << '\t' << **it << " flow dependence." << '\n';<br>
} else if( dep->isAnti() ) {<br> errs() << '\t' << **it << " anti dependence." << '\n';<br> }<br> } else if( dep->isConfused() == false ) {<br>
errs() << "# full dependence." << '\n';<br> //if( FullDependence *FDep = cast<FullDependence>( dep ) ) {<br> // errs() << " full dep casted" << '\n';<br>
//}<br> }<br> }<br> <br> instructions.push_back(&*I);<br> }<br> }<br>}<br><br></div><div class="gmail_extra">Most likely i'm moving totally in wrong direction, but thats what happens when people do sth completly blindly. Please dont' bother performance concerns, it's my least problem.<br>
</div></div>