[llvm] df8f12f - [Tests] Added InlineCost test when arg is known as dereferenceable
Dávid Bolvanský via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 14:58:51 PDT 2023
Author: Dávid Bolvanský
Date: 2023-04-05T23:58:37+02:00
New Revision: df8f12f38e7b5cd4c64fd5cd95f7333cf063455b
URL: https://github.com/llvm/llvm-project/commit/df8f12f38e7b5cd4c64fd5cd95f7333cf063455b
DIFF: https://github.com/llvm/llvm-project/commit/df8f12f38e7b5cd4c64fd5cd95f7333cf063455b.diff
LOG: [Tests] Added InlineCost test when arg is known as dereferenceable
Added:
Modified:
llvm/test/Transforms/Inline/nonnull.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Inline/nonnull.ll b/llvm/test/Transforms/Inline/nonnull.ll
index 64c4e4d3a7f40..324afbbbdc113 100644
--- a/llvm/test/Transforms/Inline/nonnull.ll
+++ b/llvm/test/Transforms/Inline/nonnull.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -S -passes=inline %s | FileCheck %s
; RUN: opt -S -passes='cgscc(inline)' %s | FileCheck %s
; RUN: opt -S -passes='module-inline' %s | FileCheck %s
@@ -6,6 +7,26 @@ declare void @foo()
declare void @bar()
define void @callee(ptr %arg) {
+; CHECK-LABEL: define void @callee
+; CHECK-SAME: (ptr [[ARG:%.*]]) {
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[ARG]], null
+; CHECK-NEXT: br i1 [[CMP]], label [[EXPENSIVE:%.*]], label [[DONE:%.*]]
+; CHECK: expensive:
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: ret void
+; CHECK: done:
+; CHECK-NEXT: call void @bar()
+; CHECK-NEXT: ret void
+;
%cmp = icmp eq ptr %arg, null
br i1 %cmp, label %expensive, label %done
@@ -31,17 +52,43 @@ done:
; Positive test - arg is known non null
define void @caller(ptr nonnull %arg) {
-; CHECK-LABEL: @caller
-; CHECK: call void @bar()
+; CHECK-LABEL: define void @caller
+; CHECK-SAME: (ptr nonnull [[ARG:%.*]]) {
+; CHECK-NEXT: call void @bar()
+; CHECK-NEXT: ret void
+;
call void @callee(ptr nonnull %arg)
ret void
}
; Negative test - arg is not known to be non null
define void @caller2(ptr %arg) {
-; CHECK-LABEL: @caller2
-; CHECK: call void @callee(
+; CHECK-LABEL: define void @caller2
+; CHECK-SAME: (ptr [[ARG:%.*]]) {
+; CHECK-NEXT: call void @callee(ptr [[ARG]])
+; CHECK-NEXT: ret void
+;
call void @callee(ptr %arg)
ret void
}
+define void @caller3(ptr dereferenceable(8) %arg) {
+; CHECK-LABEL: define void @caller3
+; CHECK-SAME: (ptr dereferenceable(8) [[ARG:%.*]]) {
+; CHECK-NEXT: call void @callee(ptr [[ARG]])
+; CHECK-NEXT: ret void
+;
+ call void @callee(ptr %arg)
+ ret void
+}
+
+define void @caller4(ptr %arg) {
+; CHECK-LABEL: define void @caller4
+; CHECK-SAME: (ptr [[ARG:%.*]]) {
+; CHECK-NEXT: call void @callee(ptr dereferenceable(8) [[ARG]])
+; CHECK-NEXT: ret void
+;
+ call void @callee(ptr dereferenceable(8) %arg)
+ ret void
+}
+
More information about the llvm-commits
mailing list