This is an archive of the discontinued LLVM Phabricator instance.

[mlir][DialectConversion] Fix recursive `clone` calls.
ClosedPublic

Authored by silvas on Oct 18 2020, 9:43 PM.

Details

Summary

The framework was not tracking ops created in any regions of the cloned
op.

Diff Detail

Event Timeline

silvas created this revision.Oct 18 2020, 9:43 PM
silvas requested review of this revision.Oct 18 2020, 9:43 PM
rriddle added inline comments.Oct 18 2020, 10:07 PM
mlir/include/mlir/IR/Builders.h
471

This looks really awkward, can you just walk the cloned operation after you've created it?

Thanks for catching this!

silvas added inline comments.Oct 19 2020, 3:27 PM
mlir/include/mlir/IR/Builders.h
471

Good idea! I was worried about retraversing all the cloned IR, but I suppose it's not a big deal, especially since it will be retraversed later as part of the dialect conversion.

rriddle accepted this revision.Oct 19 2020, 3:33 PM
rriddle added inline comments.
mlir/include/mlir/IR/Builders.h
471

If it shows up on a profile it should be easy to adopt a more complicated scheme.

mlir/lib/IR/Builders.cpp
470–473
This revision is now accepted and ready to land.Oct 19 2020, 3:33 PM
silvas marked an inline comment as done.Oct 19 2020, 3:44 PM
silvas updated this revision to Diff 299200.Oct 19 2020, 3:44 PM

adopt fix

This revision was landed with ongoing or failed builds.Oct 19 2020, 3:54 PM
This revision was automatically updated to reflect the committed changes.