llvm-capstone/mlir/test/IR/test-func-erase-result.mlir
Rahul Joshi b7382ed3fe [MLIR] Extend Symbol verification to reject public symbol declarations.
- Extend the Symbol interface with `isDeclaration` to identify operations that declare
  a symbol as opposed to define it.
- Extend verification to disallow public declarations as per the discussion in
   https://llvm.discourse.group/t/rfc-symbol-definition-declaration-x-visibility-checks/2140
- Adopt the new interface for `FuncOp` and fix test and code to not have/create public
  function declarations.

Differential Revision: https://reviews.llvm.org/D91456
2020-11-16 16:05:32 -08:00

69 lines
1.4 KiB
MLIR

// RUN: mlir-opt %s -test-func-erase-result -split-input-file | FileCheck %s
// CHECK: func private @f(){{$}}
// CHECK-NOT: attributes{{.*}}result
func private @f() -> (f32 {test.erase_this_result})
// -----
// CHECK: func private @f() -> (f32 {test.A})
// CHECK-NOT: attributes{{.*}}result
func private @f() -> (
f32 {test.erase_this_result},
f32 {test.A}
)
// -----
// CHECK: func private @f() -> (f32 {test.A})
// CHECK-NOT: attributes{{.*}}result
func private @f() -> (
f32 {test.A},
f32 {test.erase_this_result}
)
// -----
// CHECK: func private @f() -> (f32 {test.A}, f32 {test.B})
// CHECK-NOT: attributes{{.*}}result
func private @f() -> (
f32 {test.A},
f32 {test.erase_this_result},
f32 {test.B}
)
// -----
// CHECK: func private @f() -> (f32 {test.A}, f32 {test.B})
// CHECK-NOT: attributes{{.*}}result
func private @f() -> (
f32 {test.A},
f32 {test.erase_this_result},
f32 {test.erase_this_result},
f32 {test.B}
)
// -----
// CHECK: func private @f() -> (f32 {test.A}, f32 {test.B}, f32 {test.C})
// CHECK-NOT: attributes{{.*}}result
func private @f() -> (
f32 {test.A},
f32 {test.erase_this_result},
f32 {test.B},
f32 {test.erase_this_result},
f32 {test.C}
)
// -----
// CHECK: func private @f() -> (tensor<1xf32>, tensor<2xf32>, tensor<3xf32>)
// CHECK-NOT: attributes{{.*}}result
func private @f() -> (
tensor<1xf32>,
f32 {test.erase_this_result},
tensor<2xf32>,
f32 {test.erase_this_result},
tensor<3xf32>
)