summaryrefslogtreecommitdiffstats
path: root/mlir/examples/Linalg/Linalg2/Example.cpp
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-07-01 10:29:09 -0700
committerjpienaar <jpienaar@google.com>2019-07-01 11:39:00 -0700
commit54cd6a7e97a226738e2c85b86559918dd9e3cd5d (patch)
treeaffa803347d6695be575137d1ad55a055a8021e3 /mlir/examples/Linalg/Linalg2/Example.cpp
parent84bd67fc4fd116e80f7a66bfadfe9a7fd6fd5e82 (diff)
downloadbcm5719-llvm-54cd6a7e97a226738e2c85b86559918dd9e3cd5d.tar.gz
bcm5719-llvm-54cd6a7e97a226738e2c85b86559918dd9e3cd5d.zip
NFC: Refactor Function to be value typed.
Move the data members out of Function and into a new impl storage class 'FunctionStorage'. This allows for Function to become value typed, which will greatly simplify the transition of Function to FuncOp(given that FuncOp is also value typed). PiperOrigin-RevId: 255983022
Diffstat (limited to 'mlir/examples/Linalg/Linalg2/Example.cpp')
-rw-r--r--mlir/examples/Linalg/Linalg2/Example.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/mlir/examples/Linalg/Linalg2/Example.cpp b/mlir/examples/Linalg/Linalg2/Example.cpp
index a415daebdf5..9534711f1f4 100644
--- a/mlir/examples/Linalg/Linalg2/Example.cpp
+++ b/mlir/examples/Linalg/Linalg2/Example.cpp
@@ -36,14 +36,14 @@ TEST_FUNC(linalg_ops) {
MLIRContext context;
Module module(&context);
auto indexType = mlir::IndexType::get(&context);
- mlir::Function *f =
+ mlir::Function f =
makeFunction(module, "linalg_ops", {indexType, indexType, indexType}, {});
- OpBuilder builder(f->getBody());
- ScopedContext scope(builder, f->getLoc());
+ OpBuilder builder(f.getBody());
+ ScopedContext scope(builder, f.getLoc());
// clang-format off
- ValueHandle M(f->getArgument(0)), N(f->getArgument(1)), K(f->getArgument(2)),
+ ValueHandle M(f.getArgument(0)), N(f.getArgument(1)), K(f.getArgument(2)),
rM = range(constant_index(0), M, constant_index(1)),
rN = range(constant_index(0), N, constant_index(1)),
rK = range(constant_index(0), K, constant_index(1)),
@@ -75,14 +75,14 @@ TEST_FUNC(linalg_ops_folded_slices) {
MLIRContext context;
Module module(&context);
auto indexType = mlir::IndexType::get(&context);
- mlir::Function *f = makeFunction(module, "linalg_ops_folded_slices",
- {indexType, indexType, indexType}, {});
+ mlir::Function f = makeFunction(module, "linalg_ops_folded_slices",
+ {indexType, indexType, indexType}, {});
- OpBuilder builder(f->getBody());
- ScopedContext scope(builder, f->getLoc());
+ OpBuilder builder(f.getBody());
+ ScopedContext scope(builder, f.getLoc());
// clang-format off
- ValueHandle M(f->getArgument(0)), N(f->getArgument(1)), K(f->getArgument(2)),
+ ValueHandle M(f.getArgument(0)), N(f.getArgument(1)), K(f.getArgument(2)),
rM = range(constant_index(0), M, constant_index(1)),
rN = range(constant_index(0), N, constant_index(1)),
rK = range(constant_index(0), K, constant_index(1)),
@@ -104,7 +104,7 @@ TEST_FUNC(linalg_ops_folded_slices) {
// CHECK-NEXT: linalg.dot({{.*}}, {{.*}}, {{.*}}) : !linalg.view<f32>
// clang-format on
- f->walk<SliceOp>([](SliceOp slice) {
+ f.walk<SliceOp>([](SliceOp slice) {
auto *sliceResult = slice.getResult();
auto viewOp = emitAndReturnFullyComposedView(sliceResult);
sliceResult->replaceAllUsesWith(viewOp.getResult());
OpenPOWER on IntegriCloud