llvm/mlir/tools
Alexander Belyaev fed9ff5117 [mlir] Test CallOp STD->LLVM conversion.
This exercises the corner case that was fixed in
https://reviews.llvm.org/rG8979a9cdf226066196f1710903d13492e6929563.

The bug can be reproduced when there is a @callee with a custom type argument and @caller has a producer of this argument passed to the @callee.

Example:
func @callee(!test.test_type) -> i32
func @caller() -> i32 {
  %arg = "test.type_producer"() : () -> !test.test_type
  %out = call @callee(%arg) : (!test.test_type) -> i32
  return %out : i32
}

Even though there is a type conversion for !test.test_type, the output IR (before the fix) contained a DialectCastOp:

module {
  llvm.func @callee(!llvm.ptr<i8>) -> !llvm.i32
  llvm.func @caller() -> !llvm.i32 {
    %0 = llvm.mlir.null : !llvm.ptr<i8>
    %1 = llvm.mlir.cast %0 : !llvm.ptr<i8> to !test.test_type
    %2 = llvm.call @callee(%1) : (!test.test_type) -> !llvm.i32
    llvm.return %2 : !llvm.i32
  }
}

instead of

module {
  llvm.func @callee(!llvm.ptr<i8>) -> !llvm.i32
  llvm.func @caller() -> !llvm.i32 {
    %0 = llvm.mlir.null : !llvm.ptr<i8>
    %1 = llvm.call @callee(%0) : (!llvm.ptr<i8>) -> !llvm.i32
    llvm.return %1 : !llvm.i32
  }
}

Differential Revision: https://reviews.llvm.org/D85914
2020-08-13 19:10:21 +02:00
..
mlir-cpu-runner [MLIR] Move JitRunner to live with ExecutionEngine 2020-05-15 14:37:10 -07:00
mlir-cuda-runner [MLIR] Adding gpu.host_register op and lower it to a runtime call. 2020-08-10 22:46:17 +02:00
mlir-linalg-ods-gen [mlir][Linalg] Retire C++ MatmulOp in favor of a linalg-ods-gen'd op. 2020-06-16 10:46:35 -04:00
mlir-opt [mlir] Test CallOp STD->LLVM conversion. 2020-08-13 19:10:21 +02:00
mlir-reduce Remove unused class member (NFC) 2020-08-08 05:36:41 +00:00
mlir-rocm-runner [MLIR] Adding gpu.host_register op and lower it to a runtime call. 2020-08-10 22:46:17 +02:00
mlir-shlib [MLIR] Reapply: Adjust libMLIR building to more closely follow libClang 2020-05-04 20:47:57 -07:00
mlir-tblgen [NFC][MLIR][OpenMP] Add comments and test for OpenMP enum declaration utility 2020-08-14 23:22:23 +01:00
mlir-translate [mlir] use the new stateful LLVM type translator by default 2020-08-06 00:36:33 +02:00
mlir-vulkan-runner [mlir][NFC] Remove usernames and google bug numbers from TODO comments. 2020-07-07 01:40:52 -07:00
CMakeLists.txt Create the MLIR Reduce framework 2020-07-07 23:42:53 +00:00