Refactor ElementsAttr::getValue and DenseElementsAttr::getSplatValue.
authorRiver Riddle <riverriddle@google.com>
Wed, 14 Aug 2019 22:03:25 +0000 (15:03 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Wed, 14 Aug 2019 22:03:53 +0000 (15:03 -0700)
commita481032a3313c44996c3414d91473b494ddb098e
treea2e3abdea9a6526caec93f0d6a5c492bf2bd9c04
parentf32f291b375f25f86b93b8b1d41f0c8e98bf5ae4
Refactor ElementsAttr::getValue and DenseElementsAttr::getSplatValue.

All 'getValue' variants now require that the index is valid, queryable via 'isValidIndex'. 'getSplatValue' now requires that the attribute is a proper splat. This allows for querying these methods on DenseElementAttr with all possible value types; e.g. float, int, APInt, etc. This also allows for removing unnecessary conversions to Attribute that really want the underlying value.

PiperOrigin-RevId: 263437337
mlir/examples/toy/Ch5/mlir/LateLowering.cpp
mlir/include/mlir/IR/Attributes.h
mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
mlir/lib/IR/Attributes.cpp
mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp
mlir/lib/Quantizer/Support/Statistics.cpp
mlir/lib/StandardOps/Ops.cpp
mlir/test/Transforms/constant-fold.mlir