Don't force newline before function attributes
Due to legacy reasons, a newline character followed by two spaces was always
inserted before the attributes of the function Op in pretty form. This breaks
formatting when functions are nested in some other operations. Don't print the
newline and just put the attributes on the same line, which is also more
consistent with module Op. Line breaking aware of indentation can be introduced
separately into the parser if deemed useful.
PiperOrigin-RevId: 281721793
diff --git a/integrations/tensorflow/compiler/test/saved_model_adopt_exports.py b/integrations/tensorflow/compiler/test/saved_model_adopt_exports.py
index 583ff79..afbb341 100644
--- a/integrations/tensorflow/compiler/test/saved_model_adopt_exports.py
+++ b/integrations/tensorflow/compiler/test/saved_model_adopt_exports.py
@@ -33,7 +33,7 @@
# CHECK: module
# CHECK-NOT: tf_saved_model.semantics
# CHECK: @simple_mul_no_capture
-# CHECK-NEXT: iree.module.export
+# CHECK: iree.module.export
# CHECK: FINISH_TEST
class T0001_FlatArgsResultsNoBoundGlobals(tf.Module):
diff --git a/iree/compiler/Dialect/Flow/Analysis/test/dispatchability.mlir b/iree/compiler/Dialect/Flow/Analysis/test/dispatchability.mlir
index 69c8242..3453223 100644
--- a/iree/compiler/Dialect/Flow/Analysis/test/dispatchability.mlir
+++ b/iree/compiler/Dialect/Flow/Analysis/test/dispatchability.mlir
@@ -15,7 +15,7 @@
// RUN: iree-opt -split-input-file -test-iree-flow-dispatchability %s | FileCheck %s --dump-input=fail
// CHECK-LABEL: @empty
-// CHECK-NEXT: dispatchable = true
+// CHECK-SAME: dispatchable = true
func @empty() {
return
}
@@ -23,7 +23,7 @@
// -----
// CHECK-LABEL: @simpleMath
-// CHECK-NEXT: dispatchable = true
+// CHECK-SAME: dispatchable = true
func @simpleMath(%arg0 : tensor<4xf32>) -> tensor<4xf32> {
%0 = xla_hlo.add %arg0, %arg0 : tensor<4xf32>
return %0 : tensor<4xf32>
@@ -32,7 +32,7 @@
// -----
// CHECK-LABEL: @stdElementwiseOps
-// CHECK-NEXT: dispatchable = true
+// CHECK-SAME: dispatchable = true
func @stdElementwiseOps(%arg0 : tensor<4xf32>) -> tensor<4xf32> {
%0 = addf %arg0, %arg0 : tensor<4xf32>
%1 = subf %0, %arg0 : tensor<4xf32>
@@ -43,7 +43,7 @@
// -----
// CHECK-LABEL: @hloElementwiseOps
-// CHECK-NEXT: dispatchable = true
+// CHECK-SAME: dispatchable = true
func @hloElementwiseOps(%arg0 : tensor<4xf32>) -> tensor<4xf32> {
%0 = xla_hlo.add %arg0, %arg0 : tensor<4xf32>
%1 = xla_hlo.sub %0, %arg0 : tensor<4xf32>
@@ -54,7 +54,7 @@
// -----
// CHECK-LABEL: @interleavedDot
-// CHECK-NEXT: dispatchable = false
+// CHECK-SAME: dispatchable = false
func @interleavedDot(%arg0 : tensor<4x4xf32>) -> tensor<4x4xf32> {
%0 = xla_hlo.add %arg0, %arg0 : tensor<4x4xf32>
%1 = "xla_hlo.dot"(%0, %arg0) : (tensor<4x4xf32>, tensor<4x4xf32>) -> tensor<4x4xf32>
@@ -65,7 +65,7 @@
// -----
// CHECK-LABEL: @caller
-// CHECK-NEXT: dispatchable = true
+// CHECK-SAME: dispatchable = true
func @caller(%arg0 : tensor<4xf32>) -> tensor<4xf32> {
%0 = xla_hlo.add %arg0, %arg0 : tensor<4xf32>
%1 = call @callee(%0) : (tensor<4xf32>) -> tensor<4xf32>
@@ -73,7 +73,7 @@
return %2 : tensor<4xf32>
}
// CHECK-LABEL: func @callee
-// CHECK-NEXT: dispatchable = true
+// CHECK-SAME: dispatchable = true
func @callee(%arg0 : tensor<4xf32>) -> tensor<4xf32> {
%0 = xla_hlo.mul %arg0, %arg0 : tensor<4xf32>
return %0 : tensor<4xf32>
@@ -82,7 +82,7 @@
// -----
// CHECK-LABEL: @dotCaller
-// CHECK-NEXT: dispatchable = false
+// CHECK-SAME: dispatchable = false
func @dotCaller(%arg0 : tensor<4x4xf32>) -> tensor<4x4xf32> {
%0 = xla_hlo.add %arg0, %arg0 : tensor<4x4xf32>
%1 = call @dotCallee(%0) : (tensor<4x4xf32>) -> tensor<4x4xf32>
@@ -90,7 +90,7 @@
return %2 : tensor<4x4xf32>
}
// CHECK-LABEL: func @dotCallee
-// CHECK-NEXT: dispatchable = false
+// CHECK-SAME: dispatchable = false
func @dotCallee(%arg0 : tensor<4x4xf32>) -> tensor<4x4xf32> {
%0 = "xla_hlo.dot"(%arg0, %arg0) : (tensor<4x4xf32>, tensor<4x4xf32>) -> tensor<4x4xf32>
return %0 : tensor<4x4xf32>
diff --git a/iree/compiler/Dialect/VM/IR/test/structural_ops.mlir b/iree/compiler/Dialect/VM/IR/test/structural_ops.mlir
index fd67aec..d659b7e 100644
--- a/iree/compiler/Dialect/VM/IR/test/structural_ops.mlir
+++ b/iree/compiler/Dialect/VM/IR/test/structural_ops.mlir
@@ -41,7 +41,7 @@
}
// CHECK-LABEL: vm.func @fn_attributed(%arg0: i32) -> i32
- // CHECK-NEXT: attributes {a}
+ // CHECK: attributes {a}
vm.func @fn_attributed(%arg0 : i32) -> i32
attributes {a} {
vm.return %arg0 : i32
diff --git a/iree/compiler/Transforms/Interpreter/test/make_executable_abi.mlir b/iree/compiler/Transforms/Interpreter/test/make_executable_abi.mlir
index f90fc54..619e32b 100644
--- a/iree/compiler/Transforms/Interpreter/test/make_executable_abi.mlir
+++ b/iree/compiler/Transforms/Interpreter/test/make_executable_abi.mlir
@@ -16,7 +16,7 @@
// CHECK-LABEL: func @staticOutputEntry
func @staticOutputEntry(%arg0: memref<4x2xf32>, %arg1: memref<4x2xf32>)
- // CHECK-NEXT: attributes
+ // CHECK: attributes
attributes {iree.executable.export} {
// CHECK-NEXT: %0 = iree.memref_to_tensor(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
%0 = iree.load_input(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
@@ -40,7 +40,7 @@
// CHECK-LABEL: func @scalarFnEntry
func @scalarFnEntry(%arg0: memref<f32>, %arg1: memref<f32>)
- // CHECK-NEXT: attributes
+ // CHECK: attributes
attributes {iree.executable.export} {
// CHECK-NEXT: %0 = load %arg0[] : memref<f32>
%0 = iree.load_input(%arg0 : memref<f32>) : f32
@@ -61,7 +61,7 @@
// CHECK-LABEL: func @scalarTensorFnEntry
func @scalarTensorFnEntry(%arg0: memref<f32>, %arg1: memref<f32>)
- // CHECK-NEXT: attributes
+ // CHECK: attributes
attributes {iree.executable.export} {
// CHECK-NEXT: %0 = iree.memref_to_tensor(%arg0 : memref<f32>) : tensor<f32>
%0 = iree.load_input(%arg0 : memref<f32>) : tensor<f32>
@@ -85,7 +85,7 @@
// CHECK-LABEL: func @returnValuesEntry
func @returnValuesEntry(%arg0: memref<4x2xf32>, %arg1: memref<4x2xf32>, %arg2: memref<4x2xf32>) -> (memref<4x2xf32>, memref<4x2xf32>)
- // CHECK-NEXT: attributes
+ // CHECK: attributes
attributes {iree.executable.export} {
// CHECK-NEXT: %0 = iree.memref_to_tensor(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
%0 = iree.load_input(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
@@ -116,7 +116,7 @@
// CHECK-LABEL: func @aliasInputsEntry
func @aliasInputsEntry(%arg0: memref<4x2xf32>, %arg1: memref<4x2xf32>)
- // CHECK-NEXT: attributes
+ // CHECK: attributes
attributes {iree.executable.export} {
// CHECK-NEXT: %0 = iree.memref_to_tensor(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
%0 = iree.load_input(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
@@ -142,7 +142,7 @@
// CHECK-LABEL: func @aliasOutputsEntry
func @aliasOutputsEntry(%arg0: memref<4x2xf32>, %arg1: memref<4x2xf32>)
- // CHECK-NEXT: attributes
+ // CHECK: attributes
attributes {iree.executable.export} {
// CHECK-NEXT: %0 = iree.memref_to_tensor(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>
%0 = iree.load_input(%arg0 : memref<4x2xf32>) : tensor<4x2xf32>