<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 - 'Assertion `L->isRecursivelyLCSSAForm(*DT, *LI) && "Indvars did not preserve LCSSA!"' failed.' with -indvars"
   href="https://bugs.llvm.org/show_bug.cgi?id=38674">38674</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>'Assertion `L->isRecursivelyLCSSAForm(*DT, *LI) && "Indvars did not preserve LCSSA!"' failed.' with -indvars
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>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>mikael.holmen@ericsson.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=20758" name="attach_20758" title="reproducer">attachment 20758</a> <a href="attachment.cgi?id=20758&action=edit" title="reproducer">[details]</a></span>
reproducer

opt -S -o - bbi-16913.ll -indvars

crashes with

opt: ../lib/Transforms/Scalar/IndVarSimplify.cpp:2519: bool (anonymous
namespace)::IndVarSimplify::run(llvm::Loop *): Assertion
`L->isRecursivelyLCSSAForm(*DT, *LI) && "Indvars did not preserve LCSSA!"'
failed.

The function looks like this when the assertion fails

define i32 @f1() {
entry:
   br label %for.cond1.preheader

for.cond1.preheader:                              ; preds = %for.end9, 
%entry
   br label %for.cond4.preheader

for.cond4.preheader:                              ; preds = %for.end, 
%for.cond1.preheader
   %zext = zext i16 1 to i32
   br label %for.body6

for.cond4:                                        ; preds = %for.body6
   %cmp5 = icmp ult i32 %inc, 2
   br i1 %cmp5, label %for.body6, label %for.end

for.body6:                                        ; preds = %for.cond4, 
%for.cond4.preheader
   %storemerge26 = phi i32 [ 0, %for.cond4.preheader ], [ %inc, %for.cond4 ]
   %0 = icmp eq i32 %storemerge26, %zext
   %inc = add nuw nsw i32 %storemerge26, 1
   br i1 %0, label %return.loopexit, label %for.cond4

for.end:                                          ; preds = %for.cond4
   br i1 false, label %for.cond4.preheader, label %for.end9

for.end9:                                         ; preds = %for.end
   br i1 false, label %for.cond1.preheader, label %return.loopexit3

return.loopexit:                                  ; preds = %for.body6
   unreachable

return.loopexit3:                                 ; preds = %for.end9
   %inc11.lcssa = phi i32 [ %zext, %for.end9 ]
   br label %return

return:                                           ; preds = 
%return.loopexit3
   ret i32 %inc11.lcssa
}

This started happening with r335020.</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>