From 0417b9d63735f70fa9c7fe35ba052665994bd546 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 2 Dec 2022 13:37:57 -0800 Subject: [PATCH] [Inline] Add a basic test for the module inliner The new test ensures that the module inliner works with all currently supported priority modes. Different priority modes result in no difference in terms of the output for these simple cases, so this is more of a "better than nothing" test. Differential Revision: https://reviews.llvm.org/D139222 --- llvm/test/Transforms/Inline/module-inliner-basic.ll | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 llvm/test/Transforms/Inline/module-inliner-basic.ll diff --git a/llvm/test/Transforms/Inline/module-inliner-basic.ll b/llvm/test/Transforms/Inline/module-inliner-basic.ll new file mode 100644 index 0000000..4fede8a --- /dev/null +++ b/llvm/test/Transforms/Inline/module-inliner-basic.ll @@ -0,0 +1,20 @@ +; RUN: opt -passes=module-inline -S < %s | FileCheck %s +; RUN: opt -passes=module-inline -inline-priority-mode=size -S < %s | FileCheck %s +; RUN: opt -passes=module-inline -inline-priority-mode=cost -S < %s | FileCheck %s +; RUN: opt -passes=module-inline -inline-priority-mode=cost-benefit -S < %s | FileCheck %s + +define i32 @callee(i32 %a) { +entry: + %add = add nsw i32 %a, 1 + ret i32 %add +} + +define i32 @caller(i32 %a) { +entry: + %call = call i32 @callee(i32 %a) + ret i32 %call +} + +; CHECK-LABEL: @caller +; CHECK-NOT: call +; CHECK: ret -- 2.7.4