Is the LLVM dialect supports `llvm.trap` or any other debug intrinsics?

Hi,

I’m working with the LLVM dialect, I tried to add some assertion into the IR for debugging, and found llvm.trap from LLVMIR seems the solution. That seems not in LLVM dialect.

Could you please help to confirm whether it is available in LLVM dialect, or is there any alternative debugging way?

Best,
Chunwei

It’s not, but it is trivial to add here llvm-project/LLVMIntrinsicOps.td at main · llvm/llvm-project · GitHub. Most of things in MLIR are need-driven and, conversely, we don’t want to add and maintain the features without need.

Doesn’t this achieve a similar aim:
In C language:
raise(SIGTRAP);
In LLVM IR:
%5 = call i32 @raise(i32 noundef 5)
In MLIR:
%1 = llvm.mlir.constant(5 : i32) : i32
%5 = llvm.call @raise(%1) : (i32) → i32

It makes sense, I will try it.

Thanks.

I see, thanks.