<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55873>55873</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            SCCP crashes with simple scf.while
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir:core
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            Mogball,
            River707
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          joker-eph
      </td>
    </tr>
</table>

<pre>
    
```
module {
  func.func @main() -> index {
    %c0 = arith.constant 0 : index
    %c1 = arith.constant 1 : index
    %0 = scf.while (%arg3 = %c0, %arg4 = %c1) : (index, index) -> index {
      %1 = arith.cmpi slt, %arg3, %c1 : index
      scf.condition(%1) %arg3 : index
    } do {
    ^bb0(%arg3: index):
      %1 = arith.addi %arg3, %c1 : index
      scf.yield %1, %c0 : index, index
    }
    return %0 : index
  }
}
```

Run with `mlir-opt   -pass-pipeline="func.func(sccp)"` :

```
assertion failed at mlir/lib/Analysis/DataFlowAnalysis.cpp:608 in void (anonymous namespace)::ForwardDataFlowSolver::visitTerminatorOperation(mlir::Operation *, ArrayRef<mlir::detail::AbstractLatticeElement *>): iterArgs.size() == terminatorArgs.size() && "Number of iteration arguments for region should equal number of " "those arguments defined by terminator"
*** Check failure stack trace: ***
    @     0x563876b93064  __assert_fail
    @     0x56387638b464  (anonymous namespace)::ForwardDataFlowSolver::visitOperation()
    @     0x563876386663  mlir::detail::ForwardDataFlowAnalysisBase::run()

```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVU1zozgQ_TX40mUXFgbsAwfHjk_7VZm9p4TUGM0IxEoiGe-v3xZgnGScqZraKhmE1N3vdfeTXBp5KaL4GMX7KIunMXw2RvYaIcofxm-Aqm_FKjwg2sQNV23EthHbwTJKHkG1Er-_tQaIWCpiiJIjcKt8vRKmdZ63HsLifvR4b72-Z73-xHoM7US1eq1VYBrYpNyek2Fj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