[Transform] Switching to upstream transform.apply_cse ops. (#16108)

The op is upstreamed in
https://github.com/llvm/llvm-project/commit/2c95ede4d1831e9bf5a5f7075150e92d2c99b7d2
The revision retires IREE ApplyCommonSubexpressionEliminationOp, and
uses the upstream version.

The MLIR file changes are updated by `sed -i '' -e
"s/transform.iree.apply_cse/transform.apply_cse to/g" **/*.mlir`
command.
diff --git a/compiler/src/iree/compiler/Codegen/Common/GPU/test/transform_gpu_distribute_shared_memory.mlir b/compiler/src/iree/compiler/Codegen/Common/GPU/test/transform_gpu_distribute_shared_memory.mlir
index 5407315..23a795c 100644
--- a/compiler/src/iree/compiler/Codegen/Common/GPU/test/transform_gpu_distribute_shared_memory.mlir
+++ b/compiler/src/iree/compiler/Codegen/Common/GPU/test/transform_gpu_distribute_shared_memory.mlir
@@ -78,7 +78,7 @@
         transform.apply_patterns.canonicalization
         transform.apply_patterns.linalg.tiling_canonicalization
       } : !transform.any_op
-      transform.iree.apply_cse %func : !transform.any_op
+      transform.apply_cse to %func : !transform.any_op
       transform.yield
     }
 }
diff --git a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp
index 4eec9cb..810b7ea 100644
--- a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp
+++ b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp
@@ -255,45 +255,6 @@
 }
 
 //===---------------------------------------------------------------------===//
-// ApplyCommonSubexpressionEliminationOp
-//===---------------------------------------------------------------------===//
-
-DiagnosedSilenceableFailure
-transform_dialect::ApplyCommonSubexpressionEliminationOp::applyToOne(
-    transform::TransformRewriter &rewriter, Operation *target,
-    transform::ApplyToEachResultList &results,
-    transform::TransformState &state) {
-  ErrorCheckingTrackingListener listener(state, *this);
-  Operation *lastOpVisited = nullptr;
-
-  WalkResult status = target->walk<WalkOrder::PreOrder>([&](Operation *op) {
-    if (op->hasTrait<OpTrait::IsIsolatedFromAbove>()) {
-      DominanceInfo domInfo;
-      lastOpVisited = op;
-      eliminateCommonSubExpressions(rewriter, domInfo, op);
-      if (listener.failed())
-        return WalkResult::interrupt();
-      return WalkResult::skip();
-    }
-    return WalkResult::advance();
-  });
-
-  if (!status.wasInterrupted())
-    return DiagnosedSilenceableFailure::success();
-
-  if (listener.failed())
-    return listener.checkAndResetError();
-
-  return mlir::emitDefiniteFailure(lastOpVisited, "CSE failed");
-}
-
-void transform_dialect::ApplyCommonSubexpressionEliminationOp::getEffects(
-    SmallVectorImpl<MemoryEffects::EffectInstance> &effects) {
-  transform::onlyReadsHandle(getTarget(), effects);
-  transform::modifiesPayload(effects);
-}
-
-//===---------------------------------------------------------------------===//
 // ApplyLoopIndependentCodeMotionOp
 //===---------------------------------------------------------------------===//
 
diff --git a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensionsOps.td b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensionsOps.td
index e355ae6..edd003f 100644
--- a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensionsOps.td
+++ b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensionsOps.td
@@ -168,34 +168,6 @@
   let assemblyFormat = "attr-dict";
 }
 
