This is an archive of the discontinued LLVM Phabricator instance.

[mlir][test] Fix broken test pass on SymbolOpInterface
Needs RevisionPublic

Authored by sotoshigoto on Sep 4 2023, 9:36 PM.

Details

Summary

When running the opt-tool with a pass pipeline that does not include
-pass-pipeline="builtin.func(..)", such as -test-print-liveness, a
crash occurs during casting if this pass operates on an operation that
does not have a SymbolOpInterface. For example, a ModuleOp that lacks a
symbol attribute. In a previous change at https://reviews.llvm.org/D121191,
FuncOp was replaced with SymbolOpInterface to reduce the dependency on
FuncOp. This patch adds a check to determine whether an operation can be
cast to SymbolOpInterface before performing the operation.

Fixes #61870

Diff Detail

Event Timeline

sotoshigoto created this revision.Sep 4 2023, 9:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2023, 9:36 PM
sotoshigoto requested review of this revision.Sep 4 2023, 9:36 PM
mehdi_amini requested changes to this revision.Sep 4 2023, 10:39 PM

FYI: we are using GitHub Pull-Requests now (for future revisions)

mlir/test/lib/Analysis/TestLiveness.cpp
23

This is supposed to handle the filtering already, can you provide a test case where it does not?
We should fix it in the framework, it's not the role of the individual passes to do so.

This revision now requires changes to proceed.Sep 4 2023, 10:39 PM
mehdi_amini added inline comments.Sep 4 2023, 10:42 PM
mlir/test/lib/Analysis/TestLiveness.cpp
23

I looked at the linked GitHub issue which has a reproducer, so got it now.
We still should fix this in the framework itself.

@mehdi_amini Thank you for your comment. I will try to address it on the framework side.