llvm-project
llvm-project copied to clipboard
[mlir](test-legalize-type-conversion) mlir-opt crashes at STLExtras.h:309 with assertion `hasSingleElement(C) && "expected container with single element"' failed.
git version: 42f2cd0c980cc1a924619ecaeaa51ca7b55164ab
MLIR Program:
module {
func.func @m1() -> vector<16x16xi1> {
%cst = arith.constant dense<false> : vector<16x16xi1>
%cst_0 = arith.constant dense<true> : vector<8x8xi1>
%0 = vector.insert_strided_slice %cst_0, %cst offsets = [0, 0], strides = [1, 1] : vector<8x8xi1> into vector<16x16xi1>
return %0 : vector<16x16xi1>
}
func.func @m2(%arg0: i32) -> i32 {
%0 = "llvm.intr.ctlz"(%arg0) <{is_zero_poison = false}> : (i32) -> i32
%c0_i32 = arith.constant 0 : i32
%c1_i32 = arith.constant 1 : i32
%1 = scf.for %arg1 = %arg0 to %arg0 step %arg0 iter_args(%arg2 = %c0_i32) -> (i32) : i32 {
%2 = arith.addi %arg1, %c1_i32 : i32
%3 = arith.addi %arg2, %2 : i32
scf.yield %3 : i32
}
return %0 : i32
}
}
Reproduce Command: mlir-opt '-test-legalize-type-conversion' a.mlir
StackTrace:
mlir-opt: /data2/dependency/dev/llvm-project/llvm/include/llvm/ADT/STLExtras.h:309: decltype(auto) llvm::getSingleElement(ContainerTy&&) [with ContainerTy = const mlir::ValueRange]: Assertion `hasSingleElement(C) && "expected container with single element"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: mlir-opt -test-legalize-type-conversion a.mlir
#0 0x0000562e60947aff llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20adaff)
#1 0x0000562e6094465c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20aa65c)
#2 0x0000562e60944803 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fcf74cc8420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fcf747b300b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fcf74792859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007fcf74792729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007fcf747a3fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000562e618569f1 decltype(auto) llvm::getSingleElement<mlir::ValueRange const>(mlir::ValueRange const&&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2fbc9f1)
#9 0x0000562e67c24c87 (anonymous namespace)::Structural1ToNConversionPattern<mlir::scf::ForOp, (anonymous namespace)::ConvertForOpTypes>::matchAndRewrite(mlir::scf::ForOp, mlir::scf::ForOpGenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) const StructuralTypeConversions.cpp:0:0
#10 0x0000562e62978f5c mlir::OpConversionPattern<mlir::scf::ForOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x40def5c)
#11 0x0000562e69dd6e08 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb53ce08)
#12 0x0000562e69e1e5c2 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#13 0x0000562e69e1fb4b mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb585b4b)
#14 0x0000562e69dd1c4b (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#15 0x0000562e69dd2136 mlir::OperationConverter::convert(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb538136)
#16 0x0000562e69ddcb1a mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb542b1a)
#17 0x0000562e69dde368 applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#18 0x0000562e69dde546 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb544546)
#19 0x0000562e60b7eda6 (anonymous namespace)::TestTypeConversionDriver::runOnOperation() TestPatterns.cpp:0:0
#20 0x0000562e69e89f81 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5eff81)
#21 0x0000562e69e8a310 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f0310)
#22 0x0000562e69e8c3c4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f23c4)
#23 0x0000562e69e8d491 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f3491)
#24 0x0000562e60a0df7b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#25 0x0000562e60a0eabf processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#26 0x0000562e60a0eceb llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#27 0x0000562e6a271e55 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb9d7e55)
#28 0x0000562e60a04d34 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#29 0x0000562e60a0f207 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2175207)
#30 0x0000562e60a0f443 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2175443)
#31 0x0000562e608ae9e7 main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20149e7)
#32 0x00007fcf74794083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x0000562e6092448e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x208a48e)
Aborted (core dumped)
@llvm/issue-subscribers-mlir
Author: Aran-414
git version: 42f2cd0c980cc1a924619ecaeaa51ca7b55164ab
MLIR Program:
module {
func.func @<!-- -->m1() -> vector<16x16xi1> {
%cst = arith.constant dense<false> : vector<16x16xi1>
%cst_0 = arith.constant dense<true> : vector<8x8xi1>
%0 = vector.insert_strided_slice %cst_0, %cst offsets = [0, 0], strides = [1, 1] : vector<8x8xi1> into vector<16x16xi1>
return %0 : vector<16x16xi1>
}
func.func @<!-- -->m2(%arg0: i32) -> i32 {
%0 = "llvm.intr.ctlz"(%arg0) <{is_zero_poison = false}> : (i32) -> i32
%c0_i32 = arith.constant 0 : i32
%c1_i32 = arith.constant 1 : i32
%1 = scf.for %arg1 = %arg0 to %arg0 step %arg0 iter_args(%arg2 = %c0_i32) -> (i32) : i32 {
%2 = arith.addi %arg1, %c1_i32 : i32
%3 = arith.addi %arg2, %2 : i32
scf.yield %3 : i32
}
return %0 : i32
}
}
Reproduce Command: mlir-opt '-test-legalize-type-conversion' a.mlir
StackTrace:
mlir-opt: /data2/dependency/dev/llvm-project/llvm/include/llvm/ADT/STLExtras.h:309: decltype(auto) llvm::getSingleElement(ContainerTy&&) [with ContainerTy = const mlir::ValueRange]: Assertion `hasSingleElement(C) && "expected container with single element"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: mlir-opt -test-legalize-type-conversion a.mlir
#<!-- -->0 0x0000562e60947aff llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20adaff)
#<!-- -->1 0x0000562e6094465c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20aa65c)
#<!-- -->2 0x0000562e60944803 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#<!-- -->3 0x00007fcf74cc8420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#<!-- -->4 0x00007fcf747b300b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#<!-- -->5 0x00007fcf74792859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#<!-- -->6 0x00007fcf74792729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#<!-- -->7 0x00007fcf747a3fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#<!-- -->8 0x0000562e618569f1 decltype(auto) llvm::getSingleElement<mlir::ValueRange const>(mlir::ValueRange const&&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2fbc9f1)
#<!-- -->9 0x0000562e67c24c87 (anonymous namespace)::Structural1ToNConversionPattern<mlir::scf::ForOp, (anonymous namespace)::ConvertForOpTypes>::matchAndRewrite(mlir::scf::ForOp, mlir::scf::ForOpGenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) const StructuralTypeConversions.cpp:0:0
#<!-- -->10 0x0000562e62978f5c mlir::OpConversionPattern<mlir::scf::ForOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x40def5c)
#<!-- -->11 0x0000562e69dd6e08 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb53ce08)
#<!-- -->12 0x0000562e69e1e5c2 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#<!-- -->13 0x0000562e69e1fb4b mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb585b4b)
#<!-- -->14 0x0000562e69dd1c4b (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#<!-- -->15 0x0000562e69dd2136 mlir::OperationConverter::convert(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb538136)
#<!-- -->16 0x0000562e69ddcb1a mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb542b1a)
#<!-- -->17 0x0000562e69dde368 applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#<!-- -->18 0x0000562e69dde546 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb544546)
#<!-- -->19 0x0000562e60b7eda6 (anonymous namespace)::TestTypeConversionDriver::runOnOperation() TestPatterns.cpp:0:0
#<!-- -->20 0x0000562e69e89f81 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5eff81)
#<!-- -->21 0x0000562e69e8a310 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f0310)
#<!-- -->22 0x0000562e69e8c3c4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f23c4)
#<!-- -->23 0x0000562e69e8d491 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f3491)
#<!-- -->24 0x0000562e60a0df7b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#<!-- -->25 0x0000562e60a0eabf processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#<!-- -->26 0x0000562e60a0eceb llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#<!-- -->27 0x0000562e6a271e55 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb9d7e55)
#<!-- -->28 0x0000562e60a04d34 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#<!-- -->29 0x0000562e60a0f207 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2175207)
#<!-- -->30 0x0000562e60a0f443 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2175443)
#<!-- -->31 0x0000562e608ae9e7 main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20149e7)
#<!-- -->32 0x00007fcf74794083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#<!-- -->33 0x0000562e6092448e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x208a48e)
Aborted (core dumped)
I'd like to work on this.