[PATCH] D33513: [ThinLTO] Fix ThinLTO crash while destroying context
Charles Saternos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 08:54:25 PDT 2017
ncharlie updated this revision to Diff 100419.
ncharlie added a comment.
Herald added a subscriber: eraman.
fixed tests
https://reviews.llvm.org/D33513
Files:
include/llvm/IR/Metadata.h
test/ThinLTO/X86/Inputs/lazy-load-temporaries-cleanup.a.ll
test/ThinLTO/X86/Inputs/lazy-load-temporaries-cleanup.b.ll
test/ThinLTO/X86/lazy-load-temporaries-cleanup.ll
Index: test/ThinLTO/X86/lazy-load-temporaries-cleanup.ll
===================================================================
--- test/ThinLTO/X86/lazy-load-temporaries-cleanup.ll
+++ test/ThinLTO/X86/lazy-load-temporaries-cleanup.ll
@@ -0,0 +1,5 @@
+; This test ensures that metadata temporaries are properly tracked, then cleaned up
+
+; RUN: opt -module-summary %S/Inputs/lazy-load-temporaries-cleanup.a.ll -o %t.1.o
+; RUN: opt -module-summary %S/Inputs/lazy-load-temporaries-cleanup.b.ll -o %t.2.o
+; RUN: ld.lld %t.1.o %t.2.o
Index: test/ThinLTO/X86/Inputs/lazy-load-temporaries-cleanup.b.ll
===================================================================
--- test/ThinLTO/X86/Inputs/lazy-load-temporaries-cleanup.b.ll
+++ test/ThinLTO/X86/Inputs/lazy-load-temporaries-cleanup.b.ll
@@ -0,0 +1,23 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @patatino() {
+ ret void
+}
+
+!named = !{!0, !2, !4, !6, !8, !10, !12}
+
+!0 = distinct !{!1}
+!1 = !{i8 1}
+!2 = distinct !{!3}
+!3 = !{i8 2}
+!4 = distinct !{!5}
+!5 = !{i8 3}
+!6 = distinct !{!7}
+!7 = !{i8 4, i8 5}
+!8 = distinct !{!9}
+!9 = !{i8 6, i8 7}
+!10 = distinct !{!11}
+!11 = !{i8 8, i8 9}
+!12 = distinct !{!13, i8 0}
+!13 = !{i8 10, i8 11}
Index: test/ThinLTO/X86/Inputs/lazy-load-temporaries-cleanup.a.ll
===================================================================
--- test/ThinLTO/X86/Inputs/lazy-load-temporaries-cleanup.a.ll
+++ test/ThinLTO/X86/Inputs/lazy-load-temporaries-cleanup.a.ll
@@ -0,0 +1,9 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @tinkywinky() {
+ tail call void @patatino()
+ ret void
+}
+
+declare void @patatino()
Index: include/llvm/IR/Metadata.h
===================================================================
--- include/llvm/IR/Metadata.h
+++ include/llvm/IR/Metadata.h
@@ -1277,6 +1277,8 @@
if (!Use)
return;
*Use = MD;
+ if(*Use)
+ MetadataTracking::track(*Use);
Use = nullptr;
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33513.100419.patch
Type: text/x-patch
Size: 2105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/22fb984c/attachment.bin>
More information about the llvm-commits
mailing list