-def ApplyCommonSubexpressionEliminationOp : Op<Transform_Dialect, "iree.apply_cse",
-    [DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
-     TransformEachOpTrait,
-     TransformOpInterface,
-     ReportTrackingListenerFailuresOpTrait]> {
-  let description = [{
-    Apply common subexpression elimination. This transform is applied to all
-    ops within the target that are isolated from above.
-
-    #### Return modes
-
-    This operation does not consume the target handle and does not produce any
-    handle.
-  }];
-
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let assemblyFormat = "$target attr-dict `:` type($target)";
-  let cppNamespace = "mlir::iree_compiler::IREE::transform_dialect";
-
-  let extraClassDeclaration = [{
-    ::mlir::DiagnosedSilenceableFailure applyToOne(
-        ::mlir::transform::TransformRewriter &rewriter,
-        ::mlir::Operation *target,
-        ::mlir::transform::ApplyToEachResultList &results,
-        ::mlir::transform::TransformState &state);
-  }];
-}
-
 def ApplyLoopIndependentCodeMotionOp : Op<Transform_Dialect, "iree.apply_licm",
     [DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
      TransformEachOpTrait,
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/attention_transform_spec.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/attention_transform_spec.mlir
index 17b2157..627b6d3 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/attention_transform_spec.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/attention_transform_spec.mlir
@@ -19,7 +19,7 @@
     transform.apply_patterns to %top_level_func {
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %top_level_func : !transform.any_op
+    transform.apply_cse to %top_level_func : !transform.any_op
 
     // Promote query and output operands
     // ==========================================
@@ -53,31 +53,31 @@
     %f1, %loop1 = transform.structured.fuse_into_containing_op %truncate into %loop0 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
 
     %func = transform.structured.match ops{["func.func"]} in %variant_op : (!transform.any_op) -> !transform.any_op
-    transform.iree.apply_cse %func : !transform.any_op
+    transform.apply_cse to %func : !transform.any_op
 
     %loop4 = transform.loop.fuse_sibling %forall_reduce into %loop1 : (!transform.any_op, !transform.any_op) -> !transform.any_op
-    transform.iree.apply_cse %func : !transform.any_op
+    transform.apply_cse to %func : !transform.any_op
 
     %f5_1, %loop5_1 = transform.structured.fuse_into_containing_op %update into %loop4 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
-    transform.iree.apply_cse %func : !transform.any_op
+    transform.apply_cse to %func : !transform.any_op
 
     %f5, %loop5 = transform.structured.fuse_into_containing_op %scale_factor into %loop5_1 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
     %f6, %loop6 = transform.structured.fuse_into_containing_op %partial_softmax into %loop5 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
-    transform.iree.apply_cse %func : !transform.any_op
+    transform.apply_cse to %func : !transform.any_op
 
     %f7, %loop7 = transform.structured.fuse_into_containing_op %reduce_max into %loop6 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
     %f8, %loop8 = transform.structured.fuse_into_containing_op %promoted_first_matmul into %loop7 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
     transform.apply_patterns to %func {
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func : !transform.any_op
+    transform.apply_cse to %func : !transform.any_op
 
     %f9, %loop9 = transform.structured.fuse_into_containing_op %fill_op into %loop8 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
 
     transform.apply_patterns to %func {
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func : !transform.any_op
+    transform.apply_cse to %func : !transform.any_op
 
     // Distribute fills
     // ==========================================
@@ -92,7 +92,7 @@
     transform.apply_patterns to %func {
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func : !transform.any_op
+    transform.apply_cse to %func : !transform.any_op
 
     // Vectorize function
     // ==========================================
@@ -112,7 +112,7 @@
       transform.apply_patterns.linalg.tiling_canonicalization
       transform.apply_patterns.scf.for_loop_canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_3 : !transform.any_op
+    transform.apply_cse to %func_3 : !transform.any_op
     transform.iree.eliminate_empty_tensors %variant_op : (!transform.any_op) -> ()
     transform.apply_patterns to %func_3 { transform.apply_patterns.linalg.erase_unnecessary_inputs } : !transform.any_op
     %variant_op_3 = transform.iree.bufferize { target_gpu } %variant_op : (!transform.any_op) -> (!transform.any_op)
@@ -137,13 +137,13 @@
     transform.apply_patterns to %func_7 {
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_7 : !transform.any_op
+    transform.apply_cse to %func_7 : !transform.any_op
     %func_8 = transform.structured.hoist_redundant_vector_transfers %func_7
     : (!transform.any_op) -> !transform.any_op
     transform.apply_patterns to %func_8 {
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_8 : !transform.any_op
+    transform.apply_cse to %func_8 : !transform.any_op
     transform.memref.erase_dead_alloc_and_stores %func_8 : (!transform.any_op) -> ()
     transform.yield
   }
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/layout_analysis_and_distribution.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/layout_analysis_and_distribution.mlir
index aff4f69..fe82423 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/layout_analysis_and_distribution.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/layout_analysis_and_distribution.mlir
@@ -982,7 +982,7 @@
   transform.named_sequence @__transform_main(%variant_op: !transform.any_op {transform.readonly}) {
     %top_level_func = transform.structured.match ops{["func.func"]} in %variant_op : (!transform.any_op) -> !transform.any_op
     %reordered_func = transform.iree.reorder_transpose %top_level_func : (!transform.any_op) -> !transform.any_op
-    transform.iree.apply_cse %reordered_func : !transform.any_op
+    transform.apply_cse to %reordered_func : !transform.any_op
     transform.yield
   }
 } // module
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_batch_matmul.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_batch_matmul.mlir
index be05366..31bb131 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_batch_matmul.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_batch_matmul.mlir
@@ -62,7 +62,7 @@
 // OPTIONS:   tile_sizes [128, 64, 32](mapping = [#gpu.block<z>, #gpu.block<y>, #gpu.block<x>])
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   %[[FUSED:.+]], %[[CONTAINING:.+]] = transform.structured.fuse_into_containing_op %[[MATCH]]#0 into %[[FORALL]]
 // CHECK:   transform.iree.populate_workgroup_count_region_using_num_threads_slice %[[FORALL]]
 // CHECK:   %[[TILED_LINALG:.+]], %[[LOOPS:.+]] = transform.structured.tile_using_for %tiled_op
@@ -75,11 +75,11 @@
 // CHECK:   transform.structured.hoist_pad %{{.*}} by 1 loops
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   %[[FILL:.+]] = transform.structured.match ops{["linalg.fill"]}
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   transform.structured.match ops{["tensor.parallel_insert_slice"]}
 // CHECK:   transform.structured.insert_slice_to_copy
 // CHECK:   %[[LHS:.+]] = transform.get_producer_of_operand %[[PADDED]][0]
@@ -91,7 +91,7 @@
 // OPTIONS:  num_threads [1, 64, 2](mapping = [#gpu.thread<linear_dim_2>, #gpu.thread<linear_dim_1>, #gpu.thread<linear_dim_0>])
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   transform.structured.match ops{["scf.if"]}
 // CHECK:   transform.scf.take_assumed_branch %{{.*}} take_else_branch
 
@@ -100,31 +100,31 @@
 // OPTIONS:  num_threads [2, 8, 8](mapping = [#gpu.thread<linear_dim_2>, #gpu.thread<linear_dim_1>, #gpu.thread<linear_dim_0>])
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 
 // CHECK:   transform.structured.tile_using_forall
 // DEFAULT:  num_threads [2, 64, 1](mapping = [#gpu.thread<linear_dim_2>, #gpu.thread<linear_dim_1>, #gpu.thread<linear_dim_0>])
 // OPTIONS:  num_threads [1, 16, 8](mapping = [#gpu.thread<linear_dim_2>, #gpu.thread<linear_dim_1>, #gpu.thread<linear_dim_0>])
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 
 // CHECK:   transform.structured.tile_using_forall
 // DEFAULT:  num_threads [1, 2, 64](mapping = [#gpu.thread<z>, #gpu.thread<y>, #gpu.thread<x>])
 // OPTIONS:  num_threads [1, 4, 32](mapping = [#gpu.thread<z>, #gpu.thread<y>, #gpu.thread<x>])
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 
 // CHECK:   %tiled_op_8, %forall_op_9 = transform.structured.tile_using_forall %[[FILL]]
 // DEFAULT:   num_threads [1, 2, 64](mapping = [#gpu.thread<z>, #gpu.thread<y>, #gpu.thread<x>])
 // OPTIONS:   num_threads [1, 4, 32](mapping = [#gpu.thread<z>, #gpu.thread<y>, #gpu.thread<x>])
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 
 // CHECK:   transform.structured.vectorize
 // DEFAULT:   vector_sizes [64, 2, 4]
@@ -137,11 +137,11 @@
 // CHECK:   transform.structured.vectorize_children_and_apply_patterns
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   apply_patterns
 // CHECK:     transform.apply_patterns.canonicalization
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   transform.iree.eliminate_empty_tensors
 
 // CHECK:   transform.iree.bufferize {target_gpu}
@@ -153,7 +153,7 @@
 // CHECK:   transform.iree.eliminate_gpu_barriers
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   transform.iree.hoist_static_alloc
 // CHECK:   apply_patterns
 // CHECK:     transform.apply_patterns.memref.fold_memref_alias_ops
@@ -165,17 +165,17 @@
 // CHECK:     transform.apply_patterns.scf.for_loop_canonicalization
 // CHECK:     transform.apply_patterns.canonicalization
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   transform.iree.synchronize_loop
 // CHECK:   transform.structured.hoist_redundant_vector_transfers
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   transform.memref.erase_dead_alloc_and_stores
 // CHECK:   transform.iree.eliminate_gpu_barriers
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   apply_patterns
 // CHECK:     transform.apply_patterns.memref.fold_memref_alias_ops
 
@@ -186,11 +186,11 @@
 // CHECK:     transform.apply_patterns.vector.transfer_to_scf   full_unroll = true
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   transform.iree.create_async_groups
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
 // CHECK:   transform.iree.pipeline_shared_memory_copies
 // DEFAULT:   depth = 2
 // OPTIONS:   depth = 3
@@ -200,4 +200,4 @@
 // CHECK:     transform.apply_patterns.vector.materialize_masks
 // CHECK:   apply_patterns
 // CHECK:   transform.iree.apply_licm
-// CHECK:   transform.iree.apply_cse
+// CHECK:   transform.apply_cse to
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_matmul.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_matmul.mlir
index 34e2eba..19d4772 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_matmul.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_matmul.mlir
@@ -123,7 +123,7 @@
 // CHECK-DAG:   transform.apply_patterns.canonicalization
 // CHECK: } : !transform.any_op
 // CHECK: transform.iree.apply_licm
-// CHECK: transform.iree.apply_cse
+// CHECK: transform.apply_cse to
 
 // WITH_OPTIONS-LABEL: func @matmul_1
 
@@ -196,7 +196,7 @@
 // WITH_OPTIONS:   transform.apply_patterns.canonicalization
 // WITH_OPTIONS  }
 // WITH_OPTIONS: transform.iree.apply_licm
-// WITH_OPTIONS: transform.iree.apply_cse
+// WITH_OPTIONS: transform.apply_cse to
 
 
 // WITH_OPTIONS_2-LABEL: func @matmul_1
@@ -334,7 +334,7 @@
 // CHECK:        transform.apply_patterns.canonicalization
 // CHECK       }
 // CHECK:      transform.iree.apply_licm
-// CHECK:      transform.iree.apply_cse
+// CHECK:      transform.apply_cse to
 // CHECK:      %[[RES_PAD:.+]] = transform.get_producer_of_operand %{{.*}}[2]
 // CHECK:      %[[RES_COPY:.+]] = transform.structured.rewrite_in_destination_passing_style %[[RES_PAD]]
 // CHECK:      %[[LHS_PAD:.+]] = transform.get_producer_of_operand %{{.*}}[0]
@@ -350,7 +350,7 @@
 // CHECK:        transform.apply_patterns.canonicalization
 // CHECK       }
 // CHECK:      transform.iree.apply_licm
-// CHECK:      transform.iree.apply_cse
+// CHECK:      transform.apply_cse to
 
 // alignLhs
 // CHECK:      transform.structured.vectorize %[[TILED_LHS]] vector_sizes [4, 4]
@@ -408,7 +408,7 @@
 // CHECK:        transform.apply_patterns.canonicalization
 // CHECK       }
 // CHECK:      transform.iree.apply_licm
-// CHECK:      transform.iree.apply_cse
+// CHECK:      transform.apply_cse to
 // CHECK:      %[[RES_PAD:.+]] = transform.get_producer_of_operand %{{.*}}[2]
 // CHECK:      %[[RES_COPY:.+]] = transform.structured.rewrite_in_destination_passing_style %[[RES_PAD]]
 // CHECK:      %[[LHS_PAD:.+]] = transform.get_producer_of_operand %{{.*}}[0]
@@ -422,7 +422,7 @@
 // CHECK:        transform.apply_patterns.canonicalization
 // CHECK       }
 // CHECK:      transform.iree.apply_licm
-// CHECK:      transform.iree.apply_cse
+// CHECK:      transform.apply_cse to
 
 // Verify we don't go down the path without the flag.
 // WITH_OPTIONS-LABEL: func @aligned_matmul
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_pad.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_pad.mlir
index 118c0ac..49ee57c 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_pad.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/set_transform_strategy_pad.mlir
@@ -52,7 +52,7 @@
 //       CHECK:     transform.apply_patterns.canonicalization
 //       CHECK    }
 //       CHECK:   transform.iree.apply_licm
-//       CHECK:   transform.iree.apply_cse
+//       CHECK:   transform.apply_cse to
 //       CHECK:   {{.*}} = transform.structured.match ops{["scf.if"]} in {{.*}} : (!transform.any_op) -> !transform.any_op
 //       CHECK:   transform.scf.take_assumed_branch {{.*}} take_else_branch : (!transform.any_op) -> ()
 //       CHECK:   transform.iree.populate_workgroup_count_region_using_num_threads_slice {{.*}} : (!transform.any_op) -> ()
@@ -61,7 +61,7 @@
 //       CHECK:     transform.apply_patterns.canonicalization
 //       CHECK    }
 //       CHECK:   transform.iree.apply_licm
-//       CHECK:   transform.iree.apply_cse
+//       CHECK:   transform.apply_cse to
 //       CHECK:   {{.*}} = transform.structured.match ops{["scf.if"]} in {{.*}} : (!transform.any_op) -> !transform.any_op
 //       CHECK:   transform.scf.take_assumed_branch {{.*}} take_else_branch : (!transform.any_op) -> ()
 //       CHECK:   transform.structured.vectorize {{.*}} vector_sizes [4, 4] : !transform.any_op
@@ -77,7 +77,7 @@
 //       CHECK:     transform.apply_patterns.canonicalization
 //       CHECK    }
 //       CHECK:   transform.iree.apply_licm
-//       CHECK:   transform.iree.apply_cse
+//       CHECK:   transform.apply_cse to
 //       CHECK:   transform.iree.eliminate_empty_tensors {{.*}} : (!transform.any_op) -> ()
 //       CHECK:   {{.*}} = transform.iree.bufferize {target_gpu} {{.*}} : (!transform.any_op) -> !transform.any_op
 //       CHECK:   {{.*}} = transform.structured.match ops{["func.func"]} in {{.*}} : (!transform.any_op) -> !transform.any_op
@@ -93,7 +93,7 @@
 //   CHECK-DAG:     transform.apply_patterns.canonicalization
 //       CHECK:   } : !transform.any_op
 //       CHECK:   transform.iree.apply_licm
-//       CHECK:   transform.iree.apply_cse
+//       CHECK:   transform.apply_cse to
 
 // WITH_OPTIONS-LABEL: func @pad
 //       WITH_OPTIONS:   transform.structured.tile_using_forall {{.*}}   tile_sizes [32, 16](mapping = [#gpu.block<y>, #gpu.block<x>])
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_foreach_to_gpu_spec.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_foreach_to_gpu_spec.mlir
index 4a2276d..d8a1a99 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_foreach_to_gpu_spec.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_foreach_to_gpu_spec.mlir
@@ -24,7 +24,7 @@
       transform.apply_patterns.tensor.reassociative_reshape_folding
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func : !transform.any_op
+    transform.apply_cse to %func : !transform.any_op
     transform.iree.eliminate_empty_tensors %variant_op : (!transform.any_op) -> ()
     %variant_op_3 = transform.iree.bufferize %variant_op : (!transform.any_op) -> (!transform.any_op)
     %memref_func = transform.structured.match ops{["func.func"]} in %variant_op_3 : (!transform.any_op) -> !transform.any_op
@@ -39,7 +39,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %memref_func : !transform.any_op
-    transform.iree.apply_cse %memref_func : !transform.any_op
+    transform.apply_cse to %memref_func : !transform.any_op
     transform.yield
   }
 } // module
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_vector_distribution_spec.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_vector_distribution_spec.mlir
index 74d7e52..a24fecf 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_vector_distribution_spec.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_vector_distribution_spec.mlir
@@ -20,7 +20,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
 
     transform.yield
   }
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_vector_warp_execute_on_lane_0_spec.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_vector_warp_execute_on_lane_0_spec.mlir
index 29540c2..ddf7542 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_vector_warp_execute_on_lane_0_spec.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_codegen_vector_warp_execute_on_lane_0_spec.mlir
@@ -13,7 +13,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
     transform.yield
   }
 } // module
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_pack_shared_memory_alloc.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_pack_shared_memory_alloc.mlir
index 2654797..53f942b 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_pack_shared_memory_alloc.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_pack_shared_memory_alloc.mlir
@@ -29,7 +29,7 @@
   transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
   %0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op
   transform.iree.pack_shared_memory_alloc %0 : (!transform.any_op) -> ()
