<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 --- - SCEV hangs when creating SCEVs for a long chain of add/mul instructions"
   href="https://llvm.org/bugs/show_bug.cgi?id=28830">28830</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SCEV hangs when creating SCEVs for a long chain of add/mul instructions
          </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>All
          </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>Global Analyses
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>li1.huang@intel.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>The following code causes SCEV to hang due to endless multiplication expanding
in getMulExpr (ScalarEvolution.cpp), when compiled with clang –S –O2. 

int get(unsigned n)
{
    unsigned i, j, mult = 1;
    for (i = 0; i < 1; i++) {
        for (j = 0; j < 30; j++) {
            mult *= n++;
        }
    }
    return mult;
}

At some point the inner loop is completed unrolled (by 30) to a long chain of
“add” and “mult” instructions, then indvars follows loop-unroll and triggers
SCEV creations for this long instruction chain. If I change the trip count of
inner loop to 15, then it could finish the work after a short delay, but the
time it spends on creating SCEV seems to grow exponentially.</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>