This is an archive of the discontinued LLVM Phabricator instance.

Fixed a memory leak in the PDLToPDLInterp RootOrderingTest.
ClosedPublic

Authored by sfuniak on Nov 29 2021, 3:03 PM.

Details

Summary

RootOrderingTest is a low-level unit test that creates values and uses them as vertices in a directed graph. These vertices were created using builder.create, but never freed, due to my insufficient understanding of the MLIR infrastructure.

Diff Detail

Event Timeline

sfuniak created this revision.Nov 29 2021, 3:03 PM
sfuniak requested review of this revision.Nov 29 2021, 3:03 PM

Thanks for the fix!

It is a bit unusual to work with operations that aren't inserted in a block, I guess it works here...

mlir/unittests/Conversion/PDLToPDLInterp/RootOrderingTest.cpp
27
51

Nit: in general I rather keep signed semantics as default.

sfuniak marked 2 inline comments as done.Nov 29 2021, 3:53 PM

It is a bit unusual to work with operations that aren't inserted in a block, I guess it works here...

Yes, @bondhugula raised the same point. The reason for creating the Values outside of the block is that they simply act as graph vertices / vertex IDs in RootOrdering. They are not being tested as a part of a block / IR. Maybe this warrants a comment on the unit test; will add it.

sfuniak updated this revision to Diff 390512.Nov 29 2021, 3:59 PM

Review feedback.

rriddle accepted this revision.Nov 30 2021, 7:51 AM

Thanks for the fix!

It is a bit unusual to work with operations that aren't inserted in a block, I guess it works here...

Would likely be better to have a Block next to the context field, and add the operations into that.

This revision is now accepted and ready to land.Nov 30 2021, 7:51 AM
sfuniak updated this revision to Diff 390961.Dec 1 2021, 2:35 AM

Add operations to a block to facilitate automatic deletion.

mehdi_amini accepted this revision.Dec 1 2021, 2:39 AM

LG, thanks!

bondhugula accepted this revision.Dec 1 2021, 4:10 AM
This revision was automatically updated to reflect the committed changes.