<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 produces wrong code with UserVF not dividing small TripCount"
   href="https://bugs.llvm.org/show_bug.cgi?id=45679">45679</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LoopVectorizer produces wrong code with UserVF not dividing small TripCount
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ayal.zaks@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dorit.nuzman@intel.com, florian_hahn@apple.com, gil.rapaport@intel.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23402" name="attach_23402" title="Reproducer">attachment 23402</a> <a href="attachment.cgi?id=23402&action=edit" title="Reproducer">[details]</a></span>
Reproducer

Compiling the attached with

  opt -loop-vectorize -force-vector-width=4 -S

vectorizes a loop with trip-count=14 using VF=4 w/o a tail, explaining that:

LV: Found trip count: 14
LV: Not allowing scalar epilogue due to low trip count.
LV: Performing code size checks.
LV: The Smallest and Widest types: 32 / 32 bits.
LV: The Widest register safe to use is: 32 bits.
LV: No tail will remain for any chosen VF.  <== but LV doesn't get to chose VF
LV: Using user VF 4.


Culprit is computeMaxVF() who checks if TC % MaxVF == 0 where MaxVF =
computeFeasibleMaxVF(TC) (=1 in this case), even if a UserVF is given and
ultimately used.</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>