Open bondhugula opened 4 years ago
This should be reproducible on the trunk and is due to the handling post the missing type on the block argument being passed.
func @foo(%key : i32) { "bar"() ({ ^bb0(%i : index): br ^bb1(%i : index) ^bb1(%j: index): %p1 = cmpi "slt", %j, %j : index cond_br %p1, ^bb2, ^bb5 ^bb2: %p = cmpi "eq", %key, %key : i32 cond_br %p, ^bb3(%j), ^bb5 ^bb3(%j: i32): br ^bb2 } : () -> () return }
$ mlir-opt crash.mlir
/tmp/crash.mlir:13:24: error: expected ':' in operand list cond_br %p, ^bb3(%j), ^bb5 ^ mlir-opt: /home/uday/llvm-project-bondhugula/llvm/projects/mlir/include/mlir/IR/UseDefLists.h:39: mlir::IRObjectWithUseList::~IRObjectWithUseList(): Assertion `use_empty() && "Cannot destroy a value that still has uses!"' failed. Stack dump: 0. Program arguments: /home/uday/llvm-project-bondhugula/build/bin/mlir-opt /tmp/crash.mlir 1. MLIR Parser: custom op parser 'func' #0 0x0000000000cf98b6 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/uday/llvm-project-bondhugula/llvm/lib/Support/Unix/Signals.inc:548:22 #1 0x0000000000cf9949 PrintStackTraceSignalHandler(void*) /home/uday/llvm-project-bondhugula/llvm/lib/Support/Unix/Signals.inc:609:1 #2 0x0000000000cf7a62 llvm::sys::RunSignalHandlers() /home/uday/llvm-project-bondhugula/llvm/lib/Support/Signals.cpp:68:20 #3 0x0000000000cf92f8 SignalHandler(int) /home/uday/llvm-project-bondhugula/llvm/lib/Support/Unix/Signals.inc:390:1 #4 0x00007f93eb498b20 __restore_rt (/lib64/libpthread.so.0+0x14b20) #5 0x00007f93eaf59625 raise (/lib64/libc.so.6+0x3c625) #6 0x00007f93eaf428d9 abort (/lib64/libc.so.6+0x258d9) #7 0x00007f93eaf427a9 _nl_load_domain.cold (/lib64/libc.so.6+0x257a9) #8 0x00007f93eaf51a66 (/lib64/libc.so.6+0x34a66) #9 0x0000000000bb5169 mlir::IRObjectWithUseList::~IRObjectWithUseList() /home/uday/llvm-project-bondhugula/llvm/projects/mlir/include/mlir/IR/UseDefLists.h:39:5 #10 0x0000000000bb5186 mlir::Value::~Value() /home/uday/llvm-project-bondhugula/llvm/projects/mlir/include/mlir/IR/Value.h:49:13 #11 0x0000000000bb52c4 mlir::BlockArgument::~BlockArgument() /home/uday/llvm-project-bondhugula/llvm/projects/mlir/include/mlir/IR/Value.h:120:7 #12 0x0000000000bb5532 void llvm::DeleteContainerPointers<std::vector<mlir::BlockArgument*, std::allocator<mlir::BlockArgument*> > >(std::vector<mlir::BlockArgument*, std::allocator<mlir::BlockArgument*> >&) /home/uday/llvm-project-bondhugula/llvm/include/llvm/ADT/STLExtras.h:1147:5 #13 0x0000000000bb43dd mlir::Block::~Block() /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/IR/Block.cpp:38:15 #14 0x00000000006b9da8 (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<std::pair<(anonymous namespace)::OperationParser::SSAUseInfo, mlir::Type> >, bool) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Parser/Parser.cpp:4403:12 #15 0x00000000006b9083 (anonymous namespace)::CustomOpAsmParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::OperandType>, llvm::ArrayRef<mlir::Type>, bool) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Parser/Parser.cpp:4202:72 #16 0x00000000006b9199 (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::OperandType>, llvm::ArrayRef<mlir::Type>, bool) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Parser/Parser.cpp:4214:72 #17 0x0000000000bd5e3b mlir::impl::parseFunctionLikeOp(mlir::OpAsmParser&, mlir::OperationState&, bool, llvm::function_ref<mlir::Type (mlir::Builder&, llvm::ArrayRef<mlir::Type>, llvm::ArrayRef<mlir::Type>, mlir::impl::VariadicFlag, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)>) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/IR/FunctionImplementation.cpp:216:72 #18 0x0000000000bd08f7 mlir::FuncOp::parse(mlir::OpAsmParser&, mlir::OperationState&) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/IR/Function.cpp:89:1 #19 0x0000000000bf0ff4 mlir::Op<mlir::FuncOp, mlir::OpTrait::ZeroOperands, mlir::OpTrait::ZeroResult, mlir::OpTrait::IsIsolatedFromAbove, mlir::OpTrait::Symbol, mlir::OpTrait::FunctionLike, mlir::CallableOpInterface::Trait>::parseAssembly(mlir::OpAsmParser&, mlir::OperationState&) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/include/mlir/IR/OpDefinition.h:1003:3 #20 0x00000000006b7440 (anonymous namespace)::CustomOpAsmParser::parseOperation(mlir::OperationState&) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Parser/Parser.cpp:3810:51 #21 0x00000000006b9801 (anonymous namespace)::OperationParser::parseCustomOperation() /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Parser/Parser.cpp:4337:41 #22 0x00000000006b5f8e (anonymous namespace)::OperationParser::parseOperation() /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Parser/Parser.cpp:3595:30 #23 0x00000000006bb134 (anonymous namespace)::ModuleParser::parseModule(mlir::ModuleOp) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Parser/Parser.cpp:4665:35 #24 0x00000000006bb5ee mlir::parseSourceFile(llvm::SourceMgr const&, mlir::MLIRContext*) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Parser/Parser.cpp:4731:46 #25 0x00000000006a2cd5 performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, mlir::PassPipelineCLParser const&) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Support/MlirOptMain.cpp:54:8 #26 0x00000000006a2ef3 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, mlir::PassPipelineCLParser const&) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Support/MlirOptMain.cpp:92:49 #27 0x00000000006a3115 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, mlir::PassPipelineCLParser const&, bool, bool, bool) /home/uday/llvm-project-bondhugula/llvm/projects/mlir/lib/Support/MlirOptMain.cpp:125:36 #28 0x0000000000b6c53c main /home/uday/llvm-project-bondhugula/llvm/projects/mlir/tools/mlir-opt/mlir-opt.cpp:83:16 #29 0x00007f93eaf441a3 __libc_start_main (/lib64/libc.so.6+0x271a3) #30 0x000000000040b18e _start (/home/uday/llvm-project-bondhugula/build/bin/mlir-opt+0x40b18e) Aborted (core dumped)
This should be reproducible on the trunk and is due to the handling post the missing type on the block argument being passed.
$ mlir-opt crash.mlir