<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 - [SystemZ][NewPM] huge loop expansion with opt -O1"
   href="https://bugs.llvm.org/show_bug.cgi?id=52146">52146</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SystemZ][NewPM] huge loop expansion with opt -O1
          </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>Backend: SystemZ
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jistone@redhat.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=25352" name="attach_25352" title="bitcode from rust#89609">attachment 25352</a> <a href="attachment.cgi?id=25352&action=edit" title="bitcode from rust#89609">[details]</a></span>
bitcode from rust#89609

xref: <a href="https://github.com/rust-lang/rust/issues/89609">https://github.com/rust-lang/rust/issues/89609</a>

After enabling the new pass manager in rustc, one particular crate showed a
large increase in compile time, but only when targeting s390x. I attached the
bitcode from rustc, and I can reproduce the problem with opt -O1 on main.

$ llvm-dis <rustc_ast_lowering-cgu.0.rcgu.thin-lto-after-patch.bc | wc -lL
 157863    2306

$ time opt <rustc_ast_lowering-cgu.0.rcgu.thin-lto-after-patch.bc -O1 -S | wc
-lL
 794414 4515800

real    2m4.580s
user    2m4.675s
sys     0m0.221s

There are two instances of that longest 4.5M line length, and both are huge phi
nodes just before invoking a function ending in 17hde8a472161ebd31bE (so you
can search for that). The predecessors look like a mass of loopexit.split-lp
expansions gone rogue.

The same input behaves reasonably with the old PM, both optimizing faster and
resulting in a smaller bitcode.

$ time opt <rustc_ast_lowering-cgu.0.rcgu.thin-lto-after-patch.bc -O1 -S
--enable-new-pm=0 | wc -lL
 148220    2306

real    0m2.266s
user    0m2.322s
sys     0m0.024s


If you edit out the "target-cpu"="z10" attributes in the IR, this reproducer
can also be forced to -mtriple x86_64, and that runs fine with new PM.</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>