[mlir:OpConversionPattern] Add overloads for taking an Adaptor instead of ArrayRef

This has been a TODO for a long time, and it brings about many advantages (namely nice accessors, and less fragile code). The existing overloads that accept ArrayRef are now treated as deprecated and will be removed in a followup (after a small grace period). Most of the upstream MLIR usages have been fixed by this commit, the rest will be handled in a followup.

Differential Revision: https://reviews.llvm.org/D110293
diff --git a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
index bd1e4ad..a43ffbc 100644
--- a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
+++ b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
@@ -55,7 +55,7 @@
   matchAsPerformingReduction(linalg::GenericOp genericOp);
 
   LogicalResult
-  matchAndRewrite(linalg::GenericOp genericOp, ArrayRef<Value> operands,
+  matchAndRewrite(linalg::GenericOp genericOp, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override;
 };
 
@@ -109,7 +109,7 @@
 }
 
 LogicalResult SingleWorkgroupReduction::matchAndRewrite(
-    linalg::GenericOp genericOp, ArrayRef<Value> operands,
+    linalg::GenericOp genericOp, OpAdaptor adaptor,
     ConversionPatternRewriter &rewriter) const {
   Operation *op = genericOp.getOperation();
   auto originalInputType = op->getOperand(0).getType().cast<MemRefType>();
@@ -134,7 +134,8 @@
   // TODO: Query the target environment to make sure the current
   // workload fits in a local workgroup.
 
-  Value convertedInput = operands[0], convertedOutput = operands[1];
+  Value convertedInput = adaptor.getOperands()[0];
+  Value convertedOutput = adaptor.getOperands()[1];
   Location loc = genericOp.getLoc();
 
   auto *typeConverter = getTypeConverter<SPIRVTypeConverter>();