This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Check nullity of MixedContainerType and TypedArrayAttrBase
ClosedPublic

Authored by Chia-hungDuan on Mar 7 2022, 6:25 PM.

Details

Summary
It's valid to create a TypedArrayAttr or MixedContainerType with
nullptr, e.g.,
  std::vector<mlir::Attribute> attrs = {mlir::StringAttr()};
  builder.createArrayAttr(attrs);

The predicate didn't check if it's a nullptr and it ends up a crash in
the attribute static verifier. We always check if an attribute is null
so it's better to align the check for these two container type attr.

Diff Detail

Event Timeline

Chia-hungDuan created this revision.Mar 7 2022, 6:25 PM
Herald added a project: Restricted Project. · View Herald Transcript
Chia-hungDuan requested review of this revision.Mar 7 2022, 6:25 PM

Can you add more context / motivation in the revision description?

Add descriptions

Chia-hungDuan edited the summary of this revision. (Show Details)Mar 8 2022, 9:29 AM
rdzhabarov accepted this revision.Mar 8 2022, 9:44 AM
This revision is now accepted and ready to land.Mar 8 2022, 9:44 AM