[PATCH] D96734: Transforms: Clone distinct nodes in metadata mapper unless RF_ReuseAndMutateDistinctMDs
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 15 15:31:05 PST 2021
dexonsmith created this revision.
dexonsmith added reviewers: aprantl, hans, tejohnson.
Herald added subscribers: pengfei, steven_wu, hiraditya.
dexonsmith requested review of this revision.
Herald added a project: LLVM.
This is a follow up to 22a52dfddcefad4f275eb8ad1cc0e200074c2d8a <https://reviews.llvm.org/rG22a52dfddcefad4f275eb8ad1cc0e200074c2d8a> and a
revert of df763188c9a1ecb1e7e5c4d4ea53a99fbb755903.
With this change, we only skip cloning distinct nodes in
MDNodeMapper::mapDistinct if RF_ReuseAndMutateDistinctMDs, gutting the
local helper `cloneOrBuildODR()` and renaming it `cloneDistinct()`.
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.
This fixes PR48841.
Follow-up to: https://reviews.llvm.org/D96531
Revert of: https://reviews.llvm.org/D41669
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D96734
Files:
llvm/include/llvm/IR/DebugInfo.h
llvm/lib/Transforms/Utils/CloneFunction.cpp
llvm/lib/Transforms/Utils/ValueMapper.cpp
llvm/test/Transforms/ThinLTOBitcodeWriter/cfi-debug-info-cloned-type-references-global-value.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96734.323838.patch
Type: text/x-patch
Size: 6288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210215/41e0cf96/attachment.bin>
More information about the llvm-commits
mailing list