NFC: retire iree.load_input, iree.store_output, and RewriteLegacyIO

These utilities are also related to the legacy pipeline. Now they
can go away too.

PiperOrigin-RevId: 309514740
diff --git a/iree/compiler/Dialect/HAL/Target/BUILD b/iree/compiler/Dialect/HAL/Target/BUILD
index 3d1b190..4d9d6f3 100644
--- a/iree/compiler/Dialect/HAL/Target/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/BUILD
@@ -18,24 +18,6 @@
 )
 
 cc_library(
-    name = "LegacyUtil",
-    srcs = ["LegacyUtil.cpp"],
-    hdrs = ["LegacyUtil.h"],
-    deps = [
-        "//iree/compiler/Dialect/Flow/IR",
-        "//iree/compiler/Dialect/HAL/IR",
-        "//iree/compiler/Dialect/HAL/Transforms",
-        "//iree/compiler/Dialect/IREE/IR",
-        "//iree/compiler/Utils",
-        "@llvm-project//mlir:IR",
-        "@llvm-project//mlir:Pass",
-        "@llvm-project//mlir:StandardOps",
-        "@llvm-project//mlir:Support",
-        "@llvm-project//mlir:Transforms",
-    ],
-)
-
-cc_library(
     name = "Target",
     srcs = [
         "TargetBackend.cpp",
diff --git a/iree/compiler/Dialect/HAL/Target/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/CMakeLists.txt
index ee6fa2d..0d9afcf 100644
--- a/iree/compiler/Dialect/HAL/Target/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/CMakeLists.txt
@@ -16,27 +16,6 @@
 
 iree_cc_library(
   NAME
-    LegacyUtil
-  HDRS
-    "LegacyUtil.h"
-  SRCS
-    "LegacyUtil.cpp"
-  DEPS
-    MLIRIR
-    MLIRPass
-    MLIRStandardOps
-    MLIRSupport
-    MLIRTransforms
-    iree::compiler::Dialect::Flow::IR
-    iree::compiler::Dialect::HAL::IR
-    iree::compiler::Dialect::HAL::Transforms
-    iree::compiler::Dialect::IREE::IR
-    iree::compiler::Utils
-  PUBLIC
-)
-
-iree_cc_library(
-  NAME
     Target
   HDRS
     "TargetBackend.h"
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
index 6715b26..265eb9b 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
@@ -30,7 +30,6 @@
         "//iree/compiler/Dialect/HAL/IR",
         "//iree/compiler/Dialect/HAL/IR:HALDialect",
         "//iree/compiler/Dialect/HAL/Target",
-        "//iree/compiler/Dialect/HAL/Target:LegacyUtil",
         "//iree/compiler/Dialect/IREE/IR",
         "//iree/compiler/Translation/CodegenPasses",
         "//iree/schemas:llvmir_executable_def_cc_fbs",
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
index f2c1dfa..8ed777c 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
@@ -39,7 +39,6 @@
     iree::compiler::Dialect::HAL::IR
     iree::compiler::Dialect::HAL::IR::HALDialect
     iree::compiler::Dialect::HAL::Target
-    iree::compiler::Dialect::HAL::Target::LegacyUtil
     iree::compiler::Dialect::IREE::IR
     iree::compiler::Translation::CodegenPasses
     iree::schemas::llvmir_executable_def_cc_fbs
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.cpp b/iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.cpp
index 354b490..1d06399 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.cpp
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/LLVMTarget.cpp
@@ -17,7 +17,6 @@
 #include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
 #include "iree/compiler/Dialect/HAL/IR/HALDialect.h"
 #include "iree/compiler/Dialect/HAL/IR/HALOps.h"
-#include "iree/compiler/Dialect/HAL/Target/LegacyUtil.h"
 #include "iree/compiler/Dialect/HAL/Target/TargetRegistry.h"
 #include "iree/compiler/Dialect/IREE/IR/IREEOps.h"
 #include "iree/compiler/Translation/CodegenPasses/Passes.h"
diff --git a/iree/compiler/Dialect/HAL/Target/LegacyUtil.cpp b/iree/compiler/Dialect/HAL/Target/LegacyUtil.cpp
deleted file mode 100644
index 5661a3d..0000000
--- a/iree/compiler/Dialect/HAL/Target/LegacyUtil.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2019 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "iree/compiler/Dialect/HAL/Target/LegacyUtil.h"
-
-#include "iree/compiler/Dialect/HAL/Transforms/Passes.h"
-#include "mlir/IR/Attributes.h"
-#include "mlir/IR/Function.h"
-#include "mlir/IR/Location.h"
-#include "mlir/Pass/Pass.h"
-#include "mlir/Pass/PassManager.h"
-
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace HAL {
-
-LogicalResult makeLegacyExecutableABI(IREE::HAL::ExecutableTargetOp targetOp) {
-  PassManager passManager(targetOp.getContext());
-
-  // Rewrite the hal.interface IO shim to use the legacy memref-based functions.
-  passManager.addPass(createRewriteLegacyIOPass());
-
-  if (failed(passManager.run(targetOp.getInnerModule()))) {
-    return targetOp.emitError()
-           << "required legacy rewriting/inlining failed (possibly "
-              "due to symbol resolution issues)";
-  }
-  return success();
-}
-
-}  // namespace HAL
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
diff --git a/iree/compiler/Dialect/HAL/Target/LegacyUtil.h b/iree/compiler/Dialect/HAL/Target/LegacyUtil.h
deleted file mode 100644
index 1816200..0000000
--- a/iree/compiler/Dialect/HAL/Target/LegacyUtil.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2019 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef IREE_COMPILER_DIALECT_HAL_TARGET_LEGACYUTIL_H_
-#define IREE_COMPILER_DIALECT_HAL_TARGET_LEGACYUTIL_H_
-
-#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
-#include "mlir/Support/LogicalResult.h"
-
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace HAL {
-
-// Inserts the iree.load_input/iree.store_output ops to match the legacy ABI.
-LogicalResult makeLegacyExecutableABI(IREE::HAL::ExecutableTargetOp targetOp);
-
-}  // namespace HAL
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
-
-#endif  // IREE_COMPILER_DIALECT_HAL_TARGET_LEGACYUTIL_H_
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
index a5dbaaa..bc1aae9 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
@@ -28,7 +28,6 @@
     deps = [
         "//iree/compiler/Dialect/Flow/IR",
         "//iree/compiler/Dialect/HAL/Target",
-        "//iree/compiler/Dialect/HAL/Target:LegacyUtil",
         "//iree/compiler/Dialect/IREE/IR",
         "//iree/compiler/Dialect/Vulkan/IR",
         "//iree/compiler/Dialect/Vulkan/Utils",
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
index 07a26d6..80d5f4e 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
@@ -34,7 +34,6 @@
     flatbuffers
     iree::compiler::Dialect::Flow::IR
     iree::compiler::Dialect::HAL::Target
-    iree::compiler::Dialect::HAL::Target::LegacyUtil
     iree::compiler::Dialect::IREE::IR
     iree::compiler::Dialect::Vulkan::IR
     iree::compiler::Dialect::Vulkan::Utils
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/VulkanSPIRVTarget.cpp b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/VulkanSPIRVTarget.cpp
index ea1e40c..e00a53c 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/VulkanSPIRVTarget.cpp
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/VulkanSPIRVTarget.cpp
@@ -18,7 +18,6 @@
 
 #include "flatbuffers/flatbuffers.h"
 #include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
-#include "iree/compiler/Dialect/HAL/Target/LegacyUtil.h"
 #include "iree/compiler/Dialect/HAL/Target/TargetRegistry.h"
 #include "iree/compiler/Dialect/Vulkan/IR/VulkanAttributes.h"
 #include "iree/compiler/Dialect/Vulkan/Utils/TargetEnvUtils.h"
diff --git a/iree/compiler/Dialect/HAL/Transforms/BUILD b/iree/compiler/Dialect/HAL/Transforms/BUILD
index 518a340..606be42 100644
--- a/iree/compiler/Dialect/HAL/Transforms/BUILD
+++ b/iree/compiler/Dialect/HAL/Transforms/BUILD
@@ -27,7 +27,6 @@
         "MemoizeDeviceQueries.cpp",
         "Passes.cpp",
         "PublicAbiGeneration.cpp",
-        "RewriteLegacyIO.cpp",
         "SerializeExecutables.cpp",
         "TranslateExecutables.cpp",
     ],
diff --git a/iree/compiler/Dialect/HAL/Transforms/CMakeLists.txt b/iree/compiler/Dialect/HAL/Transforms/CMakeLists.txt
index f17ac9b..3da40bf 100644
--- a/iree/compiler/Dialect/HAL/Transforms/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Transforms/CMakeLists.txt
@@ -27,7 +27,6 @@
     "MemoizeDeviceQueries.cpp"
     "Passes.cpp"
     "PublicAbiGeneration.cpp"
-    "RewriteLegacyIO.cpp"
     "SerializeExecutables.cpp"
     "TranslateExecutables.cpp"
   DEPS
diff --git a/iree/compiler/Dialect/HAL/Transforms/Passes.h b/iree/compiler/Dialect/HAL/Transforms/Passes.h
index 5dae44e..fc28a3a 100644
--- a/iree/compiler/Dialect/HAL/Transforms/Passes.h
+++ b/iree/compiler/Dialect/HAL/Transforms/Passes.h
@@ -67,13 +67,6 @@
 std::unique_ptr<OperationPass<ModuleOp>> createMaterializeInterfacesPass(
     TargetOptions executableOptions);
 
-// Rewrites hal.interface IO shims to look like the legacy IREE
-// load_input/store_output form. This is incompatible with dynamic shapes and
-// advanced descriptor set usage and will be removed as soon as the existing
-// backends using it are ported to hal.interface.
-std::unique_ptr<OperationPass<IREE::Flow::ExecutableOp>>
-createRewriteLegacyIOPass();
-
 // Translates hal.executable.target ops via a nested translation pipeline.
 std::unique_ptr<OperationPass<IREE::HAL::ExecutableOp>>
 createTranslateExecutablesPass(TargetOptions executableOptions);
@@ -113,7 +106,6 @@
   createInlineDeviceSwitchesPass();
   createMemoizeDeviceQueriesPass();
   createMaterializeInterfacesPass(executableOptions);
-  createRewriteLegacyIOPass();
   createTranslateExecutablesPass(executableOptions);
   createLinkExecutablesPass(executableOptions);
   createSerializeExecutablesPass(executableOptions);
diff --git a/iree/compiler/Dialect/HAL/Transforms/RewriteLegacyIO.cpp b/iree/compiler/Dialect/HAL/Transforms/RewriteLegacyIO.cpp
deleted file mode 100644
index bf53236..0000000
--- a/iree/compiler/Dialect/HAL/Transforms/RewriteLegacyIO.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2020 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include <utility>
-
-#include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
-#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
-#include "iree/compiler/Dialect/HAL/Transforms/Passes.h"
-#include "iree/compiler/Dialect/IREE/IR/IREEOps.h"
-#include "iree/compiler/Utils/TypeConversionUtils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/IR/Attributes.h"
-#include "mlir/IR/Builders.h"
-#include "mlir/IR/Diagnostics.h"
-#include "mlir/IR/StandardTypes.h"
-#include "mlir/IR/SymbolTable.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-namespace iree_compiler {
-namespace IREE {
-namespace HAL {
-
-// TODO(b/150312935): remove this when the SPIR-V and LLVM targets use
-// hal.interface.
-static void makeLegacyExecutableDispatchABI(
-    IREE::Flow::DispatchEntryOp dispatchEntryOp, FuncOp thunkOp) {
-  auto *context = thunkOp.getContext();
-
-  auto implOp = thunkOp.getParentOfType<ModuleOp>().lookupSymbol<FuncOp>(
-      (thunkOp.getName() + "_impl").str());
-  implOp.setAttr("iree.executable.export", UnitAttr::get(context));
-
-  // Destroy the IO op and replace with the original entry.
-  SymbolTable::setSymbolVisibility(implOp, SymbolTable::Visibility::Public);
-  auto originalName = thunkOp.getName();
-  thunkOp.erase();
-  implOp.setName(originalName);
-
-  // Reset function type to memrefs with output args.
-  SmallVector<Type, 4> inputTypes;
-  for (const auto &oldType : implOp.getType().getInputs()) {
-    inputTypes.push_back(
-        convertLegacyTypeToMemRef(legalizeLegacyType(oldType)));
-  }
-  SmallVector<Type, 4> outputTypes;
-  for (const auto &oldType : implOp.getType().getResults()) {
-    outputTypes.push_back(
-        convertLegacyTypeToMemRef(legalizeLegacyType(oldType)));
-  }
-  inputTypes.append(outputTypes.begin(), outputTypes.end());
-  auto funcType = FunctionType::get(inputTypes, {}, context);
-  implOp.setType(funcType);
-
-  // Rewrite the entry block to match the new args for inputs.
-  auto &entryBlock = implOp.getBlocks().front();
-  auto oldArgs = entryBlock.getArguments().vec();
-  OpBuilder entryBuilder = OpBuilder::atBlockEnd(&entryBlock);
-  entryBuilder.setInsertionPointToStart(&entryBlock);
-  for (auto arg : entryBlock.getArguments()) {
-    Type oldType = arg.getType();
-    arg.setType(convertLegacyTypeToMemRef(legalizeLegacyType(oldType)));
-    auto loadInputOp = entryBuilder.create<IREE::LoadInputOp>(
-        dispatchEntryOp.getLoc(), oldType, arg);
-    arg.replaceAllUsesWith(loadInputOp.getResult());
-    loadInputOp.setOperand(arg);
-  }
-
-  // Add output args and replace returns with stores.
-  auto outputArgs = llvm::to_vector<4>(entryBlock.addArguments(outputTypes));
-  SmallVector<Operation *, 4> deadOps;
-  implOp.walk([&](mlir::ReturnOp returnOp) {
-    OpBuilder returnBuilder(returnOp);
-    for (auto operand : llvm::enumerate(returnOp.getOperands())) {
-      returnBuilder.create<IREE::StoreOutputOp>(
-          returnOp.getLoc(), operand.value(), outputArgs[operand.index()]);
-    }
-    returnBuilder.create<mlir::ReturnOp>(returnOp.getLoc());
-    deadOps.push_back(returnOp);
-  });
-  for (auto *deadOp : deadOps) deadOp->erase();
-}
-
-class RewriteLegacyIOPass
-    : public PassWrapper<RewriteLegacyIOPass,
-                         OperationPass<IREE::Flow::ExecutableOp>> {
- public:
-  void runOnOperation() override {
-    auto executableOp = getOperation();
-    auto moduleOp = executableOp.getInnerModule();
-
-    // Rewrite entry functions.
-    for (auto &op : executableOp.getBlock()) {
-      if (auto entryOp = dyn_cast<IREE::Flow::DispatchEntryOp>(&op)) {
-        auto thunkOp = moduleOp.lookupSymbol<FuncOp>(entryOp.function_ref());
-        makeLegacyExecutableDispatchABI(entryOp, thunkOp);
-      }
-    }
-
-    // Drop unneeded interface ops.
-    auto interfaceOps =
-        llvm::to_vector<4>(moduleOp.getOps<IREE::HAL::InterfaceOp>());
-    for (auto interfaceOp : interfaceOps) {
-      interfaceOp.erase();
-    }
-  }
-};
-
-std::unique_ptr<OperationPass<IREE::Flow::ExecutableOp>>
-createRewriteLegacyIOPass() {
-  return std::make_unique<RewriteLegacyIOPass>();
-}
-
-static PassRegistration<RewriteLegacyIOPass> pass(
-    "iree-hal-rewrite-legacy-io",
-    "Rewrites hal.interface usage to legacy iree.load_input/iree.store_output");
-
-}  // namespace HAL
-}  // namespace IREE
-}  // namespace iree_compiler
-}  // namespace mlir
diff --git a/iree/compiler/Dialect/HAL/Transforms/test/rewrite_legacy_io.mlir b/iree/compiler/Dialect/HAL/Transforms/test/rewrite_legacy_io.mlir
deleted file mode 100644
index 938f4bc..0000000
--- a/iree/compiler/Dialect/HAL/Transforms/test/rewrite_legacy_io.mlir
+++ /dev/null
@@ -1,34 +0,0 @@
-// RUN: iree-opt -split-input-file -iree-hal-rewrite-legacy-io %s | IreeFileCheck %s
-
-flow.executable @simpleMath_ex_dispatch_0 {
-  flow.dispatch.entry @simpleMath_rgn_dispatch_0 attributes {workload = 4 : index}
-  module {
-    func @simpleMath_rgn_dispatch_0() {
-      %c0 = constant 0 : index
-      %0 = hal.interface.load.tensor @legacy_io::@arg0, offset = %c0 : tensor<4xf32>
-      %1 = call @simpleMath_rgn_dispatch_0_impl(%0) : (tensor<4xf32>) -> tensor<4xf32>
-      hal.interface.store.tensor %1, @legacy_io::@ret0, offset = %c0 : tensor<4xf32>
-      return
-    }
-    func @simpleMath_rgn_dispatch_0_impl(%arg0: tensor<4xf32>) -> tensor<4xf32> attributes {sym_visibility = "private"} {
-      %0 = xla_hlo.add %arg0, %arg0 : tensor<4xf32>
-      return %0 : tensor<4xf32>
-    }
-    hal.interface @legacy_io attributes {sym_visibility = "private"} {
-      hal.interface.binding @arg0, set=0, binding=0, type="StorageBuffer", access="Read"
-      hal.interface.binding @ret0, set=0, binding=1, type="StorageBuffer", access="Write|Discard"
-    }
-  }
-}
-
-// CHECK-LABEL: flow.executable @simpleMath_ex_dispatch_0 {
-// CHECK-NEXT:   flow.dispatch.entry @simpleMath_rgn_dispatch_0 attributes {workload = 4 : index}
-// CHECK-NEXT:   module {
-// CHECK-NEXT:     func @simpleMath_rgn_dispatch_0(%arg0: memref<4xf32>, %arg1: memref<4xf32>) attributes {iree.executable.export} {
-// CHECK-NEXT:       %0 = iree.load_input(%arg0 : memref<4xf32>) : tensor<4xf32>
-// CHECK-NEXT:       %1 = xla_hlo.add %0, %0 : tensor<4xf32>
-// CHECK-NEXT:       iree.store_output(%1 : tensor<4xf32>, %arg1 : memref<4xf32>)
-// CHECK-NEXT:       return
-// CHECK-NEXT:     }
-// CHECK-NEXT:   }
-// CHECK-NEXT: }
diff --git a/iree/compiler/Dialect/IREE/IR/IREEOps.td b/iree/compiler/Dialect/IREE/IR/IREEOps.td
index be19daf..51d4bce 100644
--- a/iree/compiler/Dialect/IREE/IR/IREEOps.td
+++ b/iree/compiler/Dialect/IREE/IR/IREEOps.td
@@ -35,18 +35,6 @@
 // Executable ABI
 //===----------------------------------------------------------------------===//
 
-def IREE_LoadInputOp : IREE_PureOp<"load_input"> {
-  let summary = "Loading input from a buffer";
-  let description = "Note: this is expected to be deprecated soon.";
-
-  let arguments = (ins IREE_MemRef:$src);
-  let results = (outs AnyType);
-
-  let assemblyFormat = [{
-    `(` $src `:` type($src) `)` attr-dict `:` type(results)
-  }];
-}
-
 def IREE_PlaceholderOp : IREE_Op<"placeholder", [MemoryEffects<[MemAlloc]>]> {
   let summary = "A placeholder op to feed a value/buffer into computation";
   let description = [{
@@ -63,17 +51,6 @@
   let assemblyFormat = [{ `for` $purpose attr-dict `:` type($output) }];
 }
 
-def IREE_StoreOutputOp : IREE_Op<"store_output"> {
-  let summary = "Storing output to a buffer";
-  let description = "Note: this is expected to be deprecated soon.";
-
-  let arguments = (ins AnyType:$src, IREE_MemRef:$dst);
-
-  let assemblyFormat = [{
-    `(` $src `:` type($src) `,` $dst `:` type($dst) `)` attr-dict
-  }];
-}
-
 //===----------------------------------------------------------------------===//
 // Compiler hints
 //===----------------------------------------------------------------------===//
diff --git a/iree/compiler/Dialect/IREE/IR/test/bindings.mlir b/iree/compiler/Dialect/IREE/IR/test/bindings.mlir
deleted file mode 100644
index 8ba3c12..0000000
--- a/iree/compiler/Dialect/IREE/IR/test/bindings.mlir
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: iree-opt %s | IreeFileCheck %s
-
-// CHECK-LABEL: @dispatch_entry
-func @dispatch_entry(%arg0: memref<4x2xf32>, %arg1: memref<4x2xf32>) {
-  // CHECK-NEXT: %0 = iree.load_input(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
-  %0 = iree.load_input(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
-  // CHECK-NEXT: iree.store_output(%0 : tensor<4x2xf32>, %arg1 : memref<4x2xf32>)
-  iree.store_output(%0 : tensor<4x2xf32>, %arg1 : memref<4x2xf32>)
-  return
-}
diff --git a/iree/compiler/Translation/CodegenPasses/test/pw_linalg_fusion.mlir b/iree/compiler/Translation/CodegenPasses/test/pw_linalg_fusion.mlir
index c7db403..8ee51ea 100644
--- a/iree/compiler/Translation/CodegenPasses/test/pw_linalg_fusion.mlir
+++ b/iree/compiler/Translation/CodegenPasses/test/pw_linalg_fusion.mlir
@@ -1,11 +1,7 @@
 // RUN: iree-opt -split-input-file -iree-hlo-to-linalg-on-tensors -iree-linalg-fusion %s | IreeFileCheck %s
 
 // CHECK-LABEL: @pw_fusion_two
-func @pw_fusion_two(%arg0: memref<4x8xi32>, %arg1: memref<4x8xi32>, %arg2 : memref<4x8xi32>, %arg3: memref<4x8xi32>)
-attributes {iree.dispatch_fn_name = ""} {
-  %0 = iree.load_input(%arg0 : memref<4x8xi32>) : tensor<4x8xi32>
-  %1 = iree.load_input(%arg1 : memref<4x8xi32>) : tensor<4x8xi32>
-  %2 = iree.load_input(%arg2 : memref<4x8xi32>) : tensor<4x8xi32>
+func @pw_fusion_two(%arg0: tensor<4x8xi32>, %arg1: tensor<4x8xi32>, %arg2 : tensor<4x8xi32>) -> tensor<4x8xi32> {
   // CHECK: linalg.generic
   // CHECK: ^{{[a-zA-Z0-9$._-]+}}
   // CHECK-SAME: %[[ARG0:[a-zA-Z0-9$._-]+]]: i32
@@ -14,21 +10,15 @@
   // CHECK: %[[TEMP:[a-zA-Z0-9$._-]+]] = muli %[[ARG0]], %[[ARG1]]
   // CHECK: addi %[[TEMP]], %[[ARG2]]
   // CHECK-NOT: linalg.generic
-  %4 = "xla_hlo.multiply"(%0, %1) : (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  %5 = "xla_hlo.add"(%4, %2) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  iree.store_output(%5 : tensor<4x8xi32>, %arg3 : memref<4x8xi32>)
-  return
+  %4 = "xla_hlo.multiply"(%arg0, %arg1) : (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  %5 = "xla_hlo.add"(%4, %arg2) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  return %5 : tensor<4x8xi32>
 }
 
 // -----
 
 // CHECK-LABEL: @pw_fusion_three
-func @pw_fusion_three(%arg0: memref<4x8xi32>, %arg1: memref<4x8xi32>, %arg2 : memref<4x8xi32>, %arg3: memref<4x8xi32>, %arg4: memref<4x8xi32>)
-attributes {iree.dispatch_fn_name = ""} {
-  %0 = iree.load_input(%arg0 : memref<4x8xi32>) : tensor<4x8xi32>
-  %1 = iree.load_input(%arg1 : memref<4x8xi32>) : tensor<4x8xi32>
-  %2 = iree.load_input(%arg2 : memref<4x8xi32>) : tensor<4x8xi32>
-  %3 = iree.load_input(%arg3 : memref<4x8xi32>) : tensor<4x8xi32>
+func @pw_fusion_three(%arg0: tensor<4x8xi32>, %arg1: tensor<4x8xi32>, %arg2 : tensor<4x8xi32>, %arg3: tensor<4x8xi32>) -> tensor<4x8xi32> {
   // CHECK: linalg.generic
   // CHECK: ^{{[a-zA-Z0-9$._-]+}}
   // CHECK-SAME: %[[ARG0:[a-zA-Z0-9$._-]+]]: i32
@@ -39,22 +29,16 @@
   // CHECK: %[[TEMP2:[a-zA-Z0-9$._-]+]] = addi %[[TEMP1]], %[[ARG2]]
   // CHECK: subi %[[TEMP2]], %[[ARG3]]
   // CHECK-NOT: linalg.generic
-  %4 = "xla_hlo.multiply"(%0, %1) : (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  %5 = "xla_hlo.add"(%4, %2) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  %6 = "xla_hlo.subtract"(%5, %3) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  iree.store_output(%6 : tensor<4x8xi32>, %arg4 : memref<4x8xi32>)
-  return
+  %4 = "xla_hlo.multiply"(%arg0, %arg1) : (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  %5 = "xla_hlo.add"(%4, %arg2) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  %6 = "xla_hlo.subtract"(%5, %arg3) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  return %6: tensor<4x8xi32>
 }
 
 // -----
 
 // CHECK-LABEL: @pw_fusion_dag
-func @pw_fusion_dag(%arg0: memref<4x8xi32>, %arg1: memref<4x8xi32>, %arg2 : memref<4x8xi32>, %arg3: memref<4x8xi32>, %arg4: memref<4x8xi32>)
-attributes {iree.dispatch_fn_name = ""} {
-  %0 = iree.load_input(%arg0 : memref<4x8xi32>) : tensor<4x8xi32>
-  %1 = iree.load_input(%arg1 : memref<4x8xi32>) : tensor<4x8xi32>
-  %2 = iree.load_input(%arg2 : memref<4x8xi32>) : tensor<4x8xi32>
-  %3 = iree.load_input(%arg3 : memref<4x8xi32>) : tensor<4x8xi32>
+func @pw_fusion_dag(%arg0: tensor<4x8xi32>, %arg1: tensor<4x8xi32>, %arg2 : tensor<4x8xi32>, %arg3: tensor<4x8xi32>) -> tensor<4x8xi32> {
   // CHECK: linalg.generic
   // CHECK: ^{{[a-zA-Z0-9$._-]+}}
   // CHECK-SAME: %[[ARG0:[a-zA-Z0-9$._-]+]]: i32
@@ -65,21 +49,16 @@
   // CHECK-DAG: %[[TEMP2:[a-zA-Z0-9$._-]+]] = addi %[[ARG2]], %[[ARG3]]
   // CHECK: subi %[[TEMP1]], %[[TEMP2]]
   // CHECK-NOT: linalg.generic
-  %4 = "xla_hlo.multiply"(%0, %1) : (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  %5 = "xla_hlo.add"(%2, %3) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  %4 = "xla_hlo.multiply"(%arg0, %arg1) : (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  %5 = "xla_hlo.add"(%arg2, %arg3) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
   %6 = "xla_hlo.subtract"(%4, %5) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  iree.store_output(%6 : tensor<4x8xi32>, %arg4 : memref<4x8xi32>)
-  return
+  return %6: tensor<4x8xi32>
 }
 
 // -----
 
 // CHECK-LABEL: @pw_fusion_dag2
-func @pw_fusion_dag2(%arg0: memref<4x8xi32>, %arg1: memref<4x8xi32>, %arg2 : memref<4x8xi32>, %arg3: memref<4x8xi32>)
-attributes {iree.dispatch_fn_name = ""} {
-  %0 = iree.load_input(%arg0 : memref<4x8xi32>) : tensor<4x8xi32>
-  %1 = iree.load_input(%arg1 : memref<4x8xi32>) : tensor<4x8xi32>
-  %2 = iree.load_input(%arg2 : memref<4x8xi32>) : tensor<4x8xi32>
+func @pw_fusion_dag2(%arg0: tensor<4x8xi32>, %arg1: tensor<4x8xi32>, %arg2 : tensor<4x8xi32>) -> tensor<4x8xi32> {
   // CHECK: linalg.generic
   // CHECK: ^{{[a-zA-Z0-9$._-]+}}
   // CHECK-SAME: %[[ARG0:[a-zA-Z0-9$._-]+]]: i32
@@ -90,9 +69,8 @@
   // CHECK-DAG: %[[TEMP2:[a-zA-Z0-9$._-]+]] = addi %[[ARG2]], %[[ARG3]]
   // CHECK: subi %[[TEMP1]], %[[TEMP2]]
   // CHECK-NOT: linalg.generic
-  %3 = "xla_hlo.multiply"(%0, %1) : (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  %4 = "xla_hlo.add"(%0, %2) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  %3 = "xla_hlo.multiply"(%arg0, %arg1) : (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
+  %4 = "xla_hlo.add"(%arg0, %arg2) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
   %5 = "xla_hlo.subtract"(%3, %4) :  (tensor<4x8xi32>, tensor<4x8xi32>) -> tensor<4x8xi32>
-  iree.store_output(%5 : tensor<4x8xi32>, %arg3 : memref<4x8xi32>)
-  return
+  return %5: tensor<4x8xi32>
 }