<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 12, 2014 at 4:45 PM, Arnold Schwaighofer <span dir="ltr"><<a href="mailto:aschwaighofer@apple.com" target="_blank">aschwaighofer@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":2q3" class="a3s" style="overflow:hidden">The loop vectorizer relies on scev’s nowrap flags. We need to improve SCEV for this.<br>

<br>
  %conv = sext i32 %k to i64<br>
  -->  (sext i32 %k to i64)<br>
  %i.06 = phi i64 [ 0, %entry ], [ %inc, %for.body ]<br>
  -->  {0,+,1}<nuw><nsw><%for.body>             Exits: 1023<br>
  %mul1 = mul nsw i64 %i.06, 7<br>
  -->  {0,+,7}<%for.body>               Exits: 7161<br>
  %arrayidx2 = getelementptr inbounds i32* %A, i64 %mul1<br>
  -->  {%A,+,28}<%for.body>           <== we want to see a nw flag here.<br>
<br>
<br>
Scev sometimes drops new flags for safety (cannonicalization can make them invalid if the same expression is used in different contexts) . See past discussions on this.</div></blockquote></div><br>Sure, but I think its really important to clarify that the *example* is fine, and there is nothing fundamental about it that prevents vectorization.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">We simply need to fix SCEV.</div></div>