When I debugged the Toy/Ch2 example,
toyc-ch2 llvm-project/mlir/test/Examples/Toy/Ch2/codegen2.toy -emit=mlir -mlir-print-debuginfo
I found that the program toyc-ch2 reported an error message like this.
loc(“/llvm-project/mlir/test/Examples/Toy/Ch2/codegen2.toy”:14:9): error: error: unknown variable ‘e’
module {
toy.func @multiply_transpose(%arg0: tensor<*xf64> loc(“/llvm-project/mlir/test/Examples/Toy/Ch2/codegen2.toy”:4:1), %arg1: tensor<*xf64> loc/Toy/Ch2/codegen2.toy":4:1)) → tensor<*xf64> {
%0 = toy.transpose(%arg0 : tensor<*xf64>) to tensor<*xf64> loc(“/llvm-project/mlir/test/Examples/Toy/Ch2/codegen2.toy”:5:10)
%1 = toy.transpose(%arg1 : tensor<*xf64>) to tensor<*xf64> loc(“/llvm-project/mlir/test/Examples/Toy/Ch2/codegen2.toy”:5:25)
%2 = toy.mul %0, %1 : tensor<*xf64> loc(“/llvm-project/mlir/test/Examples/Toy/Ch2/codegen2.toy”:5:25)
toy.return %2 : tensor<*xf64> loc(“/llvm-project/mlir/test/Examples/Toy/Ch2/codegen2.toy”:5:3)
I want the error to prompt the line of code and the specific code.I referred to the error in the mlir-opt code.
mlir-opt test.mlir -test-transform-dialect-interpreter
The error is reported as
test.mlir:15:35: error: use of undeclared SSA value name
scf.for %arg2 = %6 to %7 step %8 {
^
I found that the emitError interface reported an error。
InFlightDiagnostic mlir::emitError(Location loc, const Twine &message)
Why is the error reported by toyc-ch2 not as accurate and easy to understand as that reported by mlir-opt? The line where the error occurs and the corresponding error are displayed。