This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Fix attaching side effects on `FlatSymbolRefAttr`
ClosedPublic

Authored by zero9178 on Jan 13 2022, 12:24 AM.

Details

Summary

The names of the generated attribute getters for ops changed some time ago. The method created from the attribute name returns the return type and an additional method of the same name with Attr as suffix is generated which returns the actual attribute as its storage type.

The code generating effects however was using the methods without the Attr suffix, which is a problem in the case of FlatSymbolRefAttr as it has a return type of llvm::StringRef. This would lead to compilation errors as the constructor of SideEffects::EffectInstance expects a SymbolRefAttr in this case.

This patch simply fixes the generated effects code to use the Attr suffixed getter to get the actual storage type of the attribute.

Diff Detail

Event Timeline

zero9178 created this revision.Jan 13 2022, 12:24 AM
zero9178 requested review of this revision.Jan 13 2022, 12:24 AM
rriddle accepted this revision.Jan 13 2022, 12:29 AM
This revision is now accepted and ready to land.Jan 13 2022, 12:29 AM

Can we add one such op in the test dialect? If the op in mlir/test/mlir-tblgen/op-side-effects.td were there we'd have caught the compile-time failure...

zero9178 updated this revision to Diff 399575.Jan 13 2022, 12:55 AM
  • Add Op instance in Test Dialect to test compilation
  • Use the proper getter name for the attribute to work independent of the dialects accessor prefix
zero9178 updated this revision to Diff 399581.Jan 13 2022, 1:18 AM

Test remaining uses of Arg in Test dialect as well. This should test compilation of the same features as in test/mlir-tblgen/op-side-effects.td now

mehdi_amini accepted this revision.Jan 13 2022, 9:03 AM
jpienaar accepted this revision.Jan 13 2022, 9:10 AM
jpienaar added a subscriber: jpienaar.

Thanks!

This revision was automatically updated to reflect the committed changes.