Files
clang-p2996/mlir/test/Conversion/ControlFlowToLLVM/assert.mlir
Matthias Springer 1fdbbd158d [mlir][Conversion] Implement ConvertToLLVMPatternInterface for FuncDialect
Also a new pass option `ConvertToLLVMPass` to populate only patterns from the specified dialects. This is needed because the existing test cases expect that only ops from certain dialects are lowered. (E.g., "arith-to-llvm" expects that only "arith" ops are lowered but not "func" ops.)

Differential Revision: https://reviews.llvm.org/D157627
2023-08-11 10:05:30 +02:00

22 lines
796 B
MLIR

// RUN: mlir-opt %s -convert-cf-to-llvm='use-opaque-pointers=1' | 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
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) -> ()