llvm-project/llvm/lib/Transforms/Utils
Duncan P. N. Exon Smith 01701646d5 Transforms: Clone distinct nodes in metadata mapper unless RF_ReuseAndMutateDistinctMDs
This is a follow up to 22a52dfddc and a
revert of df763188c9.

With this change, we only skip cloning distinct nodes in
MDNodeMapper::mapDistinct if RF_ReuseAndMutateDistinctMDs, dropping the
no-longer-needed local helper `cloneOrBuildODR()`.  Skipping cloning in
other cases is unsound and breaks CloneModule, which is why the textual
IR for PR48841 didn't pass previously. This commit adds the test as:
Transforms/ThinLTOBitcodeWriter/cfi-debug-info-cloned-type-references-global-value.ll

Cloning less often exposed a hole in subprogram cloning in
CloneFunctionInto thanks to df763188c9a1ecb1e7e5c4d4ea53a99fbb755903's
test ThinLTO/X86/Inputs/dicompositetype-unique-alias.ll. If a function
has a subprogram attachment whose scope is a DICompositeType that
shouldn't be cloned, but it has no internal debug info pointing at that
type, that composite type was being cloned. This commit plugs that hole,
calling DebugInfoFinder::processSubprogram from CloneFunctionInto.

As hinted at in 22a52dfddcefad4f275eb8ad1cc0e200074c2d8a's commit
message, I think we need to formalize ownership of metadata a bit more
so that ValueMapper/CloneFunctionInto (and similar functions) can deal
with cloning (or not) metadata in a more generic, less fragile way.

This fixes PR48841.

Differential Revision: https://reviews.llvm.org/D96734
2021-02-24 12:57:52 -08:00
..
AMDGPUEmitPrintf.cpp [NFC][AMDGPU] Reduce include files dependency. 2021-01-07 22:22:05 +03:00
ASanStackFrameLayout.cpp
AddDiscriminators.cpp
AssumeBundleBuilder.cpp reland [InstCombine] convert assumes to operand bundles 2021-02-13 13:03:11 +01:00
BasicBlockUtils.cpp [llvm] Use llvm::is_contained (NFC) 2021-02-14 08:36:20 -08:00
BreakCriticalEdges.cpp BreakCriticalEdges: do not split the critical edge from a CallBr indirect successor 2021-01-15 13:51:47 -08:00
BuildLibCalls.cpp [BuildLibCalls] Add noundef to allocator fns' size 2021-02-23 13:58:03 +09:00
BypassSlowDivision.cpp BypassSlowDivision: Fix dropping debug info 2020-06-18 17:27:19 -04:00
CMakeLists.txt [SampleFDO] Third Try: Refactor SampleProfile.cpp 2021-02-17 15:31:50 -08:00
CallGraphUpdater.cpp [CGSCC][Coroutine][NewPM] Properly support function splitting/outlining 2021-01-06 11:19:15 -08:00
CallPromotionUtils.cpp [llvm] Construct SmallVector with iterator ranges (NFC) 2021-01-20 21:35:52 -08:00
CanonicalizeAliases.cpp
CanonicalizeFreezeInLoops.cpp [ValueTracking] Use assume's noundef operand bundle 2020-10-14 20:16:33 +09:00
CloneFunction.cpp Transforms: Clone distinct nodes in metadata mapper unless RF_ReuseAndMutateDistinctMDs 2021-02-24 12:57:52 -08:00
CloneModule.cpp TransformUtils: Fix metadata handling in CloneModule (and improve CloneFunctionInto) 2021-02-15 11:56:00 -08:00
CodeExtractor.cpp Revert "[AssumptionCache] Avoid dangling llvm.assume calls in the cache" 2021-02-11 12:17:38 -06:00
CodeMoverUtils.cpp [CodeGen, Transforms] Use llvm::any_of (NFC) 2020-12-24 09:08:36 -08:00
CtorUtils.cpp
Debugify.cpp Reland "[Debugify] Make the debugify aware of the original (-g) Debug Info" 2021-02-18 23:29:22 -08:00
DemoteRegToStack.cpp Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI." 2020-07-24 13:02:33 +01:00
EntryExitInstrumenter.cpp [NFC][EntryExitInstrumenter] Mark Dominator Tree as preserved in legacy-PM too 2021-01-29 01:11:33 +03:00
EscapeEnumerator.cpp [ShadowStackGCLowering] Preserve Dominator Tree, if avaliable 2021-01-30 01:14:51 +03:00
Evaluator.cpp [CodeGen, Transforms] Use *Map::lookup (NFC) 2020-12-27 09:57:27 -08:00
FixIrreducible.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-07 09:49:36 -08:00
FlattenCFG.cpp Fix Wdocumentation warnings by only tagging a param id once per doxygen comment block. NFC. 2020-07-01 12:01:19 +01:00
FunctionComparator.cpp Fix use-of-uninitialized-value in rG75f50e15bf8f 2020-11-26 01:39:22 -07:00
FunctionImportUtils.cpp [LTO] Perform DSOLocal propagation in combined index 2021-02-12 22:58:26 -08:00
GlobalStatus.cpp [globalopt] Teach to look through `addrspacecast`. 2020-10-16 08:43:09 -04:00
GuardUtils.cpp [llvm] Construct SmallVector with iterator ranges (NFC) 2021-01-20 21:35:52 -08:00
HelloWorld.cpp [NewPM][HelloWorld] Move HelloWorld to Utils 2021-02-03 12:59:40 -08:00
InjectTLIMappings.cpp [NFC][Analysis] Change struct VecDesc to use ElementCount 2021-02-12 11:07:58 +00:00
InlineFunction.cpp [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of 2021-02-12 09:51:57 -08:00
InstructionNamer.cpp Port -instnamer to NPM 2020-10-22 12:08:36 -07:00
IntegerDivision.cpp
LCSSA.cpp [llvm] Construct SmallVector with iterator ranges (NFC) 2021-01-16 09:40:53 -08:00
LibCallsShrinkWrap.cpp
Local.cpp [Utils] collectBitParts - add truncate() handling 2021-02-24 11:48:34 +00:00
LoopPeel.cpp [LoopPeel] Use llvm.experimental.noalias.scope.decl for duplicating noalias metadata as needed. 2021-02-01 10:01:17 +01:00
LoopRotationUtils.cpp [Utils] Use NoAliasScopeDeclInst in a few more places (NFC) 2021-01-24 16:24:11 +01:00
LoopSimplify.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-07 09:49:36 -08:00
LoopUnroll.cpp [Utils] Use NoAliasScopeDeclInst in a few more places (NFC) 2021-01-24 16:24:11 +01:00
LoopUnrollAndJam.cpp LoopUnrollAndJam] Only allow loops with single exit(ing) blocks 2021-02-05 16:10:53 +00:00
LoopUnrollRuntime.cpp [NFC] Reduce include files dependency and AA header cleanup (part 2). 2020-12-17 14:04:48 +03:00
LoopUtils.cpp [Vectorizers][TTI] remove option to bypass creation of vector reduction intrinsics 2021-02-12 08:13:50 -05:00
LoopVersioning.cpp Revert "[LV] Unconditionally branch from middle to scalar preheader if the scalar loop must execute" 2021-02-05 12:51:03 +01:00
LowerInvoke.cpp [Transforms/Utils] Construct SmallVector with iterator ranges (NFC) 2020-12-29 19:23:23 -08:00
LowerMemIntrinsics.cpp
LowerSwitch.cpp [Transforms] Use llvm::erase_if (NFC) 2020-12-17 19:53:10 -08:00
MatrixUtils.cpp [Matrix] Add TileInfo abstraction for tiled matrix code-gen. 2020-07-20 18:49:08 +01:00
Mem2Reg.cpp
MetaRenamer.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-07 09:49:36 -08:00
ModuleUtils.cpp [LTO] Fix cloning of llvm*.used when splitting module 2021-02-20 09:46:43 -08:00
NameAnonGlobals.cpp
PredicateInfo.cpp Revert "[AssumptionCache] Avoid dangling llvm.assume calls in the cache" 2021-02-11 12:17:38 -06:00
PromoteMemoryToRegister.cpp [STLExtras] Use return type from operator* of the wrapped iter. 2021-01-10 14:41:13 +00:00
SSAUpdater.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-02 22:52:47 -08:00
SSAUpdaterBulk.cpp
SampleProfileLoaderBaseUtil.cpp [SampleFDO] Third Try: Refactor SampleProfile.cpp 2021-02-17 15:31:50 -08:00
SanitizerStats.cpp
ScalarEvolutionExpander.cpp [SCEVExpander] Migrate costAndCollectOperands to use InstructionCost. 2021-02-16 09:27:34 +00:00
SimplifyCFG.cpp [SimplifyCFG] Update passingValueIsAlwaysUndefined to check more attributes 2021-02-24 10:40:50 +09:00
SimplifyIndVar.cpp [SimplifyIndVar] createWideIV - make WideIVInfo arg a const ref. NFCI. 2021-01-05 10:31:45 +00:00
SimplifyLibCalls.cpp Reland "[Libcalls, Attrs] Annotate libcalls with noundef" 2021-02-20 06:18:48 +01:00
SizeOpts.cpp Reland D84057 [PGO][PGSO] Remove a temporary flag used for gradual rollout. 2020-07-22 20:57:25 -07:00
SplitModule.cpp [LTO] Update splitCodeGen to take a reference to the module. (NFC) 2021-01-29 11:53:11 +00:00
StripGCRelocates.cpp Port StripGCRelocates pass to NPM 2020-10-07 14:41:29 -07:00
StripNonLineTableDebugInfo.cpp [NPM] Port strip nonlinetable debuginfo pass to the new pass manager 2020-10-07 14:35:36 -07:00
SymbolRewriter.cpp
UnifyFunctionExitNodes.cpp [NPM] Port -mergereturn to NPM 2020-10-20 10:33:58 -07:00
UnifyLoopExits.cpp Remove unnecessary header include which violates layering 2020-10-20 20:14:03 -07:00
UniqueInternalLinkageNames.cpp Add sample-profile-suffix-elision-policy attribute with -funique-internal-linkage-names. 2021-01-12 15:15:53 -08:00
Utils.cpp [NPM] port -unify-loop-exits to NPM 2020-10-20 10:46:57 -07:00
VNCoercion.cpp [VNCoercion] Disallow coercion between different ni addrspaces 2020-12-07 20:19:48 -05:00
ValueMapper.cpp Transforms: Clone distinct nodes in metadata mapper unless RF_ReuseAndMutateDistinctMDs 2021-02-24 12:57:52 -08:00