[llvm] 04742f3 - [SCCP] Add test for nonnull argument inference (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 01:29:11 PDT 2024


Author: Nikita Popov
Date: 2024-09-09T10:28:49+02:00
New Revision: 04742f34b343af87dda93edacbb06f6e98a1d80f

URL: https://github.com/llvm/llvm-project/commit/04742f34b343af87dda93edacbb06f6e98a1d80f
DIFF: https://github.com/llvm/llvm-project/commit/04742f34b343af87dda93edacbb06f6e98a1d80f.diff

LOG: [SCCP] Add test for nonnull argument inference (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/SCCP/pointer-nonnull.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SCCP/pointer-nonnull.ll b/llvm/test/Transforms/SCCP/pointer-nonnull.ll
index c3a6a762e31744..9eb3a45402142a 100644
--- a/llvm/test/Transforms/SCCP/pointer-nonnull.ll
+++ b/llvm/test/Transforms/SCCP/pointer-nonnull.ll
@@ -247,6 +247,36 @@ define ptr @ret_maybe_null_pointer(ptr %p) {
   ret ptr %p
 }
 
+define internal void @ip_nonnull_arg_callee(ptr %p) {
+; CHECK-LABEL: define internal void @ip_nonnull_arg_callee(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:    ret void
+;
+  ret void
+}
+
+define internal void @ip_not_nonnull_arg_callee(ptr %p) {
+; CHECK-LABEL: define internal void @ip_not_nonnull_arg_callee(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:    ret void
+;
+  ret void
+}
+
+define void @ip_nonnull_arg_caller(ptr nonnull %p) {
+; CHECK-LABEL: define void @ip_nonnull_arg_caller(
+; CHECK-SAME: ptr nonnull [[P:%.*]]) {
+; CHECK-NEXT:    call void @ip_nonnull_arg_callee(ptr [[P]])
+; CHECK-NEXT:    call void @ip_not_nonnull_arg_callee(ptr [[P]])
+; CHECK-NEXT:    call void @ip_not_nonnull_arg_callee(ptr null)
+; CHECK-NEXT:    ret void
+;
+  call void @ip_nonnull_arg_callee(ptr %p)
+  call void @ip_not_nonnull_arg_callee(ptr %p)
+  call void @ip_not_nonnull_arg_callee(ptr null)
+  ret void
+}
+
 ;.
 ; SCCP: [[META0]] = !{}
 ;.


        


More information about the llvm-commits mailing list