<html>
    <head>
      <base href="https://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 --- - SLP vectorizer is highly dependent on the operand order"
   href="https://llvm.org/bugs/show_bug.cgi?id=27632">27632</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SLP vectorizer is highly dependent on the operand order
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Keywords</th>
          <td>googler, performance
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>danielcdh@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16302" name="attach_16302" title="loads that cannot be vectorized">attachment 16302</a> <a href="attachment.cgi?id=16302&action=edit" title="loads that cannot be vectorized">[details]</a></span>
loads that cannot be vectorized

In the attached IR, the only difference between 1.ll and 2.ll is the order of
the add opeands, e.g.

33c33
<   %24 = add nsw i32 %23, %15
---
<span class="quote">>   %24 = add nsw i32 %15, %23</span >

However, this will lead to SLPVectorizer being unable to vectorize the basic
block.

#opt -slp-vectorizer 1.ll -S |grep load
  %9 = load i8, i8* %.08.i, align 1
  %10 = load i8, i8* %.036.i, align 1
  %12 = load i8, i8* %11, align 1
  %14 = load i8, i8* %13, align 1
  %16 = load i8, i8* %15, align 1
  %18 = load i8, i8* %17, align 1
  %20 = load i8, i8* %19, align 1
  %22 = load i8, i8* %21, align 1
  %24 = load i8, i8* %23, align 1
  %26 = load i8, i8* %25, align 1
  %28 = load i8, i8* %27, align 1
  %30 = load i8, i8* %29, align 1
  %32 = load i8, i8* %31, align 1
  %34 = load i8, i8* %33, align 1
  %36 = load i8, i8* %35, align 1
  %47 = load i8, i8* %46, align 1

#opt -slp-vectorizer x.ll -S |grep load
  %23 = load <8 x i8>, <8 x i8>* %22, align 1
  %27 = load <8 x i8>, <8 x i8>* %26, align 1

This is because when building the vectorization tree, it uses post-order to
traverse the reduction operations, and visits its children in the order of its
index. So if the index of the operand change, load will need to be processed in
reverse-order, thus cannot be vectorized.

Note that the operand could be any order after reassociation pass. Thus it
important that SLPVectorizer can handle any operand order.</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>