<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 - Assertio n `isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not loop-invariant!"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=47776">47776</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertio n `isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not loop-invariant!"' failed.
          </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>Windows NT
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>max.kazantsev@azul.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24038" name="attach_24038" title="test.ll">attachment 24038</a> <a href="attachment.cgi?id=24038&action=edit" title="test.ll">[details]</a></span>
test.ll

Download test.ll, run `opt -loop-reduce -S`. SCEV fails an sssertio
n `isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not
loop-invariant!"' failed.

This happens inside applyLoopGuards function.

The guilty change is:

commit d4ddf63fc40cfbbc348adcc45cdc6f6d78268c5c
Author: Florian Hahn <<a href="mailto:flo@fhahn.com">flo@fhahn.com</a>>
Date:   Thu Sep 24 11:06:55 2020 +0100

    [SCEV] Use loop guard info when computing the max BE taken count in
howFarToZero.

    For some expressions, we can use information from loop guards when
    we are looking for a maximum. This patch applies information from
    loop guards to the expression used to compute the maximum backedge
    taken count in howFarToZero. It currently replaces an unknown
    expression X with UMin(X, Y), if the loop is guarded by
    X ult Y.

    This patch is minimal in what conditions it applies, and there
    are a few TODOs to generalize.

    This partly addresses PR40961. We will also need an update to
    LV to address it completely.

    Reviewed By: reames

    Differential Revision: <a href="https://reviews.llvm.org/D67178">https://reviews.llvm.org/D67178</a></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>