-  transform.iree.apply_cse %0 : !transform.any_op
+  transform.apply_cse to %0 : !transform.any_op
     transform.yield
   } // @__transform_main
 } // module
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_promote_operands.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_promote_operands.mlir
index 3d1ce7f..ee53dbe 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_promote_operands.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_promote_operands.mlir
@@ -45,7 +45,7 @@
         transform.apply_patterns.canonicalization
       } : !transform.any_op
       transform.iree.apply_licm %func_op : !transform.any_op
-      transform.iree.apply_cse %func_op : !transform.any_op
+      transform.apply_cse to %func_op : !transform.any_op
       transform.yield
     } // @__transform_main
   } // module
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_distribute_forall.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_distribute_forall.mlir
index 86b4321..bc92986 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_distribute_forall.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/transform_distribute_forall.mlir
@@ -60,7 +60,7 @@
             transform.apply_patterns.canonicalization
           } : !transform.any_op
           transform.iree.apply_licm %func_op : !transform.any_op
-          transform.iree.apply_cse %func_op : !transform.any_op
+          transform.apply_cse to %func_op : !transform.any_op
           transform.yield
         } // @__transform_main
       } // module
diff --git a/compiler/src/iree/compiler/Codegen/TransformStrategies/Common/Common.cpp b/compiler/src/iree/compiler/Codegen/TransformStrategies/Common/Common.cpp
index 4203118..210fb58 100644
--- a/compiler/src/iree/compiler/Codegen/TransformStrategies/Common/Common.cpp
+++ b/compiler/src/iree/compiler/Codegen/TransformStrategies/Common/Common.cpp
@@ -152,8 +152,7 @@
       populatePatternsFn(b, loc);
   });
   b.create<IREE::transform_dialect::ApplyLoopIndependentCodeMotionOp>(funcH);
