forked from OSchip/llvm-project
Simplify getArgAttrDict/getResultAttrDict by removing unnecessary checks
There is a slight change in behavior: if the arg dictionnary is empty then we return this empty dictionnary instead of a null attribute. This is more consistent with accessing it through: ArrayAttr args_attr = func_op.getAllArgAttrs(); args_attr[num].cast<DictionnaryAttr>() ... Differential Revision: https://reviews.llvm.org/D104189
This commit is contained in:
parent
2db64e199a
commit
152c9871e6
|
@ -40,7 +40,7 @@ DictionaryAttr mlir::function_like_impl::getArgAttrDict(Operation *op,
|
|||
ArrayAttr attrs = op->getAttrOfType<ArrayAttr>(getArgDictAttrName());
|
||||
DictionaryAttr argAttrs =
|
||||
attrs ? attrs[index].cast<DictionaryAttr>() : DictionaryAttr();
|
||||
return (argAttrs && !argAttrs.empty()) ? argAttrs : DictionaryAttr();
|
||||
return argAttrs;
|
||||
}
|
||||
|
||||
DictionaryAttr mlir::function_like_impl::getResultAttrDict(Operation *op,
|
||||
|
@ -48,7 +48,7 @@ DictionaryAttr mlir::function_like_impl::getResultAttrDict(Operation *op,
|
|||
ArrayAttr attrs = op->getAttrOfType<ArrayAttr>(getResultDictAttrName());
|
||||
DictionaryAttr resAttrs =
|
||||
attrs ? attrs[index].cast<DictionaryAttr>() : DictionaryAttr();
|
||||
return (resAttrs && !resAttrs.empty()) ? resAttrs : DictionaryAttr();
|
||||
return resAttrs;
|
||||
}
|
||||
|
||||
void mlir::function_like_impl::detail::setArgResAttrDict(
|
||||
|
|
Loading…
Reference in New Issue