This is an archive of the discontinued LLVM Phabricator instance.

[mlir][StorageUniquer] Properly call the destructor on non-trivially destructible storage instances
ClosedPublic

Authored by rriddle on Mar 9 2021, 8:12 PM.

Details

Summary

This allows for storage instances to store data that isn't uniqued in the context, or contain otherwise non-trivial logic, in the rare situations that they occur. Storage instances with trivial destructors will still have their destructor skipped. A consequence of this is that the storage instance definition must be visible from the place that registers the type.

Diff Detail

Event Timeline

rriddle created this revision.Mar 9 2021, 8:12 PM
rriddle requested review of this revision.Mar 9 2021, 8:12 PM
ftynse accepted this revision.Mar 10 2021, 12:16 AM

A consequence of this is that the storage instance definition must be visible from the place that registers the type.

This is worth putting in the documentation.

I wonder if there is an easy way to test a destructor actually being called. An idea that comes to bind is to report_fatal_error in it and have a death unit test, but that sounds hacky and expensive.

This revision is now accepted and ready to land.Mar 10 2021, 12:16 AM
ftynse accepted this revision.Mar 11 2021, 12:37 AM

Thanks!

This revision was landed with ongoing or failed builds.Mar 11 2021, 11:36 AM
This revision was automatically updated to reflect the committed changes.