-  b.create<IREE::transform_dialect::ApplyCommonSubexpressionEliminationOp>(
-      funcH);
+  b.create<mlir::transform::ApplyCommonSubexpressionEliminationOp>(funcH);
 }
 
 /// Dynamically selects the first non-empty handle; i.e. if (h1, h2) is:
diff --git a/compiler/src/iree/compiler/Codegen/TransformStrategies/GPU/Common.cpp b/compiler/src/iree/compiler/Codegen/TransformStrategies/GPU/Common.cpp
index 39febf9..f9ff605 100644
--- a/compiler/src/iree/compiler/Codegen/TransformStrategies/GPU/Common.cpp
+++ b/compiler/src/iree/compiler/Codegen/TransformStrategies/GPU/Common.cpp
@@ -573,8 +573,7 @@
   b.create<transform::ApplyPatternsOp>(funcH, [](OpBuilder &b, Location loc) {
     b.create<transform::ApplyFoldMemrefAliasOpsPatternsOp>(loc);
   });
-  b.create<IREE::transform_dialect::ApplyCommonSubexpressionEliminationOp>(
-      funcH);
+  b.create<mlir::transform::ApplyCommonSubexpressionEliminationOp>(funcH);
   // TODO: not a functional style transform and avoid returning funcH.
   funcH = b.create<transform::HoistRedundantVectorTransfersOp>(
       transform::AnyOpType::get(b.getContext()), funcH);
