llvm.org GIT mirror llvm / 5b6459c
[AliasAnalysis] Take into account readnone attribute for the function arguments Differential Revision: http://reviews.llvm.org/D13992 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251535 91177308-0d34-0410-b5e6-96231b3b80d8 Igor Laevsky 4 years ago
2 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
618618 if (CS.paramHasAttr(ArgIdx + 1, Attribute::ReadOnly))
619619 return MRI_Ref;
620620
621 if (CS.paramHasAttr(ArgIdx + 1, Attribute::ReadNone))
622 return MRI_NoModRef;
623
621624 return AAResultBase::getArgModRefInfo(CS, ArgIdx);
622625 }
623626
215215 ; CHECK: ret i32 %Diff
216216 }
217217
218 ; CHECK-LABEL: @test13(
219 define i32 @test13(i32* %P, i32* %P2) {
220 %V1 = load i32, i32* %P
221 call i32 @func_argmemonly(i32* readnone %P2)
222 %V2 = load i32, i32* %P
223 %Diff = sub i32 %V1, %V2
224 ret i32 %Diff
225 ; CHECK-NOT: load
226 ; CHECK: ret i32 0
227 }
228
218229 declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
219230 declare void @llvm.memset.p0i8.i8(i8* nocapture, i8, i8, i32, i1) nounwind
220231 declare void @llvm.memcpy.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i32, i1) nounwind