llvm/mlir/test/IR/print-ir-invalid.mlir
River Riddle 3655069234 [mlir] Move the Builtin FuncOp to the Func dialect
This commit moves FuncOp out of the builtin dialect, and into the Func
dialect. This move has been planned in some capacity from the moment
we made FuncOp an operation (years ago). This commit handles the
functional aspects of the move, but various aspects are left untouched
to ease migration: func::FuncOp is re-exported into mlir to reduce
the actual API churn, the assembly format still accepts the unqualified
`func`. These temporary measures will remain for a little while to
simplify migration before being removed.

Differential Revision: https://reviews.llvm.org/D121266
2022-03-16 17:07:03 -07:00

34 lines
1.1 KiB
MLIR

// # RUN: mlir-opt -test-print-invalid %s | FileCheck %s
// # RUN: mlir-opt -test-print-invalid %s --mlir-print-assume-verified | FileCheck %s --check-prefix=ASSUME-VERIFIED
// The pass creates some ops and prints them to stdout, the input is just an
// empty module.
module {}
// The operation is invalid because the body does not have a terminator, print
// the generic form.
// CHECK: Invalid operation:
// CHECK-NEXT: "func.func"() ({
// CHECK-NEXT: ^bb0:
// CHECK-NEXT: })
// CHECK-SAME: sym_name = "test"
// The operation is valid because the body has a terminator, print the custom
// form.
// CHECK: Valid operation:
// CHECK-NEXT: func @test() {
// CHECK-NEXT: return
// CHECK-NEXT: }
// With --mlir-print-assume-verified the custom form is printed in both cases.
// This works in this particular case, but may crash in general.
// ASSUME-VERIFIED: Invalid operation:
// ASSUME-VERIFIED-NEXT: func @test() {
// ASSUME-VERIFIED-NEXT: }
// ASSUME-VERIFIED: Valid operation:
// ASSUME-VERIFIED-NEXT: func @test() {
// ASSUME-VERIFIED-NEXT: return
// ASSUME-VERIFIED-NEXT: }