@@ -685,8 +684,7 @@
     b.create<transform::ApplyCanonicalizationPatternsOp>(loc);
   });
   b.create<IREE::transform_dialect::ApplyLoopIndependentCodeMotionOp>(funcH);
-  b.create<IREE::transform_dialect::ApplyCommonSubexpressionEliminationOp>(
-      funcH);
+  b.create<mlir::transform::ApplyCommonSubexpressionEliminationOp>(funcH);
   b.create<IREEEliminateEmptyTensorsOp>(variantH);
   auto bufferizeOp = b.create<IREEBufferizeOp>(variantH, /*targetGpu=*/true);
   bufferizeOp.setTargetGpu(true);
diff --git a/tests/transform_dialect/cpu/attention_codegen_spec.mlir b/tests/transform_dialect/cpu/attention_codegen_spec.mlir
index c011025..5f22de1 100644
--- a/tests/transform_dialect/cpu/attention_codegen_spec.mlir
+++ b/tests/transform_dialect/cpu/attention_codegen_spec.mlir
@@ -42,7 +42,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %variant_op : !transform.any_op
-    transform.iree.apply_cse %variant_op : !transform.any_op
+    transform.apply_cse to %variant_op : !transform.any_op
 
     // Bufferization
     // ==========================================
@@ -61,7 +61,7 @@
     transform.apply_patterns to %func_8 {
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_8 : !transform.any_op
+    transform.apply_cse to %func_8 : !transform.any_op
     transform.memref.erase_dead_alloc_and_stores %func_8 : (!transform.any_op) -> ()
     transform.yield
   } // codegen
