Hi Michael,<br><br>ASCII art beats all :) yes you are right. It should be latch. At the moment the new loop will only ever have a single block, so header == latch. But the code should be updated. Thanks!<br><br>James<br><div class="gmail_quote"><div dir="ltr">On Tue, 1 Sep 2015 at 19:22, Michael Zolotukhin via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">mzolotukhin added inline comments.<br>
<br>
================<br>
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2589<br>
@@ +2588,3 @@<br>
+  Induction->addIncoming(Start, L->getLoopPreheader());<br>
+  Induction->addIncoming(Next, Header);<br>
+  // Create the compare.<br>
----------------<br>
AFAIU, we have a following CFG:<br>
```<br>
(PreHeader)<br>
    |<br>
    |<br>
    v<br>
(Header)<-<br>
    |     |<br>
    |     |<br>
    v     /<br>
(Latch) --<br>
    |<br>
    |<br>
    v<br>
(Exit)<br>
```<br>
(If my graphics isn't rendered well, the edges in CFG are: PreHeader-->Header, Header-->Latch, Latch-->Header, Latch-->Exit)<br>
<br>
Now, we're building `Induction` in `Header`. It is a PHI, and should have two incoming values: one from the preheader (`L->getLoopPreheader`), and one from the latch (but you use `Header` instead).<br>
<br>
Am I wrong somewhere?<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D12474" rel="noreferrer" target="_blank">http://reviews.llvm.org/D12474</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>