<div dir="ltr">Hi LLVM-ers,<div><br></div><div>I try to develop my custom dynamic data dependence tool (focusing on nested loops), currently I can successfully get the trace including load/store address, loop information, etc.</div><div><br></div><div>However, when I try to analyze dynamic data dependence based on the pairwise method described in [1], the load/store for iteration variables may interfere my analysis (I only care about the load/store for meaningful load/store, eg, load/store for arrays).</div><div><br></div><div>To be more precise and make the problem understandable, here is an simple example:</div><div>------------------------------------</div><div>My test example:</div><div><br></div><div><div>for (j = 0; j < N-2; j++) {</div><div><span class="" style="white-space:pre">  </span>for (i = 1; i < N; i++) {</div><div><span class="" style="white-space:pre">               </span>x = a[i-1][j];</div><div><span class="" style="white-space:pre">             </span>a[i][j+2] = x + 1;</div><div><span class="" style="white-space:pre"> </span>}</div><div>}</div></div><div><br></div><div>The corresponding simplified llvm-IR is shown in below:</div><div><b>Beginning of simplified llvm-IR</b></div><div>entry:</div><div>    ...</div><div>    store i32 0, i32* %j, align4</div><div>    br label %for.cond</div><div><br></div><div>for.cond:</div><div>    ...</div><div>    br ...</div><div><br></div><div>for.body:</div><div>    store i32 1, i32* %i, align4</div><div>    br ...</div><div><br></div><div>for.cond1:</div><div>    ...</div><div><br></div><div>for.body3:</div><div>    ...</div><div>    %temp4 = load[10 x i32]** %a.addr, align 8</div><div>    ...</div><div>    store i32 %add, i32* %arrayidx10, align4</div><div>    br ...</div><div><br></div><div>... ...</div><div><b>End of simplified llvm-IR</b></div><div><br></div><div>The general idea to obtain the dynamic data dependence is that 1. get and record corresponding load/store addresses; 2. analyze load/store addresses in different iterations to figure out RAW, WAR or WAW dependence.</div><div><br></div><div>However, as we can see in the llvm-IR, apart from load/store instructions for array accesses we interested, there are lots of load/store instructions for iteration variables, i and j for the above example. And these noise load/store instructions will affect whether we have dependencies across loop iterations (loop-carried dependence) and dependence distance calculation.</div><div><br></div><div>Initially, I try to only focus on analyze the address in basic blocks containing "for.body", but it might be a problem if we have if-else statement in source codes and sometimes it also has load/store for iteration variables in basic blocks containing "for.body". Therefore, this approach can not solve my problem.</div><div><br></div><div>Any suggestion for my problem?</div><div><br></div><div>Thanks,</div><div>Henry</div><div>------------------------------------</div><div><br></div><div><br></div><div><br></div><div>[1]. <span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif">Minjang Kim, Hyesoon Kim, and Chi-Keung Luk. 2010. SD3: A Scalable Approach to Dynamic Data-Dependence Profiling, MICRO2010</span></div></div>