diff --git a/tests/transform_dialect/cpu/transform_library.mlir b/tests/transform_dialect/cpu/transform_library.mlir
index 3754c47..6bb1e12 100644
--- a/tests/transform_dialect/cpu/transform_library.mlir
+++ b/tests/transform_dialect/cpu/transform_library.mlir
@@ -20,14 +20,14 @@
       transform.apply_patterns.scf.for_loop_canonicalization
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
     %variant_op_3 = transform.iree.bufferize %variant_op : (!transform.any_op) -> (!transform.any_op)
     %memref_func = transform.structured.match ops{["func.func"]} in %variant_op_3
       : (!transform.any_op) -> !transform.any_op
     transform.iree.forall_to_workgroup %memref_func : (!transform.any_op) -> ()
 
     // CSE is needed on the workgroup_count region to pass this particular test.
-    transform.iree.apply_cse %variant_op_3 : !transform.any_op
+    transform.apply_cse to %variant_op_3 : !transform.any_op
     %exports = transform.structured.match ops{["hal.executable.export"]} in %variant_op_3 : (!transform.any_op) -> !transform.any_op
     %none_attr = transform.param.constant #iree_codegen.translation_info<None> -> !transform.any_param
     transform.annotate %exports "translation_info" = %none_attr : !transform.any_op, !transform.any_param
