From a3708df41a33f484a88feec5a87937db857ec010 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Sat, 30 Aug 2014 12:48:33 +0000 Subject: Fix AddAliasScopeMetadata to not add scopes when deriving from unknown pointers The previous implementation of AddAliasScopeMetadata, which adds noalias metadata to preserve noalias parameter attribute information when inlining had a flaw: it would add alias.scope metadata to accesses which might have been derived from pointers other than noalias function parameters. This was incorrect because even some access known not to alias with all noalias function parameters could easily alias with an access derived from some other pointer. Instead, when deriving from some unknown pointer, we cannot add alias.scope metadata at all. This fixes a miscompile of the test-suite's tramp3d-v4. Furthermore, we cannot add alias.scope to functions unless we know they access only argument-derived pointers (currently, we know this only for memory intrinsics). Also, we fix a theoretical problem with using the NoCapture attribute to skip the capture check. This is incorrect (as explained in the comment added), but would not matter in any code generated by Clang because we get only inferred nocapture attributes in Clang-generated IR. This functionality is not yet enabled by default. llvm-svn: 216818 --- llvm/test/Transforms/Inline/noalias-calls.ll | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/test') diff --git a/llvm/test/Transforms/Inline/noalias-calls.ll b/llvm/test/Transforms/Inline/noalias-calls.ll index df21fc880f7..d2404013d22 100644 --- a/llvm/test/Transforms/Inline/noalias-calls.ll +++ b/llvm/test/Transforms/Inline/noalias-calls.ll @@ -22,8 +22,8 @@ entry: ; CHECK: define void @foo(i8* nocapture %a, i8* nocapture readonly %c, i8* nocapture %b) #1 { ; CHECK: entry: -; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 16, i32 16, i1 false) #0, !alias.scope !0, !noalias !3 -; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %c, i64 16, i32 16, i1 false) #0, !alias.scope !3, !noalias !0 +; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 16, i32 16, i1 false) #0, !noalias !0 +; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %c, i64 16, i32 16, i1 false) #0, !noalias !3 ; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %c, i64 16, i32 16, i1 false) #0, !alias.scope !5 ; CHECK: call void @hey() #0, !noalias !5 ; CHECK: ret void @@ -33,9 +33,9 @@ attributes #0 = { nounwind } attributes #1 = { nounwind uwtable } ; CHECK: !0 = metadata !{metadata !1} -; CHECK: !1 = metadata !{metadata !1, metadata !2, metadata !"hello: %a"} +; CHECK: !1 = metadata !{metadata !1, metadata !2, metadata !"hello: %c"} ; CHECK: !2 = metadata !{metadata !2, metadata !"hello"} ; CHECK: !3 = metadata !{metadata !4} -; CHECK: !4 = metadata !{metadata !4, metadata !2, metadata !"hello: %c"} -; CHECK: !5 = metadata !{metadata !1, metadata !4} +; CHECK: !4 = metadata !{metadata !4, metadata !2, metadata !"hello: %a"} +; CHECK: !5 = metadata !{metadata !4, metadata !1} -- cgit v1.2.3