[llvm] r340453 - [AST] Add a test for attribute intersection
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 22 14:10:57 PDT 2018
Author: reames
Date: Wed Aug 22 14:10:56 2018
New Revision: 340453
URL: http://llvm.org/viewvc/llvm-project?rev=340453&view=rev
Log:
[AST] Add a test for attribute intersection
Already works, but I initially convinced myself it doesn't, so add a test which shows it does. :)
Modified:
llvm/trunk/test/Analysis/AliasSet/argmemonly.ll
Modified: llvm/trunk/test/Analysis/AliasSet/argmemonly.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/AliasSet/argmemonly.ll?rev=340453&r1=340452&r2=340453&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/AliasSet/argmemonly.ll (original)
+++ llvm/trunk/test/Analysis/AliasSet/argmemonly.ll Wed Aug 22 14:10:56 2018
@@ -123,3 +123,21 @@ entry:
declare void @my_memset(i8* nocapture writeonly, i8, i64) argmemonly
declare void @my_memcpy(i8* nocapture writeonly, i8* nocapture readonly, i64) argmemonly
declare void @my_memmove(i8* nocapture, i8* nocapture readonly, i64) argmemonly
+
+
+; CHECK: Alias sets for function 'test_attribute_intersect':
+; CHECK-NEXT: Alias Set Tracker: 2 alias sets for 1 pointer values.
+; CHECK-NEXT: AliasSet[0x{{[0-9a-f]+}}, 1] may alias, Mod/Ref
+; CHECK-NEXT: 1 Unknown instructions: call void @attribute_intersect(i8* %a)
+; CHECK-NEXT: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Ref Pointers: (i8* %a, 1)
+define i8 @test_attribute_intersect(i8* noalias %a) {
+entry:
+ ;; This call is effectively readnone since the argument is readonly
+ ;; and the function is declared writeonly.
+ call void @attribute_intersect(i8* %a)
+ %val = load i8, i8* %a
+ ret i8 %val
+}
+
+declare void @attribute_intersect(i8* readonly) argmemonly writeonly
+
More information about the llvm-commits
mailing list