diff --git a/tests/transform_dialect/cuda/double_mma_layout_analysis_codegen_spec.mlir b/tests/transform_dialect/cuda/double_mma_layout_analysis_codegen_spec.mlir
index a14398d..5157fb7 100644
--- a/tests/transform_dialect/cuda/double_mma_layout_analysis_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/double_mma_layout_analysis_codegen_spec.mlir
@@ -42,7 +42,7 @@
       transform.apply_patterns.tensor.reassociative_reshape_folding
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_3 : !transform.any_op
+    transform.apply_cse to %func_3 : !transform.any_op
     transform.iree.eliminate_empty_tensors %variant_op : (!transform.any_op) -> ()
     transform.apply_patterns to %func_3 {
       transform.apply_patterns.linalg.erase_unnecessary_inputs
diff --git a/tests/transform_dialect/cuda/mma_elemwise_layout_analysis_codegen_spec.mlir b/tests/transform_dialect/cuda/mma_elemwise_layout_analysis_codegen_spec.mlir
index bc6e590..c60c261 100644
--- a/tests/transform_dialect/cuda/mma_elemwise_layout_analysis_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/mma_elemwise_layout_analysis_codegen_spec.mlir
@@ -43,7 +43,7 @@
       transform.apply_patterns.tensor.reassociative_reshape_folding
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_3 : !transform.any_op
+    transform.apply_cse to %func_3 : !transform.any_op
     transform.iree.eliminate_empty_tensors %variant_op : (!transform.any_op) -> ()
     transform.apply_patterns to %func_3 {
       transform.apply_patterns.linalg.erase_unnecessary_inputs
diff --git a/tests/transform_dialect/cuda/mma_reduction_layout_analysis_codegen_spec.mlir b/tests/transform_dialect/cuda/mma_reduction_layout_analysis_codegen_spec.mlir
index d526f83..d72accb 100644
--- a/tests/transform_dialect/cuda/mma_reduction_layout_analysis_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/mma_reduction_layout_analysis_codegen_spec.mlir
@@ -47,7 +47,7 @@
       transform.apply_patterns.tensor.reassociative_reshape_folding
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_3 : !transform.any_op
+    transform.apply_cse to %func_3 : !transform.any_op
     transform.iree.eliminate_empty_tensors %variant_op : (!transform.any_op) -> ()
     transform.apply_patterns to %func_3 {
       transform.apply_patterns.linalg.erase_unnecessary_inputs
diff --git a/tests/transform_dialect/cuda/mma_using_layout_analysis_codegen_spec.mlir b/tests/transform_dialect/cuda/mma_using_layout_analysis_codegen_spec.mlir
index 9c1c8bf..33bfe44 100644
--- a/tests/transform_dialect/cuda/mma_using_layout_analysis_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/mma_using_layout_analysis_codegen_spec.mlir
@@ -44,7 +44,7 @@
       transform.apply_patterns.tensor.reassociative_reshape_folding
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_3 : !transform.any_op
+    transform.apply_cse to %func_3 : !transform.any_op
     transform.iree.eliminate_empty_tensors %variant_op : (!transform.any_op) -> ()
     transform.apply_patterns to %func_3 {
       transform.apply_patterns.linalg.erase_unnecessary_inputs
diff --git a/tests/transform_dialect/cuda/reduction_codegen_spec.mlir b/tests/transform_dialect/cuda/reduction_codegen_spec.mlir
index 13dc3f2..364f1a6 100644
--- a/tests/transform_dialect/cuda/reduction_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/reduction_codegen_spec.mlir
@@ -43,7 +43,7 @@
       transform.apply_patterns.scf.for_loop_canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
 
     %fill_2d = transform.structured.match ops{["linalg.fill"]} filter_result_type = tensor<1x2xf32> in %variant_op
       : (!transform.any_op) -> !transform.any_op
@@ -113,7 +113,7 @@
       transform.apply_patterns.scf.for_loop_canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op_3 : !transform.any_op
-    transform.iree.apply_cse %func_op_3 : !transform.any_op
+    transform.apply_cse to %func_op_3 : !transform.any_op
 
     transform.yield
   }
diff --git a/tests/transform_dialect/cuda/reduction_eltwise_codegen_spec.mlir b/tests/transform_dialect/cuda/reduction_eltwise_codegen_spec.mlir
index b036039..aad683d 100644
--- a/tests/transform_dialect/cuda/reduction_eltwise_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/reduction_eltwise_codegen_spec.mlir
@@ -27,7 +27,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
 
     // Step 2. First level of tiling + fusion parallelizes to blocks. Tile the
     // trailing elementwise the same way we want to tile the reduction.
@@ -48,7 +48,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
 
     // Step 3. Second level of tiling + fusion parallelizes to threads.
     // ===========================================================================
@@ -72,7 +72,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
 
     %fill_2d = transform.structured.match ops{["linalg.fill"]} filter_result_type = tensor<1x2xf32> in %variant_op
       : (!transform.any_op) -> !transform.any_op
@@ -93,7 +93,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
 
     // Step 4. Rank-reduce and vectorize.
     // ===========================================================================
@@ -152,7 +152,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op_3 : !transform.any_op
-    transform.iree.apply_cse %func_op_3 : !transform.any_op
+    transform.apply_cse to %func_op_3 : !transform.any_op
 
     transform.yield
   }
diff --git a/tests/transform_dialect/cuda/reduction_v2_codegen_spec.mlir b/tests/transform_dialect/cuda/reduction_v2_codegen_spec.mlir
index 956ff0e..4fd18f0 100644
--- a/tests/transform_dialect/cuda/reduction_v2_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/reduction_v2_codegen_spec.mlir
@@ -63,7 +63,7 @@
       transform.apply_patterns.tensor.reassociative_reshape_folding
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %func_3 : !transform.any_op
+    transform.apply_cse to %func_3 : !transform.any_op
     transform.iree.eliminate_empty_tensors %variant_op : (!transform.any_op) -> ()
     %func_5 = transform.structured.match ops{["func.func"]} in %variant_op : (!transform.any_op) -> !transform.any_op
     transform.apply_patterns to %func_5 {
@@ -101,7 +101,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_7 : !transform.any_op
-    transform.iree.apply_cse %func_7 : !transform.any_op
+    transform.apply_cse to %func_7 : !transform.any_op
 
     transform.yield
   }
diff --git a/tests/transform_dialect/cuda/softmax_codegen_spec.mlir b/tests/transform_dialect/cuda/softmax_codegen_spec.mlir
index a255f23..95a0374 100644
--- a/tests/transform_dialect/cuda/softmax_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/softmax_codegen_spec.mlir
@@ -40,7 +40,7 @@
     transform.apply_patterns to %variant_op {
       transform.apply_patterns.canonicalization
     } : !transform.any_op
-    transform.iree.apply_cse %variant_op : !transform.any_op
+    transform.apply_cse to %variant_op : !transform.any_op
 
     // Step 2. Second level of tiling + fusion parallelizes to threads.
     // ================================================================
diff --git a/tests/transform_dialect/cuda/softmax_v2_codegen_spec.mlir b/tests/transform_dialect/cuda/softmax_v2_codegen_spec.mlir
index aefcd43..773c938 100644
--- a/tests/transform_dialect/cuda/softmax_v2_codegen_spec.mlir
+++ b/tests/transform_dialect/cuda/softmax_v2_codegen_spec.mlir
@@ -46,7 +46,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
 
 
     // Step 2. Second level of tiling + fusion parallelizes to threads.
@@ -87,7 +87,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op : !transform.any_op
-    transform.iree.apply_cse %func_op : !transform.any_op
+    transform.apply_cse to %func_op : !transform.any_op
 
     // Step 3. Rank-reduce and vectorize.
     // ==================================
@@ -136,7 +136,7 @@
       transform.apply_patterns.canonicalization
     } : !transform.any_op
     transform.iree.apply_licm %func_op_3 : !transform.any_op
-    transform.iree.apply_cse %func_op_3 : !transform.any_op
+    transform.apply_cse to %func_op_3 : !transform.any_op
 
     transform.yield
   }