1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Linker
Duncan P. N. Exon Smith 6a8d2b6215 IR: Drop uniquing when an MDNode Value operand is deleted
This is a fix for PR28697.

An MDNode can indirectly refer to a GlobalValue, through a
ConstantAsMetadata.  When the GlobalValue is deleted, the MDNode operand
is reset to `nullptr`.  If the node is uniqued, this can lead to a
hard-to-detect cache invalidation in a Metadata map that's shared across
an LLVMContext.

Consider:

 1. A map from Metadata* to `T` called RemappedMDs.
 2. A node that references a global variable, `!{i1* @GV}`.
 3. Insert `!{i1* @GV} -> SomeT` in the map.
 4. Delete `@GV`, leaving behind `!{null} -> SomeT`.

Looking up the generic and uninteresting `!{null}` gives you `SomeT`,
which is likely related to `@GV`.  Worse, `SomeT`'s lifetime may be tied
to the deleted `@GV`.

This occurs in practice in the shared ValueMap used since r266579 in the
IRMover.  Other code that handles more than one Module (with different
lifetimes) in the same LLVMContext could hit it too.

The fix here is a partial revert of r225223: in the rare case that an
MDNode operand is a ConstantAsMetadata (i.e., wrapping a node from the
Value hierarchy), drop uniquing if it gets replaced with `nullptr`.
This changes step #4 above to leave behind `distinct !{null} -> SomeT`,
which can't be confused with the generic `!{null}`.

In theory, this can cause some churn in the LLVMContext's MDNode
uniquing map when Values are being deleted.  However:

  - The number of GlobalValues referenced from uniqued MDNodes is
    expected to be quite small.  E.g., the debug info metadata schema
    only references GlobalValues from distinct nodes.

  - Other Constants have the lifetime of the LLVMContext, whose teardown
    is careful to drop references before deleting the constants.

As a result, I don't expect a compile time regression from this change.

llvm-svn: 277625
2016-08-03 18:19:43 +00:00
..
Inputs IR: Drop uniquing when an MDNode Value operand is deleted 2016-08-03 18:19:43 +00:00
2002-07-17-GlobalFail.ll
2002-07-17-LinkTest2.ll
2002-08-20-ConstantExpr.ll
2003-01-30-LinkerRename.ll Have a single way for creating unique value names. 2015-11-22 00:16:24 +00:00
2003-01-30-LinkerTypeRename.ll
2003-04-23-LinkOnceLost.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00
2003-04-26-NullPtrLinkProblem.ll
2003-05-15-TypeProblem.ll
2003-05-31-LinkerRename.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00
2003-06-02-TypeResolveProblem2.ll
2003-06-02-TypeResolveProblem.ll
2003-08-20-OpaqueTypeResolve.ll
2003-08-23-GlobalVarLinking.ll
2003-08-23-RecursiveOpaqueTypeResolve.ll
2003-08-24-InheritPtrSize.ll
2003-08-28-TypeResolvesGlobal2.ll
2003-08-28-TypeResolvesGlobal3.ll Make "@name =" mandatory for globals in .ll files. 2016-05-10 18:22:45 +00:00
2003-08-28-TypeResolvesGlobal.ll
2003-10-27-LinkOncePromote.ll
2003-11-18-TypeResolution.ll
2004-02-17-WeakStrongLinkage.ll
2004-05-07-TypeResolution1.ll
2004-05-07-TypeResolution2.ll
2004-12-03-DisagreeingType.ll
2005-02-12-ConstantGlobals-2.ll
2005-02-12-ConstantGlobals.ll
2005-12-06-AppendingZeroLengthArrays.ll
2006-01-19-ConstantPacked.ll
2008-03-05-AliasReference2.ll
2008-03-05-AliasReference.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
2008-03-07-DroppedSection_a.ll
2008-03-07-DroppedSection_b.ll
2008-06-13-LinkOnceRedefinition.ll
2008-06-26-AddressSpace.ll
2008-07-06-AliasFnDecl2.ll
2008-07-06-AliasFnDecl.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
2008-07-06-AliasWeakDest2.ll
2008-07-06-AliasWeakDest.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
2009-09-03-mdnode2.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2009-09-03-mdnode.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2011-08-04-DebugLoc2.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2011-08-04-DebugLoc.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2011-08-04-Metadata2.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2011-08-04-Metadata.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2011-08-18-unique-class-type2.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2011-08-18-unique-class-type.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2011-08-18-unique-debug-type2.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
2011-08-18-unique-debug-type.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
alias-2.ll Fix PR26152. 2016-01-20 22:05:50 +00:00
alias-3.ll IRLinker: fix double scheduling of mapping a global value because of an alias 2016-05-25 21:00:44 +00:00
alias.ll Slit lib/Linker in two. 2015-12-10 14:19:35 +00:00
alignment.ll
AppendingLinkage2.ll
AppendingLinkage.ll
apple-version.ll
available_externally_a.ll
available_externally_b.ll
available_externally_over_decl.ll Fix another case where the linkage was not set. 2015-12-10 18:44:26 +00:00
basiclink.ll
broken.ll Don't verify inputs to the Linker if ODR merging. 2016-06-29 18:31:48 +00:00
comdat2.ll
comdat4.ll
comdat5.ll
comdat6.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
comdat7.ll
comdat8.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
comdat9.ll Fix lazy linking of comdat members. 2016-03-24 00:06:03 +00:00
comdat10.ll
comdat11.ll Bring r254336 back: 2015-12-01 15:19:48 +00:00
comdat12.ll Bring r254336 back: 2015-12-01 15:19:48 +00:00
comdat13.ll Bring r254336 back: 2015-12-01 15:19:48 +00:00
comdat14.ll ModuleLinker: Do not import linkonce/weak as "external_weak" 2016-04-19 16:11:05 +00:00
comdat15.ll Also copy private linkage globals when needed. 2015-12-02 20:57:33 +00:00
comdat16.ll Fix logic for which symbols to keep with comdats. 2016-03-23 21:16:33 +00:00
comdat_group.ll Pass .ll directly to llvm-link 2015-11-27 23:21:45 +00:00
comdat-rm-dst.ll Drop comdats from the dst module if they are not selected. 2016-03-22 21:35:47 +00:00
comdat.ll
ConstantGlobals.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00
constructor-comdat.ll Fix logic for which symbols to keep with comdats. 2016-03-23 21:16:33 +00:00
ctors2.ll Correctly handle llvm.global_ctors merging. 2015-11-29 03:29:42 +00:00
ctors3.ll Fix another llvm.ctors merging bug. 2015-11-30 18:54:24 +00:00
ctors4.ll Add an interesting case we already get right. 2015-12-02 15:02:43 +00:00
ctors5.ll Change how the linker handles the old llvm.global_ctors. 2015-12-07 13:24:23 +00:00
ctors.ll Avoid writing to source directory of tests 2015-11-30 20:36:23 +00:00
datalayout.ll
DbgDeclare2.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
DbgDeclare.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
debug-info-version-a.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
debug-info-version-b.ll DI: Disallow uniquable DICompileUnits 2015-08-03 17:26:41 +00:00
dicompositetype-unique.ll IR: Enable debug info type ODR uniquing for forward decls 2016-04-19 18:00:19 +00:00
distinct-cycles.ll
distinct.ll Restore "Move metadata linking after lazy global materialization/linking." 2015-11-06 17:50:53 +00:00
dllstorage-a.ll
dllstorage-b.ll
drop-debug.ll Use diagnostic handler in the LLVMContext 2015-12-14 23:17:03 +00:00
func-attrs-a.ll
func-attrs-b.ll
funcimport2.ll ThinLTO/ModuleLinker: add a flag to not always pull-in linkonce when performing importing 2016-04-21 01:59:39 +00:00
funcimport_appending_global.ll Move summary creation out of llvm-as into opt 2016-04-12 21:35:18 +00:00
funcimport_comdat.ll Move summary creation out of llvm-as into opt 2016-04-12 21:35:18 +00:00
funcimport.ll ThinLTO: never promote as external weak 2016-04-20 04:18:11 +00:00
global_ctors.ll Simplify test. NFC. 2015-12-01 15:46:46 +00:00
ident.ll
inlineasm.ll
internalize-lazy.ll Add a test showing that we internalize lazily linked GVs. 2015-12-08 02:38:14 +00:00
link-flags.ll Simplify test. NFC. 2015-12-08 02:29:45 +00:00
link-global-to-func.ll
link-type-names.ll
linkage2.ll
linkage.ll
linkmdnode2.ll
linkmdnode.ll
linknamedmdnode2.ll
linknamedmdnode.ll
LinkOnce.ll
lto-attributes.ll
mdlocation.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
metadata-a.ll
metadata-attach.ll Linker: Copy metadata when linking declarations. 2016-06-24 17:42:21 +00:00
metadata-b.ll
metadata-function.ll
metadata-with-global-value-operand.ll IR: Drop uniquing when an MDNode Value operand is deleted 2016-08-03 18:19:43 +00:00
module-flags-1-a.ll
module-flags-1-b.ll
module-flags-2-a.ll
module-flags-2-b.ll
module-flags-3-a.ll
module-flags-3-b.ll
module-flags-4-a.ll Linker: teach the IR mover to return llvm::Error. 2016-05-27 05:21:35 +00:00
module-flags-4-b.ll Linker: teach the IR mover to return llvm::Error. 2016-05-27 05:21:35 +00:00
module-flags-5-a.ll
module-flags-5-b.ll
module-flags-6-a.ll
module-flags-6-b.ll
module-flags-7-a.ll
module-flags-7-b.ll
module-flags-8-a.ll
module-flags-8-b.ll
module-flags-dont-change-others.ll
module-flags-pic-1-a.ll
module-flags-pic-2-a.ll
multiple-merged-structs.ll
null_mapping_constant.ll ValueMapper: fix assertion when null-mapping a constant for linking metadata 2016-05-28 17:26:03 +00:00
odr.ll Don't verify inputs to the Linker if ODR merging. 2016-06-29 18:31:48 +00:00
only-needed-debug-metadata.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
only-needed-named-metadata.ll Revert obsolete llvm-link -preserve-modules option/test 2016-01-21 14:28:52 +00:00
only-needed-recurse.ll Fix recursive -only-needed. 2016-04-21 14:56:33 +00:00
opaque.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00
override-different-linkage.ll
override-with-internal-linkage-2.ll
override-with-internal-linkage.ll Have a single way for creating unique value names. 2015-11-22 00:16:24 +00:00
override.ll
partial-type-refinement-link.ll
partial-type-refinement.ll
pr21374.ll
pr21494.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
pr22807.ll
pr26037.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
pr27044.ll Fix another case where we were unconditionally linking linkonce GVs. 2016-03-24 15:23:01 +00:00
PR8300.ll
prologuedata.ll Make this test less strict. 2015-11-29 14:53:06 +00:00
redefinition.ll
replaced-function-matches-first-subprogram.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
subprogram-linkonce-weak.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
targettriple.ll
testlink.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00
thinlto_funcimport_debug.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
transitive-lazy-link.ll
type-unique-alias.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
type-unique-dst-types.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00
type-unique-inheritance.ll
type-unique-name.ll
type-unique-odr-a.ll DebugInfo: Remove MDString-based type references 2016-04-23 21:08:00 +00:00
type-unique-odr-b.ll DebugInfo: Remove MDString-based type references 2016-04-23 21:08:00 +00:00
type-unique-opaque.ll
type-unique-simple2-a.ll DebugInfo: Remove MDString-based type references 2016-04-23 21:08:00 +00:00
type-unique-simple2-b.ll DebugInfo: Remove MDString-based type references 2016-04-23 21:08:00 +00:00
type-unique-simple2.ll Make the default triple optional by allowing an empty string 2015-09-16 05:34:32 +00:00
type-unique-simple-a.ll DebugInfo: Remove MDString-based type references 2016-04-23 21:08:00 +00:00
type-unique-simple-b.ll DebugInfo: Remove MDString-based type references 2016-04-23 21:08:00 +00:00
type-unique-src-type.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00
type-unique-type-array-a.ll DebugInfo: Remove MDString-based type references 2016-04-23 21:08:00 +00:00
type-unique-type-array-b.ll DebugInfo: Remove MDString-based type references 2016-04-23 21:08:00 +00:00
type-unique-unrelated.ll
unique-fwd-decl-a.ll
unique-fwd-decl-order.ll
uniqued-distinct-cycles.ll Linker: Fix references to uniqued nodes after r243883 2015-08-04 06:42:31 +00:00
unnamed-addr1-a.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00
unnamed-addr1-b.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
unnamed-addr-err-a.ll
unnamed-addr-err-b.ll
visibility.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
weakextern.ll Link declaration lazily. 2015-12-07 16:31:41 +00:00