<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 - JumpThreading can take take several minutes on large functions"
   href="https://bugs.llvm.org/show_bug.cgi?id=37929">37929</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>JumpThreading can take take several minutes on large functions
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vlad@tsyrklevich.net
          </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=20466" name="attach_20466" title="Reproducer">attachment 20466</a> <a href="attachment.cgi?id=20466&action=edit" title="Reproducer">[details]</a></span>
Reproducer

Filing a bug for this:
<a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180625/563662.html">http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180625/563662.html</a>

The attached file (a preprocessed copy of AArch64InstPrinter.cpp) takes 80s to
compile locally with -O3 [1], and 400s with -O3 + UBSan [2].

The vast majority of that time is spent computing dominator trees for the
JumpThreading pass for two auto-generated functions
(AArch64InstPrinter::printAliasInstr and
AArch64AppleInstPrinter::printAliasInstr) where inlining significantly blows up
the number of basic blocks (from ~5k with -O1 to ~25k with -O3 and ~55k for O3
+ UBSan.) Running CFGSimplication before JumpThreading reduces the # of BBs by
~10k and improves the runtime by ~3x, but the compile for -O3 + UBSan still
takes ~2 minutes. I'm not sure if making that change is justified/sound.

[1] time clang -cc1 -triple x86_64-unknown-linux-gnu -O3 -std=c++11 -emit-llvm
-o /dev/null preprocessed.cpp
[2] time clang -cc1 -triple x86_64-unknown-linux-gnu -O3 -std=c++11 -emit-llvm
-o /dev/null preprocessed.cpp
-fsanitize=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,float-divide-by-zero,integer-divide-by-zero,nonnull-attribute,null,object-size,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound</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>