<div dir="ltr">Valmico <<a href="mailto:valmico88@gmail.com">valmico88@gmail.com</a>> wrote:<br>> I'm currently trying to develop new LLVM Pass that will generate<div>> simple data dependencies graph. For now I'm trying to get familiar</div>
<div>> with DependenceAnalysis.<br>> My general idea is to traverse each function (runOnFunction)</div><div>> top to bottom Instruction by Instruction, using DA.depends( I, I2, ...)</div><div>> on every Instructions combination in function to check if they are</div>
<div>> dependent on any others.<br>><br>> Problem is that almost all (if not all) Instructions seems to be dependent</div><div>> on others even if they write/read to/from different memory cells.<br>> Also I'm getting Dependence (confused) object, not the FullDependence,</div>
<div>> should i try to dynamically cast it to FullDependence, or is there a way</div><div>> to determine which Dependence instance i got other way?<br>><br>> Please help, I'm not an C++ nor LLVM programmer, but PHP-developer,</div>
<div>> however i need it done asap. If you can help just a little, give me a hint,</div><div>> i'll be very, very thankful for ANY support.<br>><br>> Best Regards<br>> Valmico<br><br></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">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:0 0 0 40px;border: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>
<div><br></div><div>Preston</div><div><br></div></div>