45 lines · plain
1; RUN: opt < %s -passes=lint -disable-output 2>&1 | FileCheck %s2 3%s = type { i8 }4 5; Function Attrs: argmemonly nounwind6declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1) #07 8; Function Attrs: argmemonly nounwind9declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1) #010 11declare void @f1(ptr noalias nocapture sret(%s), ptr nocapture)12 13define void @f2() {14entry:15 %c = alloca %s16 %tmp = alloca %s17 call void @llvm.memset.p0.i32(ptr %c, i8 0, i32 1, i1 false)18 call void @f1(ptr sret(%s) %c, ptr %c)19 ret void20}21 22; Lint should complain about us passing %c to both arguments since one of them23; is noalias.24; CHECK: Unusual: noalias argument aliases another argument25; CHECK-NEXT: call void @f1(ptr sret(%s) %c, ptr %c)26 27declare void @f3(ptr noalias nocapture sret(%s), ptr byval(%s) nocapture readnone)28 29define void @f4() {30entry:31 %c = alloca %s32 %tmp = alloca %s33 call void @llvm.memset.p0.i32(ptr %c, i8 0, i32 1, i1 false)34 call void @f3(ptr sret(%s) %c, ptr byval(%s) %c)35 ret void36}37 38; Lint should not complain about passing %c to both arguments even if one is39; noalias, since the other one is byval, effectively copying the data to the40; stack instead of passing the pointer itself.41; CHECK-NOT: Unusual: noalias argument aliases another argument42; CHECK-NOT: call void @f3(ptr sret(%s) %c, ptr byval(%s) %c)43 44attributes #0 = { argmemonly nounwind }45