[llvm] 0417b9d - [Inline] Add a basic test for the module inliner

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 13:38:02 PST 2022


Author: Kazu Hirata
Date: 2022-12-02T13:37:57-08:00
New Revision: 0417b9d63735f70fa9c7fe35ba052665994bd546

URL: https://github.com/llvm/llvm-project/commit/0417b9d63735f70fa9c7fe35ba052665994bd546
DIFF: https://github.com/llvm/llvm-project/commit/0417b9d63735f70fa9c7fe35ba052665994bd546.diff

LOG: [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

Added: 
    llvm/test/Transforms/Inline/module-inliner-basic.ll

Modified: 
    

Removed: 
    


################################################################################
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 0000000000000..4fede8a00cbe9
--- /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


        


More information about the llvm-commits mailing list