<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 --- - After r288115: Assertion failed: (isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not loop-invariant!"), function getAddRecExpr, file lib/Analysis/ScalarEvolution.cpp, line 2963."
   href="https://llvm.org/bugs/show_bug.cgi?id=31847">31847</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>After r288115: Assertion failed: (isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not loop-invariant!"), function getAddRecExpr, file lib/Analysis/ScalarEvolution.cpp, line 2963.
          </td>
        </tr>

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

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

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.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>From <a href="https://bugs.freebsd.org/216718">https://bugs.freebsd.org/216718</a>, building ffmpeg targeting Haswell or
higher results in an assertion:

Assertion failed: (isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand
is not loop-invariant!"), function getAddRecExpr, file
lib/Analysis/ScalarEvolution.cpp, line 2963.

This still happens with trunk r293557.  Bisection shows that this started
appearing after r288115:
------------------------------------------------------------------------
r288115 | abataev | 2016-11-29 09:21:14 +0100 (Tue, 29 Nov 2016) | 8 lines

[SLPVectorizer] Improved support of partial tree vectorization.

Currently SLP vectorizer tries to vectorize a binary operation and dies
immediately after unsuccessful the first unsuccessfull attempt. Patch
tries to improve the situation, trying to vectorize all binary
operations of all children nodes in the binop tree.

Differential Revision: <a href="https://reviews.llvm.org/D25517">https://reviews.llvm.org/D25517</a>
------------------------------------------------------------------------

Reduced test case:
------------------------------------------------------------------------
/* clang -cc1 -triple i386 -S -target-cpu haswell -O2 -w -vectorize-loops
-vectorize-slp testcase.c */
typedef struct {
  int ncomp;
  int shift_w[]
} WaveformContext;
a, b, e, f, g;
*c;
WaveformContext d;
char *h;
fn1() {
  int i;
  unsigned char *j = 1, *k = 1;
  for (;;) {
    int l = (j[b >> d.shift_w[g + 1 % e]] - 128 >= 0
                 ? j[b >> d.shift_w[g + 1 % e]] - 128
                 : -j[b >> d.shift_w[g + 1 % e]]) +
            (k[b >> d.shift_w[g + 2 % e]] - 128 >= 0
                 ? k[b >> d.shift_w[g + 2 % e]] - 128
                 : -k[b >> d.shift_w[g + 2 % e]]);
    c = h - l;
    *c = 0;
    c = h + l;
    if (c)
      *c = 0;
    else
      *c = 1;
    h += 1;
  }
}
------------------------------------------------------------------------</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>