<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 - new PM/SimpleLoopUnswitch 11% regression from old PM/LoopUnswitch"
   href="https://bugs.llvm.org/show_bug.cgi?id=37420">37420</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>new PM/SimpleLoopUnswitch 11% regression from old PM/LoopUnswitch
          </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>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>brzycki@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20293" name="attach_20293" title="reduced C++ test-case">attachment 20293</a> <a href="attachment.cgi?id=20293&action=edit" title="reduced C++ test-case">[details]</a></span>
reduced C++ test-case

The new pass manager (-fexperimental-new-pass-manager) is showing an 11%
regression on a proprietary benchmark on Aarch64 (around 6% on x86_64).  Upon
further analysis the core of the problem is the SimpleLoopUnswitch code does
not catch a case the original LoopUnswitch code does. This check is very hot
and without this optiomization another ~40M instructions are executed inside
the hot region.

Attached is the reduced test-case (reduced.cpp).  To compile simply use:

good:
clang++ -O3 -emit-llvm -S reduced.cpp -o reduced_good.ll

bad:
clang++ -O3 -fexperimental-new-pass-manager -emit-llvm -S reduced.cpp -o
reduced_bad.ll

The successful case will have:

for.body.i.i.i.us:
...
  br i1 %cmp.i.i.i68.us, label %for.body.i.i.i.us, label
%_ZNK2JJ2paERK2EE.exit.loopexit.i

for.body.i.i.i:  
...
br i1 %cmp.i.i.i68, label %for.body.i.i.i, label
%_ZNK2JJ2paERK2EE.exit.loopexit.i</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>