[all-commits] [llvm/llvm-project] fed9ff: [mlir] Test CallOp STD->LLVM conversion.
Alexander Belyaev via All-commits
all-commits at lists.llvm.org
Thu Aug 13 10:14:42 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: fed9ff511711762ac8cccbb9954eb4c0554fe622
https://github.com/llvm/llvm-project/commit/fed9ff511711762ac8cccbb9954eb4c0554fe622
Author: Alexander Belyaev <pifon at google.com>
Date: 2020-08-13 (Thu, 13 Aug 2020)
Changed paths:
A mlir/test/Transforms/test-convert-call-op.mlir
M mlir/test/lib/Transforms/CMakeLists.txt
A mlir/test/lib/Transforms/TestConvertCallOp.cpp
M mlir/tools/mlir-opt/mlir-opt.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list