This is an archive of the discontinued LLVM Phabricator instance.

Expose MlirOperationClone in Python bindings.
ClosedPublic

Authored by dominikgrewe on Mar 26 2022, 3:35 AM.

Details

Summary

Expose MlirOperationClone in Python bindings.

Diff Detail

Event Timeline

dominikgrewe created this revision.Mar 26 2022, 3:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 26 2022, 3:35 AM
dominikgrewe requested review of this revision.Mar 26 2022, 3:35 AM
mehdi_amini added inline comments.Mar 26 2022, 11:32 AM
mlir/lib/Bindings/Python/IRCore.cpp
1233

Except the first line, this is all the same as the end of PyOperation::create(, I wonder if it is worth refactoring in a helper function?

Factor out insertion point logic.

ftynse added inline comments.Mar 28 2022, 2:59 AM
mlir/test/python/ir/operation.py
783

Could we check that there are indeed two operations before erasing the original?

dominikgrewe marked an inline comment as done.

Check in test that op actually got cloned.

dominikgrewe marked an inline comment as done.Mar 28 2022, 6:44 AM
dominikgrewe added inline comments.
mlir/lib/Bindings/Python/IRCore.cpp
1233

I factored out the insertion logic as that seemed like a natural function to pull out and constituted the majority of the duplicated code. Ptal.

ftynse accepted this revision.Mar 28 2022, 6:44 AM
This revision is now accepted and ready to land.Mar 28 2022, 6:44 AM

Upload changes.

This revision was landed with ongoing or failed builds.Mar 28 2022, 6:58 AM
This revision was automatically updated to reflect the committed changes.