<div dir="ltr">Hi Philip,<div><br></div><div>Done. See <a href="https://bugs.llvm.org/show_bug.cgi?id=33567">https://bugs.llvm.org/show_bug.cgi?id=33567</a>.</div><div><br></div><div>Cheers,</div><div> - Stan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 23, 2017 at 11:52 AM, Philip Pfaffe <span dir="ltr"><<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Stan,<div><br></div><div>in the first example, I get an "anti [*|<]" result. DA doesn't look through zext expressions, so it needs to overapproximate.</div><div><br></div><div>In the second example I get a "consistent anti [0|<]" result, which is wrong. The cause of this bug is that DA falsely ignores the base pointer, and only looks at the indices.</div><div><br></div><div>Please file a bug report for this, including a reproducing example, and put me on CC.</div><div><br></div><div>Cheers,</div><div>Philip</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-06-22 10:59 GMT+02:00 Stanislav Manilov <span dir="ltr"><<a href="mailto:stanislav.manilov@gmail.com" target="_blank">stanislav.manilov@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Philip,<div><br></div><div>I forgot to mention that I was ignoring loop-independent dependences. If I don't I get an inconsistent, ordered, anti, loop-independent dependence and an inconsistent, ordered, flow, loop-carried dependence for example A. At the same time I get just a consistent, ordered, anti, loop-independent dependence for example B.<br><div><br></div><div>Here's the .ll code for example A:<br></div><div><b><br></b></div><div><div><b>; Function Attrs: nounwind uwtable</b></div><div><b>define void @_Z8move_onePij(i32*, i32) #3 {</b></div><div><b>  br label %3</b></div><div><b><br></b></div><div><b>; <label>:3:                                      ; preds = %13, %2</b></div><div><b>  %.0 = phi i32 [ 0, %2 ], [ %14, %13 ]</b></div><div><b>  %4 = sub i32 %1, 1</b></div><div><b>  %5 = icmp ult i32 %.0, %4</b></div><div><b>  br i1 %5, label %6, label %15</b></div><div><b><br></b></div><div><b>; <label>:6:                                      ; preds = %3</b></div><div><b>  %7 = add i32 %.0, 1</b></div><div><b>  %8 = zext i32 %7 to i64</b></div><div><b>  %9 = getelementptr inbounds i32, i32* %0, i64 %8</b></div><div><b>  %10 = load i32, i32* %9, align 4</b></div><div><b>  %11 = zext i32 %.0 to i64</b></div><div><b>  %12 = getelementptr inbounds i32, i32* %0, i64 %11</b></div><div><b>  store i32 %10, i32* %12, align 4</b></div><div><b>  br label %13</b></div><div><b><br></b></div><div><b>; <label>:13:                                     ; preds = %6</b></div><div><b>  %14 = add i32 %.0, 1</b></div><div><b>  br label %3</b></div><div><b><br></b></div><div><b>; <label>:15:                                     ; preds = %3</b></div><div><b>  ret void</b></div><div><b>}</b></div></div><div><br></div><div>Here's the .ll code for example B:<br><b><br></b><div><b>; Function Attrs: nounwind uwtable</b></div><div><b>define void @_Z12move_one_altPij(i32*, i32) #3 {</b></div><div><b>  %3 = getelementptr inbounds i32, i32* %0, i64 1</b></div><div><b>  br label %4</b></div><div><b><br></b></div><div><b>; <label>:4:                                      ; preds = %13, %2</b></div><div><b>  %.0 = phi i32 [ 0, %2 ], [ %14, %13 ]</b></div><div><b>  %5 = sub i32 %1, 1</b></div><div><b>  %6 = icmp ult i32 %.0, %5</b></div><div><b>  br i1 %6, label %7, label %15</b></div><div><b><br></b></div><div><b>; <label>:7:                                      ; preds = %4</b></div><div><b>  %8 = zext i32 %.0 to i64</b></div><div><b>  %9 = getelementptr inbounds i32, i32* %3, i64 %8</b></div><div><b>  %10 = load i32, i32* %9, align 4</b></div><div><b>  %11 = zext i32 %.0 to i64</b></div><div><b>  %12 = getelementptr inbounds i32, i32* %0, i64 %11</b></div><div><b>  store i32 %10, i32* %12, align 4</b></div><div><b>  br label %13</b></div><div><b><br></b></div><div><b>; <label>:13:                                     ; preds = %7</b></div><div><b>  %14 = add i32 %.0, 1</b></div><div><b>  br label %4</b></div><div><b><br></b></div><div><b>; <label>:15:                                     ; preds = %4</b></div><div><b>  ret void</b></div><div><b>}</b></div></div><div><b><br></b></div><div>Can you please check whether the anti dependeces that you get are loop-carried or loop-independent?</div></div><div><br></div><div>Thanks,</div><div> - Stan</div></div><div class="m_8791772062117491167HOEnZb"><div class="m_8791772062117491167h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 21, 2017 at 7:21 PM, Philip Pfaffe <span dir="ltr"><<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Stan,<div><br></div><div>can you share your example.bc? Can you reproduce your issue with llvm 4.0 or, better even, trunk?</div><div><br></div><div>Cheers,</div><div>Philip</div></div><div class="m_8791772062117491167m_-7629527661078298636HOEnZb"><div class="m_8791772062117491167m_-7629527661078298636h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-06-21 18:58 GMT+02:00 Stanislav Manilov <span dir="ltr"><<a href="mailto:stanislav.manilov@gmail.com" target="_blank">stanislav.manilov@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Philip,<div><br></div><div>Thanks for checking!</div><div><br></div><div>I'm running my own Foo pass that registers DependenceAnalysisWrapperPass as a prerequisite and then I run it like so:<br><br></div><div>opt -load libfoo.so -foo example.bc</div><div><br></div><div>This is LLVM 3.9.</div><div><br></div><div>Cheers,</div><div> - Stan</div></div><div class="m_8791772062117491167m_-7629527661078298636m_600119163955494075HOEnZb"><div class="m_8791772062117491167m_-7629527661078298636m_600119163955494075h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 21, 2017 at 5:40 PM, Philip Pfaffe <span dir="ltr"><<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Stan,<div><br></div><div>in both cases I get a consistent anti result. Can you show us the command lines you're using? Which version of llvm is this?</div><div><br></div><div>Best,</div><div>Philip</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_8791772062117491167m_-7629527661078298636m_600119163955494075m_-7263651065682540101h5">2017-06-21 17:56 GMT+02:00 Stanislav Manilov via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_8791772062117491167m_-7629527661078298636m_600119163955494075m_-7263651065682540101h5"><div dir="ltr">Hello llvm-dev,<div><br></div><div>I'm running a pass that uses the result of llvm::DependenceAnalysisWrappe<wbr>rPass 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>
<br></div></div>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>