llvm-project/flang/test/Fir/inline.fir
Valentin Clement 6da728ad99
[flang] Add FIRInlinerInterface
This patch introduces the FIRInlinerInterface.
This class defines the interface for handling inlining of FIR calls.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D119340

Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-02-10 11:38:34 +01:00

20 lines
537 B
Plaintext

// RUN: tco --target=x86_64-unknown-linux-gnu --inline-all %s -o - | FileCheck %s
// CHECK-LABEL: @add
func @add(%a : i32, %b : i32) -> i32 {
// CHECK: %[[add:.*]] = add i32
%p = arith.addi %a, %b : i32
// CHECK: ret i32 %[[add]]
return %p : i32
}
// CHECK-LABEL: @test
func @test(%a : i32, %b : i32, %c : i32) -> i32 {
// CHECK: %[[add:.*]] = add i32
%m = fir.call @add(%a, %b) : (i32, i32) -> i32
// CHECK: %[[mul:.*]] = mul i32 %[[add]],
%n = arith.muli %m, %c : i32
// CHECK: ret i32 %[[mul]]
return %n : i32
}