<div dir="ltr">Hello llvm-dev,<div><br></div><div>I'm running a pass that uses the result of llvm::DependenceAnalysisWrapperPass to compute the dependencies between all instructions of a loop. I have the following two examples of code I wish to analyse:<br><br>example A:<br><br></div><div>```</div><div><div>void move_one(int *A, unsigned n) {</div><div>  for (unsigned i = 0; i < n-1; ++i) {</div><div>    A[i] = A[i + 1];</div><div>  }</div><div>}</div></div><div>```</div><div>and example B:</div><div>```</div><div><div>void move_one_alt(int *A, unsigned n) {</div><div>  int *B = A + 1;</div><div>  for (unsigned i = 0; i < n-1; ++i) {</div><div>    A[i] = B[i];</div><div>  }</div><div>}</div><div>```</div><div><br></div><div>I would expect that I get the same result for both A and B, namely a loop carried anti (WAR) dependence from the generated load instruction to the generated store instruction. This should be the case, because on iteration i+1 the loop is writing to the element that has been read in the previous iteration - iteration i.</div><div><br></div><div>However, in example A I get a loop carried flow (RAW) dependence from the store instruction to the load instruction, while in example B I don't get any dependence at all.</div><div><br></div><div>Am I missing something, or is the result wrong?</div><div><br></div><div>Thanks,</div><div> - Stan</div><div><br></div></div></div>