|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4 |
| 2 | +; RUN: opt -S -passes=attributor < %s | FileCheck %s |
| 3 | + |
| 4 | +define 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 nofree noundef writeonly align 4294967296 null) #[[ATTR4:[0-9]+]] |
| 8 | +; CHECK-NEXT: ret void |
| 9 | +; |
| 10 | + call void @store_as0(ptr null) |
| 11 | + ret void |
| 12 | +} |
| 13 | + |
| 14 | +define 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 void |
| 19 | +; |
| 20 | + call void @store_as0(ptr undef) |
| 21 | + ret void |
| 22 | +} |
| 23 | + |
| 24 | +define void @store_as0(ptr %0) { |
| 25 | +; CHECK-LABEL: define void @store_as0( |
| 26 | +; CHECK-SAME: ptr nocapture nofree noundef nonnull writeonly align 2 dereferenceable(2) [[TMP0:%.*]]) #[[ATTR2:[0-9]+]] { |
| 27 | +; CHECK-NEXT: store i16 0, ptr [[TMP0]], align 2 |
| 28 | +; CHECK-NEXT: ret void |
| 29 | +; |
| 30 | + store i16 0, ptr %0, align 2 |
| 31 | + ret void |
| 32 | +} |
| 33 | + |
| 34 | +define 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) nocapture nofree noundef writeonly align 4294967296 null) #[[ATTR4]] |
| 38 | +; CHECK-NEXT: ret void |
| 39 | +; |
| 40 | + call void @store_as1(ptr addrspace(1) null) |
| 41 | + ret void |
| 42 | +} |
| 43 | + |
| 44 | +define void @store_as1(ptr addrspace(1) %arg) { |
| 45 | +; CHECK-LABEL: define void @store_as1( |
| 46 | +; CHECK-SAME: ptr addrspace(1) nocapture nofree noundef writeonly align 2 dereferenceable_or_null(2) [[ARG:%.*]]) #[[ATTR2]] { |
| 47 | +; CHECK-NEXT: store i16 0, ptr addrspace(1) [[ARG]], align 2 |
| 48 | +; CHECK-NEXT: ret void |
| 49 | +; |
| 50 | + store i16 0, ptr addrspace(1) %arg, align 2 |
| 51 | + ret void |
| 52 | +} |
| 53 | + |
| 54 | +attributes #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 | +;. |
0 commit comments