diff options
| author | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2018-02-13 14:44:25 +0000 |
|---|---|---|
| committer | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2018-02-13 14:44:25 +0000 |
| commit | 4a381b444e671be33a57280b4d13a77ef8f760a6 (patch) | |
| tree | 97b44c5e5ae300fda2d5f3881a0150a4df377f29 | |
| parent | 348b48ac6be106cf8045f59dfd09a6e97bd20e7b (diff) | |
| download | bcm5719-llvm-4a381b444e671be33a57280b4d13a77ef8f760a6.tar.gz bcm5719-llvm-4a381b444e671be33a57280b4d13a77ef8f760a6.zip | |
[IR] Fix creating mutable versions of TBAA access tags
Due to a typo in D41565, mutable TBAA tags created with
createMutableTBAAAccessTag() lose their base types. This patch
fixes that typo and updates tests respectively.
Differential Revision: https://reviews.llvm.org/D42364
llvm-svn: 325008
| -rw-r--r-- | llvm/lib/IR/MDBuilder.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll | 24 |
2 files changed, 15 insertions, 11 deletions
diff --git a/llvm/lib/IR/MDBuilder.cpp b/llvm/lib/IR/MDBuilder.cpp index c32a989ef2c..a2bba4c3a10 100644 --- a/llvm/lib/IR/MDBuilder.cpp +++ b/llvm/lib/IR/MDBuilder.cpp @@ -233,7 +233,7 @@ MDNode *MDBuilder::createTBAAAccessTag(MDNode *BaseType, MDNode *AccessType, } 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(); diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll b/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll index 69dbf6f0af6..2b27172b5b5 100644 --- a/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll @@ -74,7 +74,7 @@ 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 + %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 @@ entry: ret i8 addrspace(1)* %ptr } -!0 = !{!1, !1, i64 0, i64 1} ; TAG_old -!1 = !{!"type_old", !2} -!2 = !{!"root"} +!0 = !{!1, !2, i64 0, i64 1} ; TAG_old +!1 = !{!"type_base_old", !2, i64 0} +!2 = !{!"type_access_old", !3} +!3 = !{!"root"} -!3 = !{!4, !4, i64 0, i64 1, i64 1} ; TAG_new -!4 = !{!2, i64 1, !"type_new"} +!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} |

