<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 - Hang when compiling massive switch with -Os"
   href="https://bugs.llvm.org/show_bug.cgi?id=43468">43468</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Hang when compiling massive switch with -Os
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>alonzakai@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22580" name="attach_22580" title="testcase">attachment 22580</a> <a href="attachment.cgi?id=22580&action=edit" title="testcase">[details]</a></span>
testcase

The attached testcase is a machine-generated massive switch. When building with
-Os, it used to take around a minute (for comparison, similar to gcc). On
recent trunk, though (last day or so), it appears to hang forever, taking over
an hour before our CI gives up.

This is specific to -Os, as -O1 and others seem fine (takes a minute like
always).

STR:

  clang -Os src.cpp

Trying to investigate this, I ran

  clang -Os src.cpp -mllvm -print-before-all 2>&1 | grep IR

The logging ends with

*** IR Dump Before Interleaved Access Pass ***
*** IR Dump Before Expand indirectbr instructions ***
*** IR Dump Before CodeGen Prepare ***
*** IR Dump Before Rewrite Symbols ***
*** IR Dump Before Exception handling preparation ***
*** IR Dump Before Safe Stack instrumentation pass ***
*** IR Dump Before Module Verifier ***

So it appears to hang in the Module Verifier?

Note that this testcase looks very artificial, but it is in our test suite
(emscripten) because a real-world user had similar code that in the past hit
some other bug, so we added this as a regression test.</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>