This commit improves the `allowPatternRollback` flag handling in the dialect conversion driver. Previously, this flag was used to merely detect cases that are incompatible with the new One-Shot Dialect Conversion driver. This commit implements the driver itself: when the flag is set to "false", all IR changes are materialized immediately, bypassing the `IRRewrite` and `ConversionValueMapping` infrastructure. A few selected test cases now run with both the old and the new driver. RFC: https://discourse.llvm.org/t/rfc-a-new-one-shot-dialect-conversion-driver/79083
23 lines
890 B
MLIR
23 lines
890 B
MLIR
// RUN: mlir-opt %s -convert-cf-to-llvm | FileCheck %s
|
|
|
|
// Same below, but using the `ConvertToLLVMPatternInterface` entry point
|
|
// and the generic `convert-to-llvm` pass.
|
|
// RUN: mlir-opt --convert-to-llvm="filter-dialects=cf" --split-input-file %s | FileCheck %s
|
|
// RUN: mlir-opt --convert-to-llvm="filter-dialects=cf allow-pattern-rollback=0" --split-input-file %s | FileCheck %s
|
|
|
|
func.func @main() {
|
|
%a = arith.constant 0 : i1
|
|
cf.assert %a, "assertion foo"
|
|
return
|
|
}
|
|
|
|
// CHECK: llvm.func @puts(!llvm.ptr)
|
|
|
|
// CHECK-LABEL: @main
|
|
// CHECK: llvm.cond_br %{{.*}}, ^{{.*}}, ^[[FALSE_BRANCH:[[:alnum:]]+]]
|
|
|
|
// CHECK: ^[[FALSE_BRANCH]]:
|
|
// CHECK: %[[ADDRESS_OF:.*]] = llvm.mlir.addressof @{{.*}} : !llvm.ptr{{$}}
|
|
// CHECK: %[[GEP:.*]] = llvm.getelementptr %[[ADDRESS_OF]][0] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<{{[0-9]+}} x i8>
|
|
// CHECK: llvm.call @puts(%[[GEP]]) : (!llvm.ptr) -> ()
|