[mlir] teach expensive-checks transform mode about empty handle
authorAlex Zinenko <zinenko@google.com>
Fri, 26 May 2023 13:07:13 +0000 (13:07 +0000)
committerAlex Zinenko <zinenko@google.com>
Fri, 26 May 2023 16:01:09 +0000 (16:01 +0000)
commit44f6e8625e634a1c26805a752132c74aeb99c7d5
treeffb1e62f6385f1e994018b18ae46e8d05aa49a49
parente31f99464216ef4d04ffa821e174522b699780ee
[mlir] teach expensive-checks transform mode about empty handle

The transform dialect interpreter features the expensive-checks mode
that acts as an embedded sanitizer to track use-after-consume of
transform handles. Its logic is based on the relations between payload
operations, which made it silently ignore empty handles that are
consumed. Also catch and report this case because the remaining code may
hit an assertion on attempting to access a consumed handle (that is
removed from the mapping).

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D151560
mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
mlir/test/Dialect/Transform/expensive-checks.mlir
mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp
mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.td