<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Exponential output growth introduced in the IndVarsSimplify pass"
   href="https://llvm.org/bugs/show_bug.cgi?id=28166">28166</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Exponential output growth introduced in the IndVarsSimplify pass
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.stenberg@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16565" name="attach_16565" title="Reproducer">attachment 16565</a> <a href="attachment.cgi?id=16565&action=edit" title="Reproducer">[details]</a></span>
Reproducer

When running opt:

  opt -S -Oz -O1 bugpoint-reduced-simplified.ll

with the attached bugpoint-reduced-simplified.ll file, the resulting output
file seems to grow exponentially with the number of loop iterations (40 in the
bugpoint-reduced-simplified.ll), as seen here for N=20, 21, and 22:

  $ du -h out-*
  74M   out-20.ll
  148M  out-21.ll
  295M  out-22.ll

The problem seems to be introduced in the Induction Variable Simplification
pass, where the condition for the br instruction in bb3 grows:

N = 1:
  br i1 icmp sge (i16 ptrtoint (i16* @bar to i16), i16 0),
  label %bb4.preheader, label %bb5

N = 2:
  br i1 icmp sge (i16 xor (i16 zext (i1 icmp sge
  (i16 ptrtoint (i16* @bar to i16), i16 0) to i16),
  i16 ptrtoint (i16* @bar to i16)), i16 zext (i1 icmp sge
  (i16 ptrtoint (i16* @bar to i16), i16 0) to i16)),
  label %bb4.preheader, label %bb5

And so on.

The issue might be related to how the passes are executed, as passing any
combination of the -O[z123] flags triggers the issue. When passing just one of
the flags, the issue is not seen.</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>