<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 - Jump threading is quadratic on large consecutive swicthes"
   href="https://bugs.llvm.org/show_bug.cgi?id=52374">52374</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Jump threading is quadratic on large consecutive swicthes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>tamas@hudson-trading.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=25410" name="attach_25410" title="Script to generate large example">attachment 25410</a> <a href="attachment.cgi?id=25410&action=edit" title="Script to generate large example">[details]</a></span>
Script to generate large example

struct Message0 { static int id1; static int id2; };
struct Message1 { static int id1; static int id2; };
int* getId(int id) {
  int id1 = 0;
  switch (id) {
    case 0:
      id1 = Message0::id1;
      break;
    case 1:
      id1 = Message1::id1;
      break;
  }
  int* data = new int[1 + id1 % 4];
  switch (id) {
    case 0:
      data[0] = Message0::id2;
      break;
    case 1:
      data[0] = Message1::id2;
      break;
  }
  return data;
}

If I take the above code but instead of having 2 different types of messages I
have 100+ messages then the "Jump threading" pass will become quadratic in the
number of cases when compiling with -O3. With 2000 different messages it takes
over a minute to compile the above file while if I break up the function so
that the two switches are in different functions than it compiles in ~0.5s
(while g++*10 compiles the original file in ~4s).

A larger example can be generated with "python make_cc.py <num_structs>".</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>