[MLIR][NFC] Adopt use of TypeRange in build() methods.
authorRahul Joshi <jurahul@google.com>
Wed, 23 Sep 2020 04:00:11 +0000 (21:00 -0700)
committerRahul Joshi <jurahul@google.com>
Wed, 23 Sep 2020 16:07:57 +0000 (09:07 -0700)
- Use TypeRange instead of ArrayRef<Type> where possible.
- Change some of the custom builders to also use TypeRange

Differential Revision: https://reviews.llvm.org/D87944

18 files changed:
mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
mlir/include/mlir/Dialect/GPU/GPUOps.td
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOpsInterface.td
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/unittests/TableGen/OpBuildGen.cpp

index 353f8c9..4294b88 100644 (file)
@@ -657,16 +657,16 @@ def AffineParallelOp : Affine_Op<"parallel",
 
   let builders = [
     OpBuilder<"OpBuilder &builder, OperationState &result, "
-              "ArrayRef<Type> resultTypes, "
+              "TypeRange resultTypes, "
               "ArrayRef<AtomicRMWKind> reductions, "
               "ArrayRef<int64_t> ranges">,
     OpBuilder<"OpBuilder &builder, OperationState &result, "
-              "ArrayRef<Type> resultTypes, "
+              "TypeRange resultTypes, "
               "ArrayRef<AtomicRMWKind> reductions, "
               "AffineMap lbMap, ValueRange lbArgs, "
               "AffineMap ubMap, ValueRange ubArgs">,
     OpBuilder<"OpBuilder &builder, OperationState &result, "
-              "ArrayRef<Type> resultTypes, "
+              "TypeRange resultTypes, "
               "ArrayRef<AtomicRMWKind> reductions, "
               "AffineMap lbMap, ValueRange lbArgs, "
               "AffineMap ubMap, ValueRange ubArgs, "
index 39c091a..d3d8cba 100644 (file)
@@ -205,8 +205,8 @@ def GPU_GPUFuncOp : GPU_Op<"func", [HasParent<"GPUModuleOp">,
 
   let builders = [
     OpBuilder<"OpBuilder &builder, OperationState &result, StringRef name, "
-              "FunctionType type, ArrayRef<Type> workgroupAttributions = {}, "
-              "ArrayRef<Type> privateAttributions = {}, "
+              "FunctionType type, TypeRange workgroupAttributions = {}, "
+              "TypeRange privateAttributions = {}, "
               "ArrayRef<NamedAttribute> attrs = {}">
   ];
 
index 626bc4b..39f2285 100644 (file)
@@ -383,7 +383,7 @@ def LLVM_InvokeOp : LLVM_Op<"invoke", [
                               AnySuccessor:$unwindDest);
 
   let builders = [OpBuilder<
-    "OpBuilder &b, OperationState &result, ArrayRef<Type> tys, "
+    "OpBuilder &b, OperationState &result, TypeRange tys, "
     "FlatSymbolRefAttr callee, ValueRange ops, Block* normal, "
     "ValueRange normalOps, Block* unwind, ValueRange unwindOps",
     [{
@@ -391,7 +391,7 @@ def LLVM_InvokeOp : LLVM_Op<"invoke", [
       build(b, result, tys, ops, normal, normalOps, unwind, unwindOps);
     }]>,
     OpBuilder<
-    "OpBuilder &b, OperationState &result, ArrayRef<Type> tys, "
+    "OpBuilder &b, OperationState &result, TypeRange tys, "
     "ValueRange ops, Block* normal, "
     "ValueRange normalOps, Block* unwind, ValueRange unwindOps",
     [{
index 65df012..b5e7471 100644 (file)
@@ -644,7 +644,7 @@ def GenericOp : GenericOpBase<"generic"> {
 
   let builders = [
     OpBuilder<
-      "OpBuilder &builder, OperationState &result, ArrayRef<Type> resultTensorTypes,"
+      "OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,"
       "ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
       "ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
       "StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
@@ -656,7 +656,7 @@ def GenericOp : GenericOpBase<"generic"> {
       "StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
       "function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">,
     OpBuilder<
-      "OpBuilder &builder, OperationState &result, ArrayRef<Type> resultTensorTypes,"
+      "OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,"
       "ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
       "ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
       "function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">,
@@ -823,7 +823,7 @@ def IndexedGenericOp : GenericOpBase<"indexed_generic"> {
 
   let builders = [
     OpBuilder<
-      "OpBuilder &builder, OperationState &result, ArrayRef<Type> resultTensorTypes,"
+      "OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,"
       "ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
       "ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
       "StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
@@ -835,7 +835,7 @@ def IndexedGenericOp : GenericOpBase<"indexed_generic"> {
       "StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
       "function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)> = nullptr">,
     OpBuilder<
-      "OpBuilder &builder, OperationState &result, ArrayRef<Type> resultTensorTypes,"
+      "OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,"
       "ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
       "ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
       "function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)> = nullptr">,
index 1e0e85f..17e16a1 100644 (file)
@@ -531,7 +531,7 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
       (ins "OpBuilder &":$builder, "Location":$loc,
            "ValueRange":$operands,
            "ArrayRef<NamedAttribute>":$attributes), [{
-        return builder.create<ConcreteOp>(loc, ArrayRef<Type>{}, operands,
+        return builder.create<ConcreteOp>(loc, TypeRange{}, operands,
                                           attributes);
       }]
     >,
index 6eabc00..dd49635 100644 (file)
@@ -721,13 +721,13 @@ def CallOp : Std_Op<"call", [CallOpInterface, MemRefsNormalizable]> {
       result.addTypes(callee.getType().getResults());
   }]>, OpBuilder<
     "OpBuilder &builder, OperationState &result, SymbolRefAttr callee,"
-    "ArrayRef<Type> results, ValueRange operands = {}", [{
+    "TypeRange results, ValueRange operands = {}", [{
       result.addOperands(operands);
       result.addAttribute("callee", callee);
       result.addTypes(results);
   }]>, OpBuilder<
     "OpBuilder &builder, OperationState &result, StringRef callee,"
-    "ArrayRef<Type> results, ValueRange operands = {}", [{
+    "TypeRange results, ValueRange operands = {}", [{
       build(builder, result, builder.getSymbolRefAttr(callee), results,
             operands);
   }]>];
@@ -2812,7 +2812,7 @@ def SubViewOp : Std_Op<"subview", [
   let results = (outs AnyMemRef:$result);
 
   let builders = [
-    // Build a SubViewOp with mized static and dynamic entries.
+    // Build a SubViewOp with mixed static and dynamic entries.
     OpBuilder<
       "OpBuilder &b, OperationState &result, Value source, "
       "ArrayRef<int64_t> staticOffsets, ArrayRef<int64_t> staticSizes,"
index 4267393..bfc8b6d 100644 (file)
@@ -173,7 +173,7 @@ void ConvertGpuLaunchFuncToVulkanLaunchFunc::convertGpuLaunchFunc(
 
   // Create vulkan launch call op.
   auto vulkanLaunchCallOp = builder.create<CallOp>(
-      loc, ArrayRef<Type>{}, builder.getSymbolRefAttr(kVulkanLaunch),
+      loc, TypeRange{}, builder.getSymbolRefAttr(kVulkanLaunch),
       vulkanLaunchOperands);
 
   // Set SPIR-V binary shader data as an attribute.
index 8099bec..1b6f019 100644 (file)
@@ -247,11 +247,11 @@ void VulkanLaunchFuncToVulkanCallsPass::createBindMemRefCalls(
     }
     // Create call to `bindMemRef`.
     builder.create<LLVM::CallOp>(
-        loc, ArrayRef<Type>{getVoidType()},
+        loc, TypeRange{getVoidType()},
         builder.getSymbolRefAttr(
             StringRef(symbolName.data(), symbolName.size())),
-        ArrayRef<Value>{vulkanRuntime, descriptorSet, descriptorBinding,
-                        ptrToMemRefDescriptor});
+        ValueRange{vulkanRuntime, descriptorSet, descriptorBinding,
+                   ptrToMemRefDescriptor});
   }
 }
 
@@ -373,8 +373,8 @@ void VulkanLaunchFuncToVulkanCallsPass::translateVulkanLaunchCall(
   Location loc = cInterfaceVulkanLaunchCallOp.getLoc();
   // Create call to `initVulkan`.
   auto initVulkanCall = builder.create<LLVM::CallOp>(
-      loc, ArrayRef<Type>{getPointerType()},
-      builder.getSymbolRefAttr(kInitVulkan), ArrayRef<Value>{});
+      loc, TypeRange{getPointerType()}, builder.getSymbolRefAttr(kInitVulkan),
+      ValueRange{});
   // The result of `initVulkan` function is a pointer to Vulkan runtime, we
   // need to pass that pointer to each Vulkan runtime call.
   auto vulkanRuntime = initVulkanCall.getResult(0);
@@ -396,35 +396,34 @@ void VulkanLaunchFuncToVulkanCallsPass::translateVulkanLaunchCall(
   // Create call to `setBinaryShader` runtime function with the given pointer to
   // SPIR-V binary and binary size.
   builder.create<LLVM::CallOp>(
-      loc, ArrayRef<Type>{getVoidType()},
-      builder.getSymbolRefAttr(kSetBinaryShader),
-      ArrayRef<Value>{vulkanRuntime, ptrToSPIRVBinary, binarySize});
+      loc, TypeRange{getVoidType()}, builder.getSymbolRefAttr(kSetBinaryShader),
+      ValueRange{vulkanRuntime, ptrToSPIRVBinary, binarySize});
   // Create LLVM global with entry point name.
   Value entryPointName = createEntryPointNameConstant(
       spirvAttributes.second.getValue(), loc, builder);
   // Create call to `setEntryPoint` runtime function with the given pointer to
   // entry point name.
-  builder.create<LLVM::CallOp>(loc, ArrayRef<Type>{getVoidType()},
+  builder.create<LLVM::CallOp>(loc, TypeRange{getVoidType()},
                                builder.getSymbolRefAttr(kSetEntryPoint),
-                               ArrayRef<Value>{vulkanRuntime, entryPointName});
+                               ValueRange{vulkanRuntime, entryPointName});
 
   // Create number of local workgroup for each dimension.
   builder.create<LLVM::CallOp>(
-      loc, ArrayRef<Type>{getVoidType()},
+      loc, TypeRange{getVoidType()},
       builder.getSymbolRefAttr(kSetNumWorkGroups),
-      ArrayRef<Value>{vulkanRuntime, cInterfaceVulkanLaunchCallOp.getOperand(0),
-                      cInterfaceVulkanLaunchCallOp.getOperand(1),
-                      cInterfaceVulkanLaunchCallOp.getOperand(2)});
+      ValueRange{vulkanRuntime, cInterfaceVulkanLaunchCallOp.getOperand(0),
+                 cInterfaceVulkanLaunchCallOp.getOperand(1),
+                 cInterfaceVulkanLaunchCallOp.getOperand(2)});
 
   // Create call to `runOnVulkan` runtime function.
-  builder.create<LLVM::CallOp>(loc, ArrayRef<Type>{getVoidType()},
+  builder.create<LLVM::CallOp>(loc, TypeRange{getVoidType()},
                                builder.getSymbolRefAttr(kRunOnVulkan),
-                               ArrayRef<Value>{vulkanRuntime});
+                               ValueRange{vulkanRuntime});
 
   // Create call to 'deinitVulkan' runtime function.
-  builder.create<LLVM::CallOp>(loc, ArrayRef<Type>{getVoidType()},
+  builder.create<LLVM::CallOp>(loc, TypeRange{getVoidType()},
                                builder.getSymbolRefAttr(kDeinitVulkan),
-                               ArrayRef<Value>{vulkanRuntime});
+                               ValueRange{vulkanRuntime});
 
   // Declare runtime functions.
   declareVulkanFunctions(loc);
index 93b7764..29b5f9c 100644 (file)
@@ -123,7 +123,7 @@ public:
       return failure();
 
     rewriter.replaceOpWithNewOp<mlir::CallOp>(
-        op, libraryCallName.getValue(), ArrayRef<Type>{},
+        op, libraryCallName.getValue(), TypeRange(),
         createTypeCanonicalizedMemRefOperands(rewriter, op.getLoc(),
                                               op.getOperands()));
     return success();
@@ -151,7 +151,7 @@ public:
       return failure();
 
     rewriter.replaceOpWithNewOp<mlir::CallOp>(
-        op, libraryCallName.getValue(), ArrayRef<Type>{},
+        op, libraryCallName.getValue(), TypeRange(),
         createTypeCanonicalizedMemRefOperands(rewriter, op.getLoc(),
                                               op.getOperands()));
     return success();
@@ -185,7 +185,7 @@ public:
     for (auto operand : op.getOperands())
       operands.push_back(operand);
     rewriter.replaceOpWithNewOp<mlir::CallOp>(
-        op, libraryCallName.getValue(), ArrayRef<Type>{},
+        op, libraryCallName.getValue(), TypeRange(),
         createTypeCanonicalizedMemRefOperands(rewriter, op.getLoc(), operands));
     return success();
   }
index 41c8ac1..419d4be 100644 (file)
@@ -26,8 +26,8 @@ struct ParallelOpConversion : public ConvertToLLVMPattern {
   matchAndRewrite(Operation *op, ArrayRef<Value> operands,
                   ConversionPatternRewriter &rewriter) const override {
     auto curOp = cast<omp::ParallelOp>(op);
-    auto newOp = rewriter.create<omp::ParallelOp>(
-        curOp.getLoc(), ArrayRef<Type>(), operands, curOp.getAttrs());
+    auto newOp = rewriter.create<omp::ParallelOp>(curOp.getLoc(), TypeRange(),
+                                                  operands, curOp.getAttrs());
     rewriter.inlineRegionBefore(curOp.region(), newOp.region(),
                                 newOp.region().end());
     if (failed(rewriter.convertRegionTypes(&newOp.region(), typeConverter)))
index 814a255..186c8ec 100644 (file)
@@ -2189,7 +2189,7 @@ struct DeallocOpLowering : public ConvertOpToLLVMPattern<DeallocOp> {
         op->getLoc(), getVoidPtrType(),
         memref.allocatedPtr(rewriter, op->getLoc()));
     rewriter.replaceOpWithNewOp<LLVM::CallOp>(
-        op, ArrayRef<Type>(), rewriter.getSymbolRefAttr(freeFunc), casted);
+        op, TypeRange(), rewriter.getSymbolRefAttr(freeFunc), casted);
     return success();
   }
 };
@@ -2714,13 +2714,13 @@ struct ReturnOpLowering : public ConvertOpToLLVMPattern<ReturnOp> {
 
     // If ReturnOp has 0 or 1 operand, create it and return immediately.
     if (numArguments == 0) {
-      rewriter.replaceOpWithNewOp<LLVM::ReturnOp>(
-          op, ArrayRef<Type>(), ArrayRef<Value>(), op->getAttrs());
+      rewriter.replaceOpWithNewOp<LLVM::ReturnOp>(op, TypeRange(), ValueRange(),
+                                                  op->getAttrs());
       return success();
     }
     if (numArguments == 1) {
       rewriter.replaceOpWithNewOp<LLVM::ReturnOp>(
-          op, ArrayRef<Type>(), updatedOperands, op->getAttrs());
+          op, TypeRange(), updatedOperands, op->getAttrs());
       return success();
     }
 
@@ -2735,7 +2735,7 @@ struct ReturnOpLowering : public ConvertOpToLLVMPattern<ReturnOp> {
           op->getLoc(), packedType, packed, updatedOperands[i],
           rewriter.getI64ArrayAttr(i));
     }
-    rewriter.replaceOpWithNewOp<LLVM::ReturnOp>(op, ArrayRef<Type>(), packed,
+    rewriter.replaceOpWithNewOp<LLVM::ReturnOp>(op, TypeRange(), packed,
                                                 op->getAttrs());
     return success();
   }
index cbc4c12..6ad17d7 100644 (file)
@@ -1382,7 +1382,7 @@ private:
   // Helper to emit a call.
   static void emitCall(ConversionPatternRewriter &rewriter, Location loc,
                        Operation *ref, ValueRange params = ValueRange()) {
-    rewriter.create<LLVM::CallOp>(loc, ArrayRef<Type>{},
+    rewriter.create<LLVM::CallOp>(loc, TypeRange(),
                                   rewriter.getSymbolRefAttr(ref), params);
   }
 
index 440875d..bd45c8d 100644 (file)
@@ -2460,7 +2460,7 @@ LogicalResult AffinePrefetchOp::fold(ArrayRef<Attribute> cstOperands,
 //===----------------------------------------------------------------------===//
 
 void AffineParallelOp::build(OpBuilder &builder, OperationState &result,
-                             ArrayRef<Type> resultTypes,
+                             TypeRange resultTypes,
                              ArrayRef<AtomicRMWKind> reductions,
                              ArrayRef<int64_t> ranges) {
   SmallVector<AffineExpr, 8> lbExprs(ranges.size(),
@@ -2475,7 +2475,7 @@ void AffineParallelOp::build(OpBuilder &builder, OperationState &result,
 }
 
 void AffineParallelOp::build(OpBuilder &builder, OperationState &result,
-                             ArrayRef<Type> resultTypes,
+                             TypeRange resultTypes,
                              ArrayRef<AtomicRMWKind> reductions,
                              AffineMap lbMap, ValueRange lbArgs,
                              AffineMap ubMap, ValueRange ubArgs) {
@@ -2490,7 +2490,7 @@ void AffineParallelOp::build(OpBuilder &builder, OperationState &result,
 }
 
 void AffineParallelOp::build(OpBuilder &builder, OperationState &result,
-                             ArrayRef<Type> resultTypes,
+                             TypeRange resultTypes,
                              ArrayRef<AtomicRMWKind> reductions,
                              AffineMap lbMap, ValueRange lbArgs,
                              AffineMap ubMap, ValueRange ubArgs,
index 7dc74f2..d754177 100644 (file)
@@ -475,8 +475,8 @@ BlockArgument GPUFuncOp::addPrivateAttribution(Type type) {
 
 void GPUFuncOp::build(OpBuilder &builder, OperationState &result,
                       StringRef name, FunctionType type,
-                      ArrayRef<Type> workgroupAttributions,
-                      ArrayRef<Type> privateAttributions,
+                      TypeRange workgroupAttributions,
+                      TypeRange privateAttributions,
                       ArrayRef<NamedAttribute> attrs) {
   result.addAttribute(SymbolTable::getSymbolAttrName(),
                       builder.getStringAttr(name));
index 63bd10c..e1f7aed 100644 (file)
@@ -247,7 +247,7 @@ void StoreOp::build(OpBuilder &builder, OperationState &result, Value value,
                     Value addr, unsigned alignment, bool isVolatile,
                     bool isNonTemporal) {
   result.addOperands({value, addr});
-  result.addTypes(ArrayRef<Type>{});
+  result.addTypes({});
   if (isVolatile)
     result.addAttribute(kVolatileAttrName, builder.getUnitAttr());
   if (isNonTemporal)
@@ -1787,7 +1787,7 @@ Value mlir::LLVM::createGlobalString(Location loc, OpBuilder &builder,
       loc, LLVM::LLVMType::getInt64Ty(ctx),
       builder.getIntegerAttr(builder.getIndexType(), 0));
   return builder.create<LLVM::GEPOp>(loc, LLVM::LLVMType::getInt8PtrTy(ctx),
-                                     globalPtr, ArrayRef<Value>({cst0, cst0}));
+                                     globalPtr, ValueRange{cst0, cst0});
 }
 
 bool mlir::LLVM::satisfiesLLVMModule(Operation *op) {
index d036fe5..ca22608 100644 (file)
@@ -98,9 +98,8 @@ static LogicalResult foldMemRefCast(Operation *op) {
 // GenericOps
 //===----------------------------------------------------------------------===//
 void GenericOp::build(
-    OpBuilder &builder, OperationState &result,
-    ArrayRef<Type> resultTensorTypes, ValueRange inputs,
-    ValueRange outputBuffers, ValueRange initTensors,
+    OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,
+    ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors,
     ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes,
     StringRef doc, StringRef libraryCall, IntegerAttr symbolSource,
     function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild) {
@@ -130,7 +129,7 @@ void GenericOp::build(
     ArrayRef<StringRef> iteratorTypes, StringRef doc, StringRef libraryCall,
     IntegerAttr symbolSource,
     function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild) {
-  build(builder, result, ArrayRef<Type>{}, inputs, outputBuffers, ValueRange{},
+  build(builder, result, TypeRange{}, inputs, outputBuffers, ValueRange{},
         indexingMaps, iteratorTypes, doc, libraryCall, symbolSource, bodyBuild);
 }
 
@@ -146,9 +145,8 @@ void GenericOp::build(
 }
 
 void GenericOp::build(
-    OpBuilder &builder, OperationState &result,
-    ArrayRef<Type> resultTensorTypes, ValueRange inputs,
-    ValueRange outputBuffers, ValueRange initTensors,
+    OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,
+    ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors,
     ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes,
     function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuild) {
   build(builder, result, resultTensorTypes, inputs, outputBuffers, initTensors,
@@ -159,9 +157,8 @@ void GenericOp::build(
 }
 
 void IndexedGenericOp::build(
-    OpBuilder &builder, OperationState &result,
-    ArrayRef<Type> resultTensorTypes, ValueRange inputs,
-    ValueRange outputBuffers, ValueRange initTensors,
+    OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,
+    ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors,
     ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes,
     StringRef doc, StringRef libraryCall, IntegerAttr symbolSource,
     function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)>
@@ -196,7 +193,7 @@ void IndexedGenericOp::build(
     IntegerAttr symbolSource,
     function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)>
         bodyBuild) {
-  build(builder, result, ArrayRef<Type>{}, inputs, outputBuffers, ValueRange{},
+  build(builder, result, TypeRange{}, inputs, outputBuffers, ValueRange{},
         indexingMaps, iteratorTypes, doc, libraryCall, symbolSource, bodyBuild);
 }
 
@@ -213,9 +210,8 @@ void IndexedGenericOp::build(
 }
 
 void IndexedGenericOp::build(
-    OpBuilder &builder, OperationState &result,
-    ArrayRef<Type> resultTensorTypes, ValueRange inputs,
-    ValueRange outputBuffers, ValueRange initTensors,
+    OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,
+    ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors,
     ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes,
     function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)>
         bodyBuild) {
index 6602060..7bdd0fd 100644 (file)
@@ -255,7 +255,7 @@ struct FoldToCallOpPattern : public OpRewritePattern<FoldToCallOp> {
 
   LogicalResult matchAndRewrite(FoldToCallOp op,
                                 PatternRewriter &rewriter) const override {
-    rewriter.replaceOpWithNewOp<CallOp>(op, ArrayRef<Type>(), op.calleeAttr(),
+    rewriter.replaceOpWithNewOp<CallOp>(op, TypeRange(), op.calleeAttr(),
                                         ValueRange());
     return success();
   }
index 0f08930..09a02b4 100644 (file)
@@ -73,20 +73,20 @@ protected:
   template <typename OpTy>
   void testSingleVariadicInputInferredType() {
     // Test separate arg, separate param build method.
-    auto op = builder.create<OpTy>(loc, i32Ty, ArrayRef<Value>{cstI32, cstI32});
+    auto op = builder.create<OpTy>(loc, i32Ty, ValueRange{cstI32, cstI32});
     verifyOp(std::move(op), {i32Ty}, {cstI32, cstI32}, noAttrs);
 
     // Test collective params build method.
-    op = builder.create<OpTy>(loc, ArrayRef<Type>{i32Ty},
-                              ArrayRef<Value>{cstI32, cstI32});
+    op =
+        builder.create<OpTy>(loc, TypeRange{i32Ty}, ValueRange{cstI32, cstI32});
     verifyOp(std::move(op), {i32Ty}, {cstI32, cstI32}, noAttrs);
 
     // Test build method with no result types, default value of attributes.
-    op = builder.create<OpTy>(loc, ArrayRef<Value>{cstI32, cstI32});
+    op = builder.create<OpTy>(loc, ValueRange{cstI32, cstI32});
     verifyOp(std::move(op), {i32Ty}, {cstI32, cstI32}, noAttrs);
 
     // Test build method with no result types and supplied attributes.
-    op = builder.create<OpTy>(loc, ArrayRef<Value>{cstI32, cstI32}, attrs);
+    op = builder.create<OpTy>(loc, ValueRange{cstI32, cstI32}, attrs);
     verifyOp(std::move(op), {i32Ty}, {cstI32, cstI32}, attrs);
   }
 
@@ -111,17 +111,17 @@ TEST_F(OpBuildGenTest, BasicBuildMethods) {
   verifyOp(op, {i32Ty}, {cstI32}, noAttrs);
 
   // Test separate args, collective results build method.
-  op = builder.create<TableGenBuildOp0>(loc, ArrayRef<Type>{i32Ty}, cstI32);
+  op = builder.create<TableGenBuildOp0>(loc, TypeRange{i32Ty}, cstI32);
   verifyOp(op, {i32Ty}, {cstI32}, noAttrs);
 
   // Test collective args, collective params build method.
-  op = builder.create<TableGenBuildOp0>(loc, ArrayRef<Type>{i32Ty},
-                                        ArrayRef<Value>{cstI32});
+  op = builder.create<TableGenBuildOp0>(loc, TypeRange{i32Ty},
+                                        ValueRange{cstI32});
   verifyOp(op, {i32Ty}, {cstI32}, noAttrs);
 
   // Test collective args, collective results, non-empty attributes
-  op = builder.create<TableGenBuildOp0>(loc, ArrayRef<Type>{i32Ty},
-                                        ArrayRef<Value>{cstI32}, attrs);
+  op = builder.create<TableGenBuildOp0>(loc, TypeRange{i32Ty},
+                                        ValueRange{cstI32}, attrs);
   verifyOp(op, {i32Ty}, {cstI32}, attrs);
 }
 
@@ -138,25 +138,25 @@ TEST_F(OpBuildGenTest, BasicBuildMethods) {
 /// variadic result.
 TEST_F(OpBuildGenTest, BuildMethodsSingleVariadicArgAndResult) {
   // Test collective args, collective results method, building a unary op.
-  auto op = builder.create<TableGenBuildOp1>(loc, ArrayRef<Type>{i32Ty},
-                                             ArrayRef<Value>{cstI32});
+  auto op = builder.create<TableGenBuildOp1>(loc, TypeRange{i32Ty},
+                                             ValueRange{cstI32});
   verifyOp(std::move(op), {i32Ty}, {cstI32}, noAttrs);
 
   // Test collective args, collective results method, building a unary op with
   // named attributes.
-  op = builder.create<TableGenBuildOp1>(loc, ArrayRef<Type>{i32Ty},
-                                        ArrayRef<Value>{cstI32}, attrs);
+  op = builder.create<TableGenBuildOp1>(loc, TypeRange{i32Ty},
+                                        ValueRange{cstI32}, attrs);
   verifyOp(std::move(op), {i32Ty}, {cstI32}, attrs);
 
   // Test collective args, collective results method, building a binary op.
-  op = builder.create<TableGenBuildOp1>(loc, ArrayRef<Type>{i32Ty, f32Ty},
-                                        ArrayRef<Value>{cstI32, cstF32});
+  op = builder.create<TableGenBuildOp1>(loc, TypeRange{i32Ty, f32Ty},
+                                        ValueRange{cstI32, cstF32});
   verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32, cstF32}, noAttrs);
 
   // Test collective args, collective results method, building a binary op with
   // named attributes.
-  op = builder.create<TableGenBuildOp1>(loc, ArrayRef<Type>{i32Ty, f32Ty},
-                                        ArrayRef<Value>{cstI32, cstF32}, attrs);
+  op = builder.create<TableGenBuildOp1>(loc, TypeRange{i32Ty, f32Ty},
+                                        ValueRange{cstI32, cstF32}, attrs);
   verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32, cstF32}, attrs);
 }
 
@@ -164,23 +164,22 @@ TEST_F(OpBuildGenTest, BuildMethodsSingleVariadicArgAndResult) {
 /// result.
 TEST_F(OpBuildGenTest, BuildMethodsSingleVariadicArgNonVariadicResults) {
   // Test separate arg, separate param build method.
-  auto op =
-      builder.create<TableGenBuildOp1>(loc, i32Ty, ArrayRef<Value>{cstI32});
+  auto op = builder.create<TableGenBuildOp1>(loc, i32Ty, ValueRange{cstI32});
   verifyOp(std::move(op), {i32Ty}, {cstI32}, noAttrs);
 
   // Test collective params build method, no attributes.
-  op = builder.create<TableGenBuildOp1>(loc, ArrayRef<Type>{i32Ty},
-                                        ArrayRef<Value>{cstI32});
+  op = builder.create<TableGenBuildOp1>(loc, TypeRange{i32Ty},
+                                        ValueRange{cstI32});
   verifyOp(std::move(op), {i32Ty}, {cstI32}, noAttrs);
 
   // Test collective params build method no attributes, 2 inputs.
-  op = builder.create<TableGenBuildOp1>(loc, ArrayRef<Type>{i32Ty},
-                                        ArrayRef<Value>{cstI32, cstF32});
+  op = builder.create<TableGenBuildOp1>(loc, TypeRange{i32Ty},
+                                        ValueRange{cstI32, cstF32});
   verifyOp(std::move(op), {i32Ty}, {cstI32, cstF32}, noAttrs);
 
   // Test collective params build method, non-empty attributes.
-  op = builder.create<TableGenBuildOp1>(loc, ArrayRef<Type>{i32Ty},
-                                        ArrayRef<Value>{cstI32, cstF32}, attrs);
+  op = builder.create<TableGenBuildOp1>(loc, TypeRange{i32Ty},
+                                        ValueRange{cstI32, cstF32}, attrs);
   verifyOp(std::move(op), {i32Ty}, {cstI32, cstF32}, attrs);
 }
 
@@ -189,19 +188,18 @@ TEST_F(OpBuildGenTest, BuildMethodsSingleVariadicArgNonVariadicResults) {
 TEST_F(OpBuildGenTest,
        BuildMethodsSingleVariadicArgAndMultipleVariadicResults) {
   // Test separate arg, separate param build method.
-  auto op = builder.create<TableGenBuildOp3>(loc, ArrayRef<Type>{i32Ty},
-                                             ArrayRef<Type>{f32Ty},
-                                             ArrayRef<Value>{cstI32});
+  auto op = builder.create<TableGenBuildOp3>(
+      loc, TypeRange{i32Ty}, TypeRange{f32Ty}, ValueRange{cstI32});
   verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32}, noAttrs);
 
   // Test collective params build method, no attributes.
-  op = builder.create<TableGenBuildOp3>(loc, ArrayRef<Type>{i32Ty, f32Ty},
-                                        ArrayRef<Value>{cstI32});
+  op = builder.create<TableGenBuildOp3>(loc, TypeRange{i32Ty, f32Ty},
+                                        ValueRange{cstI32});
   verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32}, noAttrs);
 
   // Test collective params build method, with attributes.
-  op = builder.create<TableGenBuildOp3>(loc, ArrayRef<Type>{i32Ty, f32Ty},
-                                        ArrayRef<Value>{cstI32}, attrs);
+  op = builder.create<TableGenBuildOp3>(loc, TypeRange{i32Ty, f32Ty},
+                                        ValueRange{cstI32}, attrs);
   verifyOp(std::move(op), {i32Ty, f32Ty}, {cstI32}, attrs);
 }