This is an archive of the discontinued LLVM Phabricator instance.

[mlir:PDL] Fix a syntax ambiguity in pdl.attribute
ClosedPublic

Authored by rriddle on Apr 27 2022, 5:34 PM.

Details

Summary

pdl.attribute currently has a syntax ambiguity that leads to the incorrect parsing
of pdl.attribute operations with locations that don't also have a constant value. For example:

pdl.attribute loc("foo")

The above IR is treated as being a pdl.attribute with a constant value containing the location,
loc("foo"), which is incorrect. This commit changes the syntax to use = <constant-value> to
clearly distinguish when the constant value is present, as opposed to just trying to parse an attribute.

Depends on D124581

Diff Detail

Event Timeline

rriddle created this revision.Apr 27 2022, 5:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2022, 5:34 PM
rriddle requested review of this revision.Apr 27 2022, 5:34 PM
jpienaar accepted this revision.Apr 27 2022, 5:49 PM
This revision is now accepted and ready to land.Apr 27 2022, 5:49 PM
This revision was landed with ongoing or failed builds.Apr 28 2022, 12:58 PM
This revision was automatically updated to reflect the committed changes.
mlir/test/Conversion/PDLToPDLInterp/pdl-to-pdl-interp-matcher.mlir
52

This looks weird to me; was something like %attr = attribute<10> : i64 not an option ?
Looks a bit like a template this way which feels more intuitive to me..

rriddle added inline comments.May 9 2022, 10:19 AM
mlir/test/Conversion/PDLToPDLInterp/pdl-to-pdl-interp-matcher.mlir
52

Do you have any suggestions here? Happy to change to something else.