[Transforms] Support making mutable versions of new-format TBAA access tags
Differential Revision: https://reviews.llvm.org/D41565
llvm-svn: 322650
diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll b/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll
index d08da73..69dbf6f 100644
--- a/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll
+++ b/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll
@@ -62,13 +62,23 @@
define i8 @test_md(i8 addrspace(1)* %ptr) gc "statepoint-example" {
; CHECK-LABEL: @test_md(
-; CHECK: %tmp = load i8, i8 addrspace(1)* %ptr, !tbaa !0
+; CHECK: %tmp = load i8, i8 addrspace(1)* %ptr, !tbaa [[TAG_old:!.*]]
entry:
%tmp = load i8, i8 addrspace(1)* %ptr, !tbaa !0
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
ret i8 %tmp
}
+; Same as test_md() above, but with new-format TBAA metadata.
+define i8 @test_md_new(i8 addrspace(1)* %ptr) gc "statepoint-example" {
+; CHECK-LABEL: @test_md_new(
+; CHECK: %tmp = load i8, i8 addrspace(1)* %ptr, !tbaa [[TAG_new:!.*]]
+entry:
+ %tmp = load i8, i8 addrspace(1)* %ptr, !tbaa !3
+ call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
+ ret i8 %tmp
+}
+
define i8 addrspace(1)* @test_decl_only_attribute(i8 addrspace(1)* %ptr) gc "statepoint-example" {
; CHECK-LABEL: @test_decl_only_attribute(
; No change here, but the prototype of some_function_ret_deref should have changed.
@@ -92,14 +102,21 @@
define i8 addrspace(1)* @test_callsite_arg_attribute(i8 addrspace(1)* %ptr) gc "statepoint-example" {
; CHECK-LABEL: @test_callsite_arg_attribute(
; CHECK: call void @some_function_consumer(i8 addrspace(1)* %ptr)
-; CHECK: !0 = !{!1, !1, i64 0}
-; CHECK: !1 = !{!"red", !2}
-; CHECK: !2 = !{!"blue"}
entry:
call void @some_function_consumer(i8 addrspace(1)* dereferenceable(4) noalias %ptr)
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
ret i8 addrspace(1)* %ptr
}
-!0 = !{!1, !1, i64 0, i64 1}
-!1 = !{!"red", !2}
-!2 = !{!"blue"}
+
+!0 = !{!1, !1, i64 0, i64 1} ; TAG_old
+!1 = !{!"type_old", !2}
+!2 = !{!"root"}
+
+!3 = !{!4, !4, i64 0, i64 1, i64 1} ; TAG_new
+!4 = !{!2, i64 1, !"type_new"}
+
+; CHECK-DAG: [[ROOT:!.*]] = !{!"root"}
+; CHECK-DAG: [[TYPE_old:!.*]] = !{!"type_old", [[ROOT]]}
+; CHECK-DAG: [[TAG_old]] = !{[[TYPE_old]], [[TYPE_old]], i64 0}
+; CHECK-DAG: [[TYPE_new:!.*]] = !{[[ROOT]], i64 1, !"type_new"}
+; CHECK-DAG: [[TAG_new]] = !{[[TYPE_new]], [[TYPE_new]], i64 0, i64 1}