1; RUN: opt < %s -passes=aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s 2 3@c = constant [8 x i32] zeroinitializer 4 5declare void @dummy() 6 7declare void @foo(ptr) 8 9; CHECK-LABEL: Function: basic 10; CHECK: NoModRef: Ptr: i32* @c <-> call void @dummy() 11define void @basic(ptr %p) { 12 call void @dummy() 13 load i32, ptr @c 14 ret void 15} 16 17; CHECK-LABEL: Function: recphi 18; CHECK: NoModRef: Ptr: i32* %p <-> call void @dummy() 19define void @recphi() { 20entry: 21 br label %loop 22 23loop: 24 %p = phi ptr [ @c, %entry ], [ %p.next, %loop ] 25 call void @dummy() 26 load i32, ptr %p 27 %p.next = getelementptr i32, ptr %p, i64 1 28 %c = icmp ne ptr %p.next, getelementptr (i32, ptr @c, i64 8) 29 br i1 %c, label %loop, label %exit 30 31exit: 32 ret void 33} 34 35; Tests that readonly noalias implies !Mod. 36; 37; CHECK-LABEL: Function: readonly_noalias 38; CHECK: Just Ref: Ptr: i32* %p <-> call void @foo(ptr %p) 39define void @readonly_noalias(ptr readonly noalias %p) { 40 call void @foo(ptr %p) 41 load i32, ptr %p 42 ret void 43} 44 45; Tests that readnone noalias implies !Mod. 46; 47; CHECK-LABEL: Function: readnone_noalias 48; CHECK: Just Ref: Ptr: i32* %p <-> call void @foo(ptr %p) 49define void @readnone_noalias(ptr readnone noalias %p) { 50 call void @foo(ptr %p) 51 load i32, ptr %p 52 ret void 53} 54 55; Tests that writeonly noalias doesn't imply !Ref (since it's still possible 56; to read from the object through other pointers if the pointer wasn't 57; written). 58; 59; CHECK-LABEL: Function: writeonly_noalias 60; CHECK: Both ModRef: Ptr: i32* %p <-> call void @foo(ptr %p) 61define void @writeonly_noalias(ptr writeonly noalias %p) { 62 call void @foo(ptr %p) 63 load i32, ptr %p 64 ret void 65} 66 67; Tests that readonly doesn't imply !Mod without noalias. 68; 69; CHECK-LABEL: Function: just_readonly 70; CHECK: Both ModRef: Ptr: i32* %p <-> call void @foo(ptr %p) 71define void @just_readonly(ptr readonly %p) { 72 call void @foo(ptr %p) 73 load i32, ptr %p 74 ret void 75} 76 77; Tests that readnone doesn't imply !Mod without noalias. 78; 79; CHECK-LABEL: Function: just_readnone 80; CHECK: Both ModRef: Ptr: i32* %p <-> call void @foo(ptr %p) 81define void @just_readnone(ptr readnone %p) { 82 call void @foo(ptr %p) 83 load i32, ptr %p 84 ret void 85} 86 87; Tests that writeonly doesn't imply !Ref. 88; 89; CHECK-LABEL: Function: just_writeonly 90; CHECK: Both ModRef: Ptr: i32* %p <-> call void @foo(ptr %p) 91define void @just_writeonly(ptr writeonly %p) { 92 call void @foo(ptr %p) 93 load i32, ptr %p 94 ret void 95} 96