[PATCH] D42364: [IR] Fix creating mutable versions of TBAA access tags

Ivan Kosarev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 02:39:37 PST 2018


kosarev created this revision.
kosarev added a reviewer: hfinkel.

Due to a typo in https://reviews.llvm.org/D41565, mutable TBAA tags created with createMutableTBAAAccessTag() lose their base types. This patch fixes that typo and updates tests respectively.


Repository:
  rL LLVM

https://reviews.llvm.org/D42364

Files:
  lib/IR/MDBuilder.cpp
  test/Transforms/RewriteStatepointsForGC/deref-pointers.ll


Index: test/Transforms/RewriteStatepointsForGC/deref-pointers.ll
===================================================================
--- test/Transforms/RewriteStatepointsForGC/deref-pointers.ll
+++ test/Transforms/RewriteStatepointsForGC/deref-pointers.ll
@@ -74,7 +74,7 @@
 ; 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
+  %tmp = load i8, i8 addrspace(1)* %ptr, !tbaa !4
   call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
   ret i8 %tmp
 }
@@ -108,15 +108,19 @@
   ret i8 addrspace(1)* %ptr
 }
 
-!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"}
+!0 = !{!1, !2, i64 0, i64 1}  ; TAG_old
+!1 = !{!"type_base_old", !2, i64 0}
+!2 = !{!"type_access_old", !3}
+!3 = !{!"root"}
+
+!4 = !{!5, !6, i64 0, i64 1, i64 1}  ; TAG_new
+!5 = !{!3, i64 1, !"type_base_new", !6, i64 0, i64 1}
+!6 = !{!3, i64 1, !"type_access_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}
+; CHECK-DAG: [[TYPE_access_old:!.*]] = !{!"type_access_old", [[ROOT]]}
+; CHECK-DAG: [[TYPE_base_old:!.*]] = !{!"type_base_old", [[TYPE_access_old]], i64 0}
+; CHECK-DAG: [[TAG_old]] = !{[[TYPE_base_old]], [[TYPE_access_old]], i64 0}
+; CHECK-DAG: [[TYPE_access_new:!.*]] = !{[[ROOT]], i64 1, !"type_access_new"}
+; CHECK-DAG: [[TYPE_base_new:!.*]] = !{[[ROOT]], i64 1, !"type_base_new", [[TYPE_access_new]], i64 0, i64 1}
+; CHECK-DAG: [[TAG_new]] = !{[[TYPE_base_new]], [[TYPE_access_new]], i64 0, i64 1}
Index: lib/IR/MDBuilder.cpp
===================================================================
--- lib/IR/MDBuilder.cpp
+++ lib/IR/MDBuilder.cpp
@@ -233,7 +233,7 @@
 }
 
 MDNode *MDBuilder::createMutableTBAAAccessTag(MDNode *Tag) {
-  MDNode *BaseType = cast<MDNode>(Tag->getOperand(1));
+  MDNode *BaseType = cast<MDNode>(Tag->getOperand(0));
   MDNode *AccessType = cast<MDNode>(Tag->getOperand(1));
   Metadata *OffsetNode = Tag->getOperand(2);
   uint64_t Offset = mdconst::extract<ConstantInt>(OffsetNode)->getZExtValue();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42364.130857.patch
Type: text/x-patch
Size: 2403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180122/2939a83c/attachment.bin>


More information about the llvm-commits mailing list