Issue 132740
Summary [mlir] --mlir-print-stacktrace-on-diagnostic crashes
Labels mlir
Assignees
Reporter wwy6191
    git version: 59fd2878fce470f02058f43d4b818ed68ce04094

system: `Ubuntu 18.04.6 LTS`

reproduce with: `mlir-opt  --mlir-print-stacktrace-on-diagnostic a.mlir`


a.mlir:  
``` 
#map = affine_map<(d0, d1) -> (d0 + d0 floordiv 8, d1 mod 8)>
#map1 = affine_map<(d0, d1) -> (d1 floordiv 8)>
module {
 spirv.func @simd_insert_scalar_misa(%arg0: i32, %arg1: i32, %arg2: i32) "None" {
    %0 = builtin.unrealized_conversion_cast %arg2 : i32 to index
    %1 = builtin.unrealized_conversion_cast %arg1 : i32 to index
 %2 = builtin.unrealized_conversion_cast %arg0 : i32 to index
    %c0 = arith.constant 0 : index
    %3 = arith.muli %2, %0 : index
    %4 = arith.muli %2, %1 : index
    %5 = affine.min #map(%3, %4)
    %6 = arith.muli %5, %0 : index
    %7 = arith.muli %5, %4 : index
    %8 = affine.apply #map1(%6, %7)
    scf.for %arg3 = %c0 to %8 step %6 {
      %9 = affine.min #map(%6, %7)
      %10 = affine.apply #map1(%5, %9)
 scf.for %arg4 = %c0 to %10 step %5 {
        %11 = affine.apply #map1(%4, %9)
        %12 = arith.muli %arg3, %11 : index
        "test.foo"(%12) : (index) -> ()
      }
      scf.for %arg4 = %11 to %10 step %9 {
 %13 = affine.apply #map1(%4, %12)
        %14 = arith.muli %arg3, %13 : index
        "test.foo"(%14) : (index) -> ()
      }
    }
    scf.for %arg3 = %8 to %5 step %6 {
      %9 = affine.min #map(%6, %7)
      %10 = affine.apply #map1(%5, %9)
      scf.for %arg4 = %c0 to %10 step %5 {
 %11 = affine.apply #map1(%4, %9)

``` 
stack trace:

``` 
tmp.dlbmYvtohM.mlir:33:41: error: expected operation name in quotes
 %11 = affine.apply #map1(%4, %9)
 ^
/data/szy/MLIR/seed/seed15/tmp.dlbmYvtohM.mlir:33:41: note: diagnostic emitted with trace:
 #0 0x0000559eedbb2db8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x11bddb8)
 #1 0x0000559ef0cf8b0d emitDiag(mlir::Location, mlir::DiagnosticSeverity, llvm::Twine const&) Diagnostics.cpp:0:0
 #2 0x0000559ef0cf8931 mlir::emitError(mlir::Location, llvm::Twine const&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x4303931)
 #3 0x0000559ef3d17d0d mlir::detail::Parser::emitWrongTokenError(llvm::Twine const&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x7322d0d)
 #4 0x0000559ef3d1c62a (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
 #5 0x0000559ef3d269a4 (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) Parser.cpp:0:0
 #6 0x0000559ef3d2485c (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
 #7 0x0000559eefa0ea94 mlir::scf::ForOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x3019a94)
 #8 0x0000559ef3d1b7e4 (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
 #9 0x0000559ef3d269a4 (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) Parser.cpp:0:0
#10 0x0000559ef3d2485c (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
#11 0x0000559eefa0ea94 mlir::scf::ForOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x3019a94)
#12 0x0000559ef3d1b7e4 (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
#13 0x0000559ef3d269a4 (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) Parser.cpp:0:0
#14 0x0000559ef3d2485c (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
#15 0x0000559ef3d22acc (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
#16 0x0000559ef0083557 mlir::spirv::FuncOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x368e557)
#17 0x0000559ef3d1b7e4 (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
#18 0x0000559ef3d269a4 (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) Parser.cpp:0:0
#19 0x0000559ef3d246d5 (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) Parser.cpp:0:0
#20 0x0000559ef0cd9b9e mlir::ModuleOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x42e4b9e)
#21 0x0000559ef3d1b7e4 (anonymous namespace)::OperationParser::parseOperation() Parser.cpp:0:0
#22 0x0000559ef3d1a5ad mlir::parseAsmSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::AsmParserState*, mlir::AsmParserCodeCompleteContext*) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x73255ad)
#23 0x0000559ef0bb9f0f mlir::parseSourceFile(std::shared_ptr<llvm::SourceMgr> const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x41c4f0f)
#24 0x0000559ef0bb8e8e mlir::parseSourceFileForTool(std::shared_ptr<llvm::SourceMgr> const&, mlir::ParserConfig const&, bool) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x41c3e8e)
#25 0x0000559ef0bb867f performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#26 0x0000559ef0bb83ed llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, 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&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#27 0x0000559ef0c63275 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::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x426e275)
#28 0x0000559ef0bb2405 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x41bd405)
#29 0x0000559ef0bb26af mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x41bd6af)
#30 0x0000559ef0bb29de mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x41bd9de)
#31 0x0000559eedb91337 main (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x119c337)
#32 0x00007f0052599083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#33 0x0000559eedb90e9e _start (/data/szy/MLIR/llvm-project/install/bin/mlir-opt+0x119be9e)
``` 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to