<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 - Failure to reduce indvarsimplify modulo loop output to a simple AND mask"
   href="https://bugs.llvm.org/show_bug.cgi?id=40878">40878</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Failure to reduce indvarsimplify modulo loop output to a simple AND mask
          </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>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>greened@obbligato.org, lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>38280
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Pulled out of [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Pointless loop unroll / vectorization"
   href="show_bug.cgi?id=38280#c1">Bug #38280 Comment #1</a>]:

<span class="quote">> On a perhaps related note, the very simple example
> (<a href="https://godbolt.org/g/MToVLm">https://godbolt.org/g/MToVLm</a>):
> unsigned func(unsigned count)
> {
>     while (count >= 32)
>         count -= 32;
>     return count;
> }

> Currently produces something like (thanks to indvarsimplify):

> define i32 @test(i32 %size) {
> entry:
>   %0 = xor i32 %size, -1
>   %1 = icmp ugt i32 %0, -32
>   %umax = select i1 %1, i32 %0, i32 -32
>   %2 = add i32 %umax, %size
>   %3 = add i32 %2, 32
>   %4 = and i32 %3, -32
>   %5 = sub i32 %size, %4
>   ret i32 %5
> }

> Which is really just:
> <a href="https://rise4fun.com/Alive/lKL">https://rise4fun.com/Alive/lKL</a>

> define i32 @test(i32 %size) {
>   %0 = and i32 %size, 31
>   ret i32 %0
> }</span ></pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Pointless loop unroll / vectorization"
   href="https://bugs.llvm.org/show_bug.cgi?id=38280">Bug 38280</a>] Pointless loop unroll / vectorization
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>