This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Limit Interface generation to the top-level input file
ClosedPublic

Authored by rriddle on Dec 16 2022, 2:42 AM.

Details

Summary

There are very few instances in which we use multiple files
for interface definitions (none upstream), and this allows
for including interfaces that shouldn't be generated (for
interface inheritance, dependencies, etc.)

Diff Detail

Event Timeline

rriddle created this revision.Dec 16 2022, 2:42 AM
rriddle requested review of this revision.Dec 16 2022, 2:42 AM
jpienaar accepted this revision.Dec 16 2022, 11:13 AM
jpienaar added inline comments.
mlir/docs/Interfaces.md
641

Worst case impact of this is having more cmake/bazel rules? (one for each include now). Beyond running mlir-tblgen more in such cases, I can't think of another consequence of using this as organizing method.

mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
68–77

Sort of surprised this hasn't hit us anywhere ...

76

return llvm::SrcMgr.FindBufferContainingLoc(def->getLoc()[0] != llvm::SrcMgr.getMainFileID(); ?

This revision is now accepted and ready to land.Dec 16 2022, 11:13 AM
rriddle updated this revision to Diff 488757.Jan 12 2023, 1:36 PM
rriddle marked 2 inline comments as done.
rriddle added inline comments.Jan 12 2023, 1:36 PM
mlir/docs/Interfaces.md
641

Yeah, would just need more rules. I can't think of any situations where it's really that bad.