This is an archive of the discontinued LLVM Phabricator instance.

[mlir:Parser] Emit a better diagnostic when a custom operation is unknown
ClosedPublic

Authored by rriddle on May 10 2022, 9:25 PM.

Details

Summary

When a custom operation is unknown and does not have a dialect prefix, we currently
emit an error using the name of the operation with the default dialect prefix. This
leads to a confusing error message, especially when operations get moved between dialects.
For example, func was recently moved out of builtin and to the func dialect. The current
error message we get is:

func @foo()
^ custom op 'builtin.func' is unknown

This could lead users to believe that there is supposed to be a builtin.func,
because there used to be. This commit adds a better error message that does
not assume that the operation is supposed to be in the default dialect:

func @foo()
^ custom op 'func' is unknown (tried 'builtin.func' as well)

Diff Detail

Event Timeline

rriddle created this revision.May 10 2022, 9:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 10 2022, 9:25 PM
rriddle requested review of this revision.May 10 2022, 9:25 PM
mehdi_amini accepted this revision.May 11 2022, 3:21 PM
This revision is now accepted and ready to land.May 11 2022, 3:21 PM
This revision was landed with ongoing or failed builds.May 11 2022, 10:55 PM
This revision was automatically updated to reflect the committed changes.