This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Interfaces] Symbols are not trivially dead
ClosedPublic

Authored by springerm on Jun 15 2023, 12:30 AM.

Details

Summary

The greedy pattern rewrite driver removes ops that are "trivially dead". This could include symbols that are still referenced by other ops. Dead symbols should be removed with the -symbol-dce pass instead.

This bug was not triggered for func::FuncOp, because ops are not considered "trivally dead" if they do not implement the MemoryEffectOpInterface, indicating that the op may or may not have side effects. It is, however, triggered for transform::NamedSequenceOp, which implements that interface because it is required for all transform dialect ops.

Diff Detail

Event Timeline

springerm created this revision.Jun 15 2023, 12:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2023, 12:30 AM
springerm requested review of this revision.Jun 15 2023, 12:30 AM
mehdi_amini added inline comments.Jun 15 2023, 12:37 AM
mlir/test/Dialect/Transform/test-interpreter.mlir
5 ↗(On Diff #531626)

This isn't the kind of test that is high value, can you add a targeted test instead please?

springerm marked an inline comment as done.

address comments

mehdi_amini accepted this revision.Jun 15 2023, 1:10 AM
This revision is now accepted and ready to land.Jun 15 2023, 1:10 AM
mehdi_amini added inline comments.Jun 15 2023, 1:10 AM
mlir/test/lib/Dialect/Test/TestPatterns.cpp
203

Could have made this just and OperationPass without restricting to a specific op?

This revision was automatically updated to reflect the committed changes.
springerm marked an inline comment as done.
springerm added inline comments.Jun 15 2023, 2:31 AM
mlir/test/lib/Dialect/Test/TestPatterns.cpp
203

I removed it from the wrong pass, here's a revision that removes it from all passes in this file when possible: D153005