<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - LoopVectorizer: Can only vectorize reductions if the external user uses the “last” value in reduction cycle"
   href="http://llvm.org/bugs/show_bug.cgi?id=17498">17498</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LoopVectorizer: Can only vectorize reductions if the external user uses the “last” value in reduction cycle
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>opt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aschwaighofer@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>See the last two examples of PR17473.

for.body3.1:                                      ; preds = %for.body3.1,
%for.inc7                                                                     
  %inc613.1 = phi i32 [ 0, %for.inc7 ], [ %inc6.1, %for.body3.1 ]               
  %inc511.1 = phi i32 [ %inc.1, %for.inc7 ], [ %inc5.1, %for.body3.1 ]          
  %2 = zext i1 %tobool to i32
  %inc4.1 = xor i32 %2, 1                                                       
  %inc511.1.inc4.1 = add nsw i32 %inc511.1, %inc4.1
  %inc5.1 = add nsw i32 %inc511.1.inc4.1, 1                                     
  %inc6.1 = add nsw i32 %inc613.1, 1
  %exitcond.1 = icmp eq i32 %inc6.1, 22
  br i1 %exitcond.1, label %for.inc7.1, label %for.body3.1

for.inc7.1:                                       ; preds = %for.body3.1        
  %inc.2 = add nsw i32 %inc511.1.inc4.1, 2        
  br label %for.body3.2

And where generating this. The problem is that the external user was not using
the “last” value in the reduction. So we would loose 3 "(add 1)”s.

vector.body23:                                    ; preds = %vector.body23,
%for.inc7
  %index26 = phi i32 [ 0, %for.inc7 ], [ %index.next30, %vector.body23 ]        
  %vec.phi34 = phi <4 x i32> [ %7, %for.inc7 ], [ %11, %vector.body23 ]
  %8 = zext <4 x i1> %broadcast.splat36 to <4 x i32>
  %9 = xor <4 x i32> %8, <i32 1, i32 1, i32 1, i32 1>
  %10 = add nsw <4 x i32> %vec.phi34, %9          
  %11 = add nsw <4 x i32> %10, <i32 1, i32 1, i32 1, i32 1>
  %index.next30 = add i32 %index26, 4
  %12 = icmp eq i32 %index.next30, 20
  br i1 %12, label %middle.block24, label %vector.body23

middle.block24:                                   ; preds = %vector.body23
  %rdx.shuf38 = shufflevector <4 x i32> %10, <4 x i32> undef, <4 x i32> <i32 2,
i32 3, i32 undef, i32 undef></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>