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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] "ShuffleOp::fold" crashed with assertion failure "cast<Ty>() argument of incompatible type!"
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    MLIR built at commit 585cbe3f
Reproduced with:  
`mlir-opt -sccp temp.mlir`

temp.mlir:
``` milr 
module { 
  func.func @func2(){
    %true = arith.constant true
 %cst_5 = arith.constant 1.787000e+03 : f16 
    %22 = vector.broadcast %true : i1 to vector<10x7xi1>
    %85 = vector.extract %22[1] : vector<10x7xi1>
    %91 = vector.shuffle %85, %85 [0, 2, 4, 5, 8, 9, 12, 13] : vector<7xi1>, vector<7xi1> 
    return 
  }
}

```
 
trace:
```console
Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h, line 572.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: mlir-opt -sccp temp.mlir
 #0 0x0000000102cc0f18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/workspace/build/bin/mlir-opt+0x1002f8f18)
 #1 0x0000000102cbf1b4 llvm::sys::RunSignalHandlers() (/workspace/build/bin/mlir-opt+0x1002f71b4)
 #2 0x0000000102cc15c4 SignalHandler(int) (/workspace/build/bin/mlir-opt+0x1002f95c4)
 #3 0x00000001be7894c4 (/usr/lib/system/libsystem_platform.dylib+0x1803414c4)
 #4 0x00000001be771ee0 (/usr/lib/system/libsystem_pthread.dylib+0x180329ee0)
 #5 0x00000001be6ac340 (/usr/lib/system/libsystem_c.dylib+0x180264340)
 #6 0x00000001be6ab754 (/usr/lib/system/libsystem_c.dylib+0x180263754)
 #7 0x0000000107099e80 mlir::vector::ShuffleOp::fold(mlir::vector::ShuffleOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (.cold.31) (/workspace/build/bin/mlir-opt+0x1046d1e80)
 #8 0x0000000104964688 mlir::vector::ShuffleOp::fold(mlir::vector::ShuffleOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (/workspace/build/bin/mlir-opt+0x101f9c688)
 #9 0x00000001049f5c48 mlir::LogicalResult mlir::Op<mlir::vector::ShuffleOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::VectorType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::NOperands<2u>::Impl, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait, mlir::InferTypeOpInterface::Trait, mlir::OpTrait::InferTypeOpAdaptor>::foldSingleResultHook<mlir::vector::ShuffleOp>(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/workspace/build/bin/mlir-opt+0x10202dc48)
#10 0x00000001049f4930 mlir::RegisteredOperationName::Model<mlir::vector::ShuffleOp>::foldHook(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/workspace/build/bin/mlir-opt+0x10202c930)
#11 0x000000010546bfc8 mlir::Operation::fold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/workspace/build/bin/mlir-opt+0x102aa3fc8)
#12 0x00000001052f564c mlir::dataflow::SparseConstantPropagation::visitOperation(mlir::Operation*, llvm::ArrayRef<mlir::dataflow::Lattice<mlir::dataflow::ConstantValue> const*>, llvm::ArrayRef<mlir::dataflow::Lattice<mlir::dataflow::ConstantValue>*>) (/workspace/build/bin/mlir-opt+0x10292d64c)
#13 0x00000001052ffc98 mlir::dataflow::AbstractSparseDataFlowAnalysis::visitOperation(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x102937c98)
#14 0x00000001052ff734 mlir::dataflow::AbstractSparseDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x102937734)
#15 0x00000001052ff7ec mlir::dataflow::AbstractSparseDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x1029377ec)
#16 0x00000001052ff7ec mlir::dataflow::AbstractSparseDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x1029377ec)
#17 0x00000001052d58e8 mlir::DataFlowSolver::initializeAndRun(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x10290d8e8)
#18 0x0000000105340188 (anonymous namespace)::SCCP::runOnOperation() (/workspace/build/bin/mlir-opt+0x102978188)
#19 0x00000001053102a8 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/build/bin/mlir-opt+0x1029482a8)
#20 0x0000000105310998 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/build/bin/mlir-opt+0x102948998)
#21 0x000000010531282c mlir::PassManager::run(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x10294a82c)
#22 0x000000010530ad14 performActions(llvm::raw_ostream&, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x102942d14)
#23 0x000000010530a368 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_1>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) (/workspace/build/bin/mlir-opt+0x102942368)
#24 0x000000010538834c mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/workspace/build/bin/mlir-opt+0x1029c034c)
#25 0x0000000105304d1c mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x10293cd1c)
#26 0x000000010530518c mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/workspace/build/bin/mlir-opt+0x10293d18c)
#27 0x00000001029cb510 main (/workspace/build/bin/mlir-opt+0x100003510)
#28 0x000000010e1ed088 

``` 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWl9z46oV_zTkhVkPAkmWHvLgOElvZjY3mWRnH_qSQYBsughUQEncT99Bkh3h_Pfdttvd2ZFtdDjnd_5ygFDn5EoLcQyyE5CdHtHOr409XhqlTGus7xw6qgzfHF9-vbiBVSeVh9RDZppGepgVGasEqQE6BWhxI1preMcEhw_SrwFZQDi8ATlqlLRfTOvhF8dYC71o2lkYAzkaafrn0zhZ7OYO_2EjlR0ZNoZ3SkAwPxkHIKw7zWbhAUGKwicGuAC4BPOTLQmEAGfedgICcgqplX49Y0Y7T7WHYXwkBDhjzt9lL5Els3kxRwgJgE8QgUHJOslhJALj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