summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms/MaterializeVectors.cpp
diff options
context:
space:
mode:
authorAlex Zinenko <zinenko@google.com>2018-12-06 10:56:21 -0800
committerjpienaar <jpienaar@google.com>2019-03-29 14:19:37 -0700
commit513d6d896ccf991ebc0acf85158d98e574f7b625 (patch)
tree3762d4b427c0b45b6ca4ebf733137dce07c89008 /mlir/lib/Transforms/MaterializeVectors.cpp
parent73fc0223e42a338a2c43ebfc0c2b74df62f2955d (diff)
downloadbcm5719-llvm-513d6d896ccf991ebc0acf85158d98e574f7b625.tar.gz
bcm5719-llvm-513d6d896ccf991ebc0acf85158d98e574f7b625.zip
OpPointer: replace conversion operator to Operation* to OpType*.
The implementation of OpPointer<OpType> provides an implicit conversion to Operation *, but not to the underlying OpType *. This has led to awkward-looking code when an OpPointer needs to be passed to a function accepting an OpType *. For example, if (auto someOp = genericOp.dyn_cast<OpType>()) someFunction(&*someOp); where "&*" makes it harder to read. Arguably, one does not want to spell out OpPointer<OpType> in the line with dyn_cast. More generally, OpPointer is now being used as an owning pointer to OpType rather than to operation. Replace the implicit conversion to Operation* with the conversion to OpType* taking into account const-ness of the type. An Operation* can be obtained from an OpType with a simple call. Since an instance of OpPointer owns the OpType value, the pointer to it is never null. However, the OpType value may not be associated with any Operation*. In this case, return nullptr when conversion is attempted to maintain consistency with the existing null checks. PiperOrigin-RevId: 224368103
Diffstat (limited to 'mlir/lib/Transforms/MaterializeVectors.cpp')
-rw-r--r--mlir/lib/Transforms/MaterializeVectors.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp
index 400b4fdf934..27f157c9234 100644
--- a/mlir/lib/Transforms/MaterializeVectors.cpp
+++ b/mlir/lib/Transforms/MaterializeVectors.cpp
@@ -414,11 +414,11 @@ static bool instantiateMaterialization(Statement *stmt,
MLFuncBuilder b(stmt);
auto *opStmt = cast<OperationStmt>(stmt);
if (auto write = opStmt->dyn_cast<VectorTransferWriteOp>()) {
- instantiate(&b, &*write, state->hwVectorType, state->hwVectorInstance,
+ instantiate(&b, write, state->hwVectorType, state->hwVectorInstance,
state->substitutionsMap);
return false;
} else if (auto read = opStmt->dyn_cast<VectorTransferReadOp>()) {
- auto *clone = instantiate(&b, &*read, state->hwVectorType,
+ auto *clone = instantiate(&b, read, state->hwVectorType,
state->hwVectorInstance, state->substitutionsMap);
state->substitutionsMap->insert(std::make_pair(
cast<MLValue>(read->getResult()), cast<MLValue>(clone->getResult(0))));
OpenPOWER on IntegriCloud