Skip to content

[mlir] Arith Unsigned When Equivalent Pass crashed with Assertion Failure "Bit position out of bounds!" #59617

@Colloportus0

Description

@Colloportus0

MLIR built at commit def915c
Reproduced with:
mlir-opt --arith-unsigned-when-equivalent temp.mlir

temp.mlir:

module {
  func.func @func() { 
    %cst_74 = arith.constant dense<[0]> : vector<1xi32> 
    %204 = arith.cmpi slt, %cst_74, %cst_74 : vector<1xi32> 
    return
  }
} 

trace:

Assertion failed: (bitPosition < getBitWidth() && "Bit position out of bounds!"), function operator[], file APInt.h, line 1014.
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 --arith-unsigned-when-equivalent temp.mlir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  mlir-opt                 0x0000000105029a20 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 72
1  mlir-opt                 0x0000000105029f3c PrintStackTraceSignalHandler(void*) + 28
2  mlir-opt                 0x0000000105027fc0 llvm::sys::RunSignalHandlers() + 148
3  mlir-opt                 0x000000010502bba8 SignalHandler(int) + 252
4  libsystem_platform.dylib 0x000000018e5094c4 _sigtramp + 56
5  libsystem_pthread.dylib  0x000000018e4f1ee0 pthread_kill + 288
6  libsystem_c.dylib        0x000000018e42c340 abort + 168
7  libsystem_c.dylib        0x000000018e42b754 err + 0
8  mlir-opt                 0x0000000106a23f98 llvm::APInt::operator[](unsigned int) const + 120
9  mlir-opt                 0x00000001069e09a8 llvm::APInt::isNegative() const + 32
10 mlir-opt                 0x00000001069434f0 llvm::APInt::isNonNegative() const + 24
11 mlir-opt                 0x000000010546d5bc staticallyNonNegative(mlir::DataFlowSolver&, mlir::Value) + 124
12 mlir-opt                 0x000000010546f6d0 isCmpIConvertable(mlir::DataFlowSolver&, mlir::arith::CmpIOp)::$_1::operator()(mlir::Value) const + 44
13 mlir-opt                 0x000000010546f650 bool std::__1::all_of<llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator, isCmpIConvertable(mlir::DataFlowSolver&, mlir::arith::CmpIOp)::$_1>(llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator, llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator, isCmpIConvertable(mlir::DataFlowSolver&, mlir::arith::CmpIOp)::$_1) + 80
14 mlir-opt                 0x000000010546f5b8 bool llvm::all_of<mlir::OperandRange, isCmpIConvertable(mlir::DataFlowSolver&, mlir::arith::CmpIOp)::$_1>(mlir::OperandRange&&, isCmpIConvertable(mlir::DataFlowSolver&, mlir::arith::CmpIOp)::$_1) + 84
15 mlir-opt                 0x000000010546f530 isCmpIConvertable(mlir::DataFlowSolver&, mlir::arith::CmpIOp) + 96
16 mlir-opt                 0x000000010546f49c (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)::operator()(mlir::arith::CmpIOp) const + 44
17 mlir-opt                 0x000000010546f45c std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*)::operator()(mlir::Operation*) const + 56
18 mlir-opt                 0x000000010546f3fc decltype(static_cast<std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*)&>(fp)(static_cast<mlir::Operation*>(fp0))) std::__1::__invoke<std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*)&, mlir::Operation*>(std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*)&, mlir::Operation*&&) + 36
19 mlir-opt                 0x000000010546f3a0 std::__1::optional<bool> std::__1::__invoke_void_return_wrapper<std::__1::optional<bool>, false>::__call<std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*)&, mlir::Operation*>(std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*)&, mlir::Operation*&&) + 52
20 mlir-opt                 0x000000010546f358 std::__1::__function::__alloc_func<std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*), std::__1::allocator<std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*)>, std::__1::optional<bool> (mlir::Operation*)>::operator()(mlir::Operation*&&) + 52
21 mlir-opt                 0x000000010546dfb0 std::__1::__function::__func<std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*), std::__1::allocator<std::__1::enable_if<!std::is_invocable_v<(anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<mlir::arith::CmpIOp, (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)>((anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation()::'lambda'(mlir::arith::CmpIOp)&&)::'lambda'(mlir::Operation*)>, std::__1::optional<bool> (mlir::Operation*)>::operator()(mlir::Operation*&&) + 52
22 mlir-opt                 0x00000001090ec230 std::__1::__function::__value_func<std::__1::optional<bool> (mlir::Operation*)>::operator()(mlir::Operation*&&) const + 84
23 mlir-opt                 0x00000001090a8b30 std::__1::function<std::__1::optional<bool> (mlir::Operation*)>::operator()(mlir::Operation*) const + 48
24 mlir-opt                 0x00000001090a8824 mlir::ConversionTarget::isLegal(mlir::Operation*) const::$_12::operator()() const + 80
25 mlir-opt                 0x00000001090a866c mlir::ConversionTarget::isLegal(mlir::Operation*) const + 152
26 mlir-opt                 0x00000001090a4650 computeConversionSet(llvm::iterator_range<llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, true, false, void>, false, false>>, mlir::Location, llvm::SmallVectorImpl<mlir::Operation*>&, mlir::ConversionTarget*) + 320
27 mlir-opt                 0x00000001090a4714 computeConversionSet(llvm::iterator_range<llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, true, false, void>, false, false>>, mlir::Location, llvm::SmallVectorImpl<mlir::Operation*>&, mlir::ConversionTarget*) + 516
28 mlir-opt                 0x00000001090aa374 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) + 336
29 mlir-opt                 0x00000001090aa18c mlir::applyPartialConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) + 124
30 mlir-opt                 0x00000001090aa680 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) + 72
31 mlir-opt                 0x0000000105467574 (anonymous namespace)::ArithUnsignedWhenEquivalentPass::runOnOperation() + 364
32 mlir-opt                 0x0000000108f65400 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 512
33 mlir-opt                 0x0000000108f65b04 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 364
34 mlir-opt                 0x0000000108f67e24 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) + 108
35 mlir-opt                 0x0000000108f67bd4 mlir::PassManager::run(mlir::Operation*) + 864
36 mlir-opt                 0x0000000108f4b3c8 performActions(llvm::raw_ostream&, bool, bool, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) + 560
37 mlir-opt                 0x0000000108f4af18 processBuffer(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) + 524
38 mlir-opt                 0x0000000108f4acc4 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::$_0::operator()(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const + 204
39 mlir-opt                 0x0000000108f4abd8 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>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::$_0>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) + 80
40 mlir-opt                 0x000000010915e0f0 llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::operator()(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const + 96
41 mlir-opt                 0x000000010915dbd4 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) + 128
42 mlir-opt                 0x0000000108f48618 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool) + 320
43 mlir-opt                 0x0000000108f48820 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool, bool) + 296
44 mlir-opt                 0x0000000108f493e4 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 2912
45 mlir-opt                 0x00000001048546dc main + 148
46 dyld                     0x00000001235dd088 start + 516

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]mlir

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions