Fix vm variadic argument printer (#2838)

diff --git a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir
index b8ed7f9..d00d4f0 100644
--- a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir
+++ b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir
@@ -3,7 +3,7 @@
 // CHECK-LABEL: @allocatorComputeSize
 func @allocatorComputeSize(%arg0 : !hal.allocator) -> index {
   %c1024 = constant 1024 : index
-  // CHECK: %0 = vm.call.variadic @hal.allocator.compute_size(%arg0, [%c1024, %c1024], %c32) : (!vm.ref<!hal.allocator>, i32..., i32) -> i32
+  // CHECK: %0 = vm.call.variadic @hal.allocator.compute_size(%arg0, [%c1024, %c1024], %c32) : (!vm.ref<!hal.allocator>, i32 ..., i32) -> i32
   %0 = hal.allocator.compute_size %arg0, shape=[%c1024, %c1024], element_type=32
   return %0 : index
 }
@@ -24,7 +24,7 @@
 // CHECK-LABEL: func @allocatorAllocateConst
 func @allocatorAllocateConst(%arg0 : !hal.allocator) -> !hal.buffer {
   // CHECK: %allocatorAllocateConst_const_0 = vm.const.ref.rodata @allocatorAllocateConst_const_0 : !vm.ref<!iree.byte_buffer>
-  // CHECK: %ref = vm.call.variadic @hal.allocator.allocate.const(%arg0, %c6, %c2, [%c4, %c4_0], %c16777248, %allocatorAllocateConst_const_0) : (!vm.ref<!hal.allocator>, i32, i32, i32..., i32, !vm.ref<!iree.byte_buffer>) -> !vm.ref<!hal.buffer>
+  // CHECK: %ref = vm.call.variadic @hal.allocator.allocate.const(%arg0, %c6, %c2, [%c4, %c4_0], %c16777248, %allocatorAllocateConst_const_0) : (!vm.ref<!hal.allocator>, i32, i32, i32 ..., i32, !vm.ref<!iree.byte_buffer>) -> !vm.ref<!hal.buffer>
   %buffer = hal.allocator.allocate.const %arg0, "HostVisible|HostCoherent", "Transfer" : !hal.buffer = dense<123> : tensor<4x4xi32>
   return %buffer : !hal.buffer
 }
diff --git a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/command_buffer_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/command_buffer_ops.mlir
index e4f49fd..52d4d07 100644
--- a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/command_buffer_ops.mlir
+++ b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/command_buffer_ops.mlir
@@ -27,7 +27,7 @@
   %memory_barrier = hal.make_memory_barrier "HostRead|HostWrite", "MemoryRead|MemoryWrite" : tuple<i32, i32>
   // TODO(benvanik): buffer barriers.
   // %buffer_barrier = hal.make_buffer_barrier "HostRead|HostWrite", "MemoryRead|MemoryWrite", %0, %1, %2 : tuple<i32, i32, !vm.ref<!hal.buffer>, i32, i32>
-  // CHECK: vm.call.variadic @hal.command_buffer.execution_barrier(%arg0, %c1, %c2, [%c192, %c768], []) : (!vm.ref<!hal.command_buffer>, i32, i32, i32..., i32...)
+  // CHECK: vm.call.variadic @hal.command_buffer.execution_barrier(%arg0, %c1, %c2, [%c192, %c768], []) : (!vm.ref<!hal.command_buffer>, i32, i32, i32 ..., i32 ...)
   hal.command_buffer.execution_barrier %arg0, "CommandIssue", "CommandProcess",
       memory_barriers=[%memory_barrier, %memory_barrier]
   return
@@ -65,9 +65,9 @@
     %arg1 : !hal.executable_layout,
     %arg2 : !hal.descriptor_set) {
   %c100 = constant 100 : index
-  // CHECK: vm.call.variadic @hal.command_buffer.bind_descriptor_set(%arg0, %arg1, %zero, %arg2, []) : (!vm.ref<!hal.command_buffer>, !vm.ref<!hal.executable_layout>, i32, !vm.ref<!hal.descriptor_set>, i32...)
+  // CHECK: vm.call.variadic @hal.command_buffer.bind_descriptor_set(%arg0, %arg1, %zero, %arg2, []) : (!vm.ref<!hal.command_buffer>, !vm.ref<!hal.executable_layout>, i32, !vm.ref<!hal.descriptor_set>, i32 ...)
   hal.command_buffer.bind_descriptor_set %arg0, %arg1, set=0, %arg2
-  // CHECK: vm.call.variadic @hal.command_buffer.bind_descriptor_set(%arg0, %arg1, %zero_0, %arg2, [%c100]) : (!vm.ref<!hal.command_buffer>, !vm.ref<!hal.executable_layout>, i32, !vm.ref<!hal.descriptor_set>, i32...)
+  // CHECK: vm.call.variadic @hal.command_buffer.bind_descriptor_set(%arg0, %arg1, %zero_0, %arg2, [%c100]) : (!vm.ref<!hal.command_buffer>, !vm.ref<!hal.executable_layout>, i32, !vm.ref<!hal.descriptor_set>, i32 ...)
   hal.command_buffer.bind_descriptor_set %arg0, %arg1, set=0, %arg2, offsets=[%c100]
   return
 }
diff --git a/iree/compiler/Dialect/HAL/Target/VMLA/test/smoketest.mlir b/iree/compiler/Dialect/HAL/Target/VMLA/test/smoketest.mlir
index aea7465..46b7779 100644
--- a/iree/compiler/Dialect/HAL/Target/VMLA/test/smoketest.mlir
+++ b/iree/compiler/Dialect/HAL/Target/VMLA/test/smoketest.mlir
@@ -119,7 +119,7 @@
 //  CHECK-NEXT:           %ref_0 = vm.call @vmla.interface.binding(%arg0, %zero, %zero) : (!vm.ref<!vmla.interface>, i32, i32) -> !vm.ref<!vmla.buffer>
 //  CHECK-NEXT:           %ref_1 = vm.call @vmla.buffer.view(%ref_0, %zero, %c128) : (!vm.ref<!vmla.buffer>, i32, i32) -> !vm.ref<!vmla.buffer>
 //  CHECK-NEXT:           %ref_2 = vm.call @vmla.buffer.alloc(%c16) : (i32) -> !vm.ref<!vmla.buffer>
-//  CHECK-NEXT:           vm.call.variadic @vmla.reduce.sum.f32(%ref_1, [%c4, %c8], %ref, [], %c1, %ref_2, [%c4]) : (!vm.ref<!vmla.buffer>, i32..., !vm.ref<!vmla.buffer>, i32..., i32, !vm.ref<!vmla.buffer>, i32...)
+//  CHECK-NEXT:           vm.call.variadic @vmla.reduce.sum.f32(%ref_1, [%c4, %c8], %ref, [], %c1, %ref_2, [%c4]) : (!vm.ref<!vmla.buffer>, i32 ..., !vm.ref<!vmla.buffer>, i32 ..., i32, !vm.ref<!vmla.buffer>, i32 ...)
 //  CHECK-NEXT:           %ref_3 = vm.call @vmla.interface.binding(%arg0, %zero, %c1) : (!vm.ref<!vmla.interface>, i32, i32) -> !vm.ref<!vmla.buffer>
 //  CHECK-NEXT:           vm.call @vmla.buffer.copy(%ref_2, %zero, %ref_3, %zero, %c16) : (!vm.ref<!vmla.buffer>, i32, !vm.ref<!vmla.buffer>, i32, i32) -> ()
 //  CHECK-NEXT:           vm.return
@@ -130,4 +130,4 @@
 //  CHECK-NEXT:         vm.import @vmla.buffer.alloc(%byte_length : i32) -> !vm.ref<!vmla.buffer>
 //  CHECK-NEXT:         vm.import @vmla.buffer.view(%src : !vm.ref<!vmla.buffer>, %byte_offset : i32, %byte_length : i32) -> !vm.ref<!vmla.buffer>
 //  CHECK-NEXT:         vm.import @vmla.buffer.copy(%src : !vm.ref<!vmla.buffer>, %src_byte_offset : i32, %dst : !vm.ref<!vmla.buffer>, %dst_byte_offset : i32, %byte_length : i32)
-//  CHECK-NEXT:         vm.import @vmla.reduce.sum.f32(%src : !vm.ref<!vmla.buffer>, %src_shape : i32..., %init : !vm.ref<!vmla.buffer>, %init_shape : i32..., %dimension : i32, %dst : !vm.ref<!vmla.buffer>, %dst_shape : i32...)
+//  CHECK-NEXT:         vm.import @vmla.reduce.sum.f32(%src : !vm.ref<!vmla.buffer>, %src_shape : i32 ..., %init : !vm.ref<!vmla.buffer>, %init_shape : i32 ..., %dimension : i32, %dst : !vm.ref<!vmla.buffer>, %dst_shape : i32 ...)
diff --git a/iree/compiler/Dialect/VM/IR/VMOps.cpp b/iree/compiler/Dialect/VM/IR/VMOps.cpp
index f6cad21..1c7e79c 100644
--- a/iree/compiler/Dialect/VM/IR/VMOps.cpp
+++ b/iree/compiler/Dialect/VM/IR/VMOps.cpp
@@ -260,7 +260,7 @@
     }
     p.printType(op.getType().getInput(i));
     if (op.getArgAttrOfType<UnitAttr>(i, "vm.variadic")) {
-      p << "...";
+      p << " ...";
     }
     if (i < op.getNumFuncArguments() - 1) {
       p << ", ";
@@ -970,7 +970,7 @@
           p.printType(segmentType);
         } else {
           p.printType(segmentType);
-          p << "...";
+          p << " ...";
         }
       });
   p << ")";
diff --git a/iree/compiler/Dialect/VM/IR/test/control_flow_ops.mlir b/iree/compiler/Dialect/VM/IR/test/control_flow_ops.mlir
index bbc81c7..dc37a31 100644
--- a/iree/compiler/Dialect/VM/IR/test/control_flow_ops.mlir
+++ b/iree/compiler/Dialect/VM/IR/test/control_flow_ops.mlir
@@ -80,10 +80,10 @@
 
 // CHECK-LABEL: @call_variadic_empty
 vm.module @my_module {
-  vm.import @import_fn(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer>...) -> i32
+  vm.import @import_fn(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer> ...) -> i32
   vm.func @call_variadic_empty(%arg0 : i32) -> i32 {
-    // CHECK: %0 = vm.call.variadic @import_fn(%arg0, []) : (i32, !vm.ref<!hal.buffer>...) -> i32
-    %0 = vm.call.variadic @import_fn(%arg0, []) : (i32, !vm.ref<!hal.buffer>...) -> i32
+    // CHECK: %0 = vm.call.variadic @import_fn(%arg0, []) : (i32, !vm.ref<!hal.buffer> ...) -> i32
+    %0 = vm.call.variadic @import_fn(%arg0, []) : (i32, !vm.ref<!hal.buffer> ...) -> i32
     vm.return %0 : i32
   }
 }
@@ -92,10 +92,10 @@
 
 // CHECK-LABEL: @call_variadic
 vm.module @my_module {
-  vm.import @import_fn(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer>...) -> i32
+  vm.import @import_fn(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer> ...) -> i32
   vm.func @call_variadic(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer>) -> i32 {
-    // CHECK: %0 = vm.call.variadic @import_fn(%arg0, [%arg1, %arg1]) : (i32, !vm.ref<!hal.buffer>...) -> i32
-    %0 = vm.call.variadic @import_fn(%arg0, [%arg1, %arg1]) : (i32, !vm.ref<!hal.buffer>...) -> i32
+    // CHECK: %0 = vm.call.variadic @import_fn(%arg0, [%arg1, %arg1]) : (i32, !vm.ref<!hal.buffer> ...) -> i32
+    %0 = vm.call.variadic @import_fn(%arg0, [%arg1, %arg1]) : (i32, !vm.ref<!hal.buffer> ...) -> i32
     vm.return %0 : i32
   }
 }
@@ -104,10 +104,10 @@
 
 // CHECK-LABEL: @call_variadic_multiple
 vm.module @my_module {
-  vm.import @import_fn(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer>...) -> i32
+  vm.import @import_fn(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer> ...) -> i32
   vm.func @call_variadic_multiple(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer>) -> i32 {
-    // CHECK: %0 = vm.call.variadic @import_fn(%arg0, [%arg1, %arg1], [%arg1]) : (i32, !vm.ref<!hal.buffer>..., !vm.ref<!hal.buffer>...) -> i32
-    %0 = vm.call.variadic @import_fn(%arg0, [%arg1, %arg1], [%arg1]) : (i32, !vm.ref<!hal.buffer>..., !vm.ref<!hal.buffer>...) -> i32
+    // CHECK: %0 = vm.call.variadic @import_fn(%arg0, [%arg1, %arg1], [%arg1]) : (i32, !vm.ref<!hal.buffer> ..., !vm.ref<!hal.buffer> ...) -> i32
+    %0 = vm.call.variadic @import_fn(%arg0, [%arg1, %arg1], [%arg1]) : (i32, !vm.ref<!hal.buffer> ..., !vm.ref<!hal.buffer> ...) -> i32
     vm.return %0 : i32
   }
 }
@@ -116,10 +116,10 @@
 
 // CHECK-LABEL: @call_variadic_no_results
 vm.module @my_module {
-  vm.import @import_fn(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer>...)
+  vm.import @import_fn(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer> ...)
   vm.func @call_variadic_no_results(%arg0 : i32, %arg1 : !vm.ref<!hal.buffer>) {
-    // CHECK: vm.call.variadic @import_fn(%arg0, [%arg1, %arg1], [%arg1]) : (i32, !vm.ref<!hal.buffer>..., !vm.ref<!hal.buffer>...)
-    vm.call.variadic @import_fn(%arg0, [%arg1, %arg1], [%arg1]) : (i32, !vm.ref<!hal.buffer>..., !vm.ref<!hal.buffer>...)
+    // CHECK: vm.call.variadic @import_fn(%arg0, [%arg1, %arg1], [%arg1]) : (i32, !vm.ref<!hal.buffer> ..., !vm.ref<!hal.buffer> ...)
+    vm.call.variadic @import_fn(%arg0, [%arg1, %arg1], [%arg1]) : (i32, !vm.ref<!hal.buffer> ..., !vm.ref<!hal.buffer> ...)
     vm.return
   }
 }
@@ -128,10 +128,10 @@
 
 // CHECK-LABEL: @call_variadic_tuples
 vm.module @my_module {
-  vm.import @import_fn(%arg0 : tuple<i32, i32, i32>...)
+  vm.import @import_fn(%arg0 : tuple<i32, i32, i32> ...)
   vm.func @call_variadic_tuples(%arg0 : i32, %arg1 : i32) {
-    // CHECK: vm.call.variadic @import_fn([(%arg0, %arg0, %arg0), (%arg1, %arg1, %arg1)]) : (tuple<i32, i32, i32>...)
-    vm.call.variadic @import_fn([(%arg0, %arg0, %arg0), (%arg1, %arg1, %arg1)]) : (tuple<i32, i32, i32>...)
+    // CHECK: vm.call.variadic @import_fn([(%arg0, %arg0, %arg0), (%arg1, %arg1, %arg1)]) : (tuple<i32, i32, i32> ...)
+    vm.call.variadic @import_fn([(%arg0, %arg0, %arg0), (%arg1, %arg1, %arg1)]) : (tuple<i32, i32, i32> ...)
     vm.return
   }
 }
diff --git a/iree/compiler/Dialect/VM/IR/test/structural_ops.mlir b/iree/compiler/Dialect/VM/IR/test/structural_ops.mlir
index 980aec2..7f9f1ff 100644
--- a/iree/compiler/Dialect/VM/IR/test/structural_ops.mlir
+++ b/iree/compiler/Dialect/VM/IR/test/structural_ops.mlir
@@ -64,6 +64,6 @@
   // CHECK-NEXT: vm.import @my.fn_attrs(%foo : i32, %bar : i32) -> i32 attributes {a}
   vm.import @my.fn_attrs(%foo : i32, %bar : i32) -> i32 attributes {a}
 
-  // CHECK-NEXT: vm.import @my.fn_varargs(%foo : vector<3xi32>..., %bar : tuple<i32, i32>...) -> i32
-  vm.import @my.fn_varargs(%foo : vector<3xi32>..., %bar : tuple<i32, i32>...) -> i32
+  // CHECK-NEXT: vm.import @my.fn_varargs(%foo : vector<3xi32> ..., %bar : tuple<i32, i32> ...) -> i32
+  vm.import @my.fn_varargs(%foo : vector<3xi32> ..., %bar : tuple<i32, i32> ...) -> i32
 }
diff --git a/iree/compiler/Dialect/VMLA/Conversion/VMLAToVM/test/conversion.mlir b/iree/compiler/Dialect/VMLA/Conversion/VMLAToVM/test/conversion.mlir
index cd6a14e..51b005d 100644
--- a/iree/compiler/Dialect/VMLA/Conversion/VMLAToVM/test/conversion.mlir
+++ b/iree/compiler/Dialect/VMLA/Conversion/VMLAToVM/test/conversion.mlir
@@ -49,7 +49,7 @@
   // CHECK-DAG: %c1 = vm.const.i32 1 : i32
   // CHECK-DAG: %c4 = vm.const.i32 4 : i32
   // CHECK-DAG: %c8 = vm.const.i32 8 : i32
-  // CHECK-NEXT: vm.call.variadic @vmla.transpose.x16(%arg0, [%c4, %arg1, %c8], [%c1], %arg2, [%arg3, %c4, %c8]) : (!vm.ref<!vmla.buffer>, i32..., i32..., !vm.ref<!vmla.buffer>, i32...)
+  // CHECK-NEXT: vm.call.variadic @vmla.transpose.x16(%arg0, [%c4, %arg1, %c8], [%c1], %arg2, [%arg3, %c4, %c8]) : (!vm.ref<!vmla.buffer>, i32 ..., i32 ..., !vm.ref<!vmla.buffer>, i32 ...)
   vmla.transpose %arg0(%rs0 : !shapex.ranked_shape<[4,?,8]>),
                  out %arg2(%rs1 : !shapex.ranked_shape<[?,4,8]>)
                  {permutation = dense<[1]> : tensor<1xi32>} : i16