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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] Crash when folding i1 reshape
        </td>
    </tr>

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

    <tr>
      <th>Assignees</th>
      <td>
            lattner
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          d0k
      </td>
    </tr>
</table>

<pre>
    ```
func.func @test() -> tensor<1xi1> {
  %0 = arith.constant dense<true> : tensor<1x1xi1>
  %1 = "tosa.reshape"(%0) {new_shape = [1]} : (tensor<1x1xi1>) -> tensor<1xi1>
  return %1 : tensor<1xi1>
}
```

```
$ mlir-opt -canonicalize reshape.mlir
mlir-opt: mlir/lib/IR/AttributeDetail.h:114: static mlir::detail::DenseIntOrFPElementsAttrStorage::KeyTy mlir::detail::DenseIntOrFPElementsAttrStorage::getKey(mlir::ShapedType, ArrayRef<char>, bool): Assertion `numElements != 1 && "splat of 1 element should already be detected"' failed.
```

This is a regression introduced by f21896f2c6dc6f4c2c3d0f192f7fefd178f5d5f7
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVE2P2yAQ_TX2BcUy2I6dgw_ZeFda9dBqd-8VhsGmJRAB7jb99R2cRLuVur1UGhEMb958vCGjk-c-25ZXK4es3KvFiiItJKvLCCFmrMvYjmyy6p5EsMH5rDrQn5qmg6y9u7gRkrGmJFk1EO51nAvhbIjcRiLRB9Al-gVWl2r_nufK9I6FriwZY9EFXngIMz8Bfq6JNGVKBsNaeP263lzQzR3NmiFrh5UfoX8J8VEVt9ge4uLtLYX9BziMcd382bi_H7KaHI32G3eKZCO4dVYLbvQvINfCinR9Ad-AKfZ6yh6MHnF9fMJlH6PX4xJhgMi1KWaEUVonMDY6anHxqfZocoVc9kPq_6ONn_3Dl3sDR7AxJK7n6Dyf4AL6BOeX8_8QTBCRA_v-xvGcypMv5yTegey95-cnUNhOMXO_6nEgo3MGdUlF7EMAH7VDAbalXY63UKgHTRKjJmyLliYjnAyPxCk8hAuMhNktRhJuPHB5JiPg4EUQEeQ6Oi1RWBDI4h_avcw6EDSO2kwoT0jJaBu9k4sAScYzUYx2u61iYivFVtWCiUqWiu6YahUoSdtONbJRbS77Su6qHc-jjgZ6nM-1Mc1ADp6HmbzOYIlyRmo7EU1v05Av3vRzjKeQesge0CZ8TcuI7-mY5sH8uP1sTt59wwLxU4ewQMBN09R1mc891G3DBXSdUE1NQVUjU1UFoqPbbuRjkxs-ggkpLezOVTLh_PrMmiHXPSsZKxta0bZiVVe0XQO1BFmPYkehqvG_AY5pClMmhfNT7vs1qXGZAl4aHWJ4u-TYy8kCXAOieNGCvwbjS5yd72X5PV8L6dcqfgOjSGO8">