brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 2b197d6 Raw
96 lines · plain
1; RUN: opt < %s -passes=aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s2 3@c = constant [8 x i32] zeroinitializer4 5declare void @dummy()6 7declare void @foo(ptr)8 9; CHECK-LABEL: Function: basic10; CHECK: NoModRef: Ptr: i32* @c	<->  call void @dummy()11define void @basic(ptr %p) {12  call void @dummy()13  load i32, ptr @c14  ret void15}16 17; CHECK-LABEL: Function: recphi18; CHECK: NoModRef: Ptr: i32* %p	<->  call void @dummy()19define void @recphi() {20entry:21  br label %loop22 23loop:24  %p = phi ptr [ @c, %entry ], [ %p.next, %loop ]25  call void @dummy()26  load i32, ptr %p27  %p.next = getelementptr i32, ptr %p, i64 128  %c = icmp ne ptr %p.next, getelementptr (i32, ptr @c, i64 8)29  br i1 %c, label %loop, label %exit30 31exit:32  ret void33}34 35; Tests that readonly noalias implies !Mod.36;37; CHECK-LABEL: Function: readonly_noalias38; 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 %p42    ret void43}44 45; Tests that readnone noalias implies !Mod.46;47; CHECK-LABEL: Function: readnone_noalias48; 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 %p52    ret void53}54 55; Tests that writeonly noalias doesn't imply !Ref (since it's still possible56; to read from the object through other pointers if the pointer wasn't57; written).58;59; CHECK-LABEL: Function: writeonly_noalias60; 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 %p64    ret void65}66 67; Tests that readonly doesn't imply !Mod without noalias.68;69; CHECK-LABEL: Function: just_readonly70; 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 %p74    ret void75}76 77; Tests that readnone doesn't imply !Mod without noalias.78;79; CHECK-LABEL: Function: just_readnone80; 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 %p84    ret void85}86 87; Tests that writeonly doesn't imply !Ref.88;89; CHECK-LABEL: Function: just_writeonly90; 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 %p94    ret void95}96