This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Fix a crash of attribute tests when given a non-integer type
Needs ReviewPublic

Authored by sotoshigoto on May 29 2023, 8:59 PM.

Details

Reviewers
rriddle
rkayaith
Summary

The crash issue occurs in the TestBuiltinAttributeInterface when a
dense attribute with non-integer elements is provided. The tryGetValues
function should first check conditions, including casting T from the
element's type and verifying whether the elements are empty or not. This
fix resolves the crash issue reported in:

Diff Detail

Event Timeline

sotoshigoto created this revision.May 29 2023, 8:59 PM
Herald added a project: Restricted Project. · View Herald Transcript
sotoshigoto requested review of this revision.May 29 2023, 9:00 PM
sotoshigoto edited the summary of this revision. (Show Details)May 29 2023, 9:00 PM
rkayaith resigned from this revision.May 30 2023, 10:32 AM
rkayaith added inline comments.
mlir/test/IR/elements-attr-interface.mlir
29–34

I'm not too familiar with this interface, but this change doesn't seem right to me. Successfully returning an empty range seems like the desired behaviour.

sotoshigoto added inline comments.Jun 1 2023, 6:49 AM
mlir/test/IR/elements-attr-interface.mlir
29–34

Thanks for your review! I'll address the empty range behavior by checking for attribute casting on empty elements.

addressed review comment

sotoshigoto marked an inline comment as done.Jun 12 2023, 12:57 AM
sotoshigoto updated this revision to Diff 530419.EditedJun 12 2023, 1:02 AM

retry to upload patch