Skip to content

Commit

Permalink
[SCCP] Add test for nonnull argument inference (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic authored and VitaNuo committed Sep 12, 2024
1 parent ecdf9a6 commit c524ccc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions llvm/test/Transforms/SCCP/pointer-nonnull.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = !{}
;.
Expand Down

0 comments on commit c524ccc

Please sign in to comment.