This is an archive of the discontinued LLVM Phabricator instance.

[mlir][ods] Rework how transitive use of deprecated defs are handled
ClosedPublic

Authored by zero9178 on Jan 15 2023, 6:54 AM.

Details

Summary

The code currently attempting to recursively find uses of a deprecated def has a few deficiences:

  • It recurses into all def uses. This is problematic as it also causes any users of a def using a deprecated def, to be considered deprecated, causing a transitive chain of deprecated defs (see H_ButNotTransitivelyInNonAnonymousDef in test case for reproducer)
  • It did not recurse into other kinds of fields, such as list and DAGs

This patch fixes the issue by reworking the code to properly recurse into inits and not to recurse into def uses unless they are anonymous defs. Since inits (including DAG, List and anonymous defs) are uniqued, the memoization is kept and remains profitable.

Diff Detail

Event Timeline

zero9178 created this revision.Jan 15 2023, 6:54 AM
zero9178 requested review of this revision.Jan 15 2023, 6:54 AM
jpienaar accepted this revision.Jan 15 2023, 8:49 AM

Nice, thanks

mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
47–69

This is cheaper than the lookup, could we do this first?

mlir/test/mlir-tblgen/deprecation-transitive.td
10

Can we check no warning emitted here?

15

I can't think of a better way than CHECK-NOTs or running test 2x to verify that no other warnings were emitted. CHECK-NOT is reasonably simple luckily. This way we can check no unexpected warnings are emitted of slips in.

This revision is now accepted and ready to land.Jan 15 2023, 8:49 AM
zero9178 updated this revision to Diff 489364.Jan 15 2023, 9:10 AM

Address review comments

  • Move check for init value before the lookup
  • Make use of --implicit-check-not warning: in FileCheck. This verifies that there are precisely no other warnings but the ones explicitly CHECKed
zero9178 marked 3 inline comments as done.Jan 15 2023, 9:13 AM
zero9178 added inline comments.
mlir/test/mlir-tblgen/deprecation-transitive.td
15

I've addressed this and the above using --implicit-check-not warning: in FileCheck, which was perfect for this

This revision was landed with ongoing or failed builds.Jan 15 2023, 9:29 AM
This revision was automatically updated to reflect the committed changes.
zero9178 marked an inline comment as done.