62 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 42; RUN: opt -S -passes=attributor < %s | FileCheck %s3 4define void @null_ptr_is_valid_call_with_null() #0 {5; CHECK-LABEL: define void @null_ptr_is_valid_call_with_null(6; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {7; CHECK-NEXT: call void @store_as0(ptr noalias nofree noundef writeonly null) #[[ATTR4:[0-9]+]]8; CHECK-NEXT: ret void9;10 call void @store_as0(ptr null)11 ret void12}13 14define void @null_ptr_is_valid_call_with_undef() #0 {15; CHECK-LABEL: define void @null_ptr_is_valid_call_with_undef(16; CHECK-SAME: ) #[[ATTR1:[0-9]+]] {17; CHECK-NEXT: call void @store_as0(ptr undef) #[[ATTR4]]18; CHECK-NEXT: ret void19;20 call void @store_as0(ptr undef)21 ret void22}23 24define void @store_as0(ptr %0) {25; CHECK-LABEL: define void @store_as0(26; CHECK-SAME: ptr nofree noundef nonnull writeonly align 2 captures(none) dereferenceable(2) [[TMP0:%.*]]) #[[ATTR2:[0-9]+]] {27; CHECK-NEXT: store i16 0, ptr [[TMP0]], align 228; CHECK-NEXT: ret void29;30 store i16 0, ptr %0, align 231 ret void32}33 34define void @call_store_as1() {35; CHECK-LABEL: define void @call_store_as1(36; CHECK-SAME: ) #[[ATTR3:[0-9]+]] {37; CHECK-NEXT: call void @store_as1(ptr addrspace(1) nofree noundef writeonly captures(none) null) #[[ATTR4]]38; CHECK-NEXT: ret void39;40 call void @store_as1(ptr addrspace(1) null)41 ret void42}43 44define void @store_as1(ptr addrspace(1) %arg) {45; CHECK-LABEL: define void @store_as1(46; CHECK-SAME: ptr addrspace(1) nofree noundef writeonly align 2 captures(none) dereferenceable_or_null(2) [[ARG:%.*]]) #[[ATTR2]] {47; CHECK-NEXT: store i16 0, ptr addrspace(1) [[ARG]], align 248; CHECK-NEXT: ret void49;50 store i16 0, ptr addrspace(1) %arg, align 251 ret void52}53 54attributes #0 = { null_pointer_is_valid }55;.56; CHECK: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind null_pointer_is_valid willreturn memory(write) }57; CHECK: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind null_pointer_is_valid willreturn memory(none) }58; CHECK: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }59; CHECK: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }60; CHECK: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn memory(write) }61;.62