Commit Graph

129706 Commits

Author SHA1 Message Date
Matthias Braun
bac1dd9d54 ARM, AArch64, X86: Check preserved registers for tail calls.
We can only perform a tail call to a callee that preserves all the
registers that the caller needs to preserve.

This situation happens with calling conventions like preserver_mostcc or
cxx_fast_tls. It was explicitely handled for fast_tls and failing for
preserve_most. This patch generalizes the check to any calling
convention.

Related to rdar://24207743

Differential Revision: http://reviews.llvm.org/D18680

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265329 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 18:56:13 +00:00
Teresa Johnson
0a41a31987 [ThinLTO] Add option to dump value name to GUID mapping
Summary:
Useful for debugging since we lose this correlation after the permodule
summary/VST is read and until we later materialize source modules in the
function importer.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

Differential Revision: http://reviews.llvm.org/D18555

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265327 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 18:52:58 +00:00
Teresa Johnson
39af64d791 [ThinLTO] Augment FunctionImport dump with value name to GUID map
Summary:
To aid in debugging, dump out the correlation between value names and
GUID for each source module when it is materialized. This will make it
easier to comprehend the earlier summary-based function importing debug
trace which only has access to and prints the GUIDs.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

Differential Revision: http://reviews.llvm.org/D18556

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265326 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 18:52:23 +00:00
Sanjay Patel
3555f1fd3b fix documentation comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 18:25:06 +00:00
Brendon Cahoon
3188534401 [DependenceAnalysis] Check if result of getConstantPart is null
A seg-fault occurs due to a reference of a null pointer, which is
the value returned by getConstantPart. This function returns
null if the constant part is not found. The code that calls this
function needs to check for the null return value.

Differential Revision: http://reviews.llvm.org/D18718


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265319 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 18:13:18 +00:00
Derek Schuff
cfaa4e0890 Replace MachineRegisterInfo::isSSA() with a MachineFunctionProperty
Use the MachineFunctionProperty mechanism to indicate whether a MachineFunction
is in SSA form instead of a custom method on MachineRegisterInfo. NFC

Differential Revision: http://reviews.llvm.org/D18574

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265318 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 18:03:29 +00:00
Wei Mi
e19a68b607 Revert r265309 and r265312 because they caused some errors I need to investigate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265317 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 17:45:03 +00:00
Paul Robinson
0a27f400f2 Document standard substitutions defined by lit.
Patch by Guilherme Bufolo!

Differential Revision: http://reviews.llvm.org/D18752


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265314 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 17:14:45 +00:00
Derek Schuff
9b3da26fa8 Add MachineFunctionProperty checks for AllVRegsAllocated for target passes
Summary:
This adds the same checks that were added in r264593 to all
target-specific passes that run after register allocation.

Reviewers: qcolombet

Subscribers: jyknight, dsanders, llvm-commits

Differential Revision: http://reviews.llvm.org/D18525

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265313 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 17:09:25 +00:00
Wei Mi
ccfc215abd Fix unused var warning caused by r265309.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 17:03:58 +00:00
Wei Mi
d31cb9b5c5 Replace analyzeSiblingValues with new algorithm to fix its compile
time issue. The patch is to solve PR17409 and its duplicates.

analyzeSiblingValues is a N x N complexity algorithm where N is
the number of siblings generated by reg splitting. Although it
causes siginificant compile time issue when N is large, it is also
important for performance since it removes redundent spills and
enables rematerialization.

To solve the compile time issue, the patch removes analyzeSiblingValues
and replaces it with lower cost alternatives containing two parts. The
first part creates a new spill hoisting method in postOptimization of
register allocation. It does spill hoisting at once after all the spills
are generated instead of inside every instance of selectOrSplit. The
second part queries the define expr of the original register for
rematerializaiton and keep it always available during register allocation
even if it is already dead. It deletes those dead instructions only in
postOptimization. With the two parts in the patch, it can remove
analyzeSiblingValues without sacrificing performance.

Differential Revision: http://reviews.llvm.org/D15302



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 16:42:40 +00:00
Daniel Sanders
3b14df5ae4 [mips] Range check simm32 and fold MIPS16's imm32 into simm32.
Summary:
At this point we should be able to enable IAS by default for O32 without
breaking check-all, or recursion.

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

Differential Revision: http://reviews.llvm.org/D18439

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265302 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 15:32:49 +00:00
Ulrich Weigand
f000d191b0 [SystemZ] Add compare-and-branch instructions to MC
This adds MC support for fused compare + indirect branch instructions,
ie. CRB, CGRB, CLRB, CLGRB, CIB, CGIB, CLIB, CLGIB. They aren't actually
generated yet -- this is preparation for their use for conditional
returns in the next iteration of D17339.

Author: koriakin
Differential Revision: http://reviews.llvm.org/D18742



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 14:26:43 +00:00
Ulrich Weigand
3b8a73e9fe [SystemZ] Support ATOMIC_FENCE
A cross-thread sequentially consistent fence should be lowered into
z/Architecture's BCR serialization instruction, instead of causing a
fatal error in the back-end.

Author: bryanpkc
Differential Revision: http://reviews.llvm.org/D18644



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265292 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 12:45:44 +00:00
Ulrich Weigand
972bf9c2c3 [SystemZ] Support llvm.frameaddress/llvm.returnaddress intrinsics
Enable the SystemZ back-end to lower FRAMEADDR and RETURNADDR, which
previously would cause the back-end to crash.  Currently, only a
frame count of zero is supported.

Author: bryanpkc
Differential Revision: http://reviews.llvm.org/D18514



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 12:44:55 +00:00
NAKAMURA Takumi
6bb99d27bb Fixup r265277 [-Wdocumentation]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265290 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 11:54:48 +00:00
Elena Demikhovsky
bd28e703b1 AVX-512: Truncating store for i1 vectors
Implemented truncstore for KNL and skylake-avx512.
Covered vectors from v2i1 to v64i1. We save the value in bits (not in bytes) - v32i1 is saved in 4 bytes.

Differential Revision: http://reviews.llvm.org/D18740



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265283 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 07:17:47 +00:00
Duncan P. N. Exon Smith
d6f84f2cf7 ValueMapper: Remove old FIXMEs; almost NFC
Remove a few old FIXMEs from the original commit of the Metadata/Value
split in r223802.  These are commented out assertions to the effect that
calls between mapValue and mapMetadata never return nullptr.

(The only behaviour change is that Mapper::mapSimpleMetadata memoizes
the nullptr return.)

When I originally rewrote the mapping code, I thought we could be
stricter in the new metadata hierarchy and never return nullptr when
RF_NullMapMissingGlobalValues was off.  It's still not entirely clear to
me why these assertions failed (a few months ago, I had a theory that I
forgot to write down, but that's helping no one).

Understood or not, I no longer see how these commented-out assertions
would be useful.  I'm relegating them to the annals of source control
before making significant changes to ValueMapper.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265282 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 04:59:56 +00:00
Davide Italiano
5b62b45206 [DebugInfo] Fix tests in Assembler/
Each DISubprogram with isDefinition : true must
belong to a compile unit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265281 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 02:11:34 +00:00
Duncan P. N. Exon Smith
0568c3d1ac IR: Lazily create ReplaceableMetadataImpl on MDNode
RAUW support on MDNode usually requires an extra allocation for
ReplaceableMetadataImpl.  This is only strictly necessary if there are
tracking references to the MDNode.  Make the construction of
ReplaceableMetadataImpl lazy, so that we don't get allocations if we
don't need them.

Since MDNode::isResolved now checks MDNode::isTemporary and
MDNode::NumUnresolved instead of whether a ReplaceableMetadataImpl is
allocated, the internal changes are intrusive (at various internal
checkpoints, isResolved now has a different answer).

However, there should be no real functionality change here; just
slightly lazier allocation behaviour.  The external semantics should be
identical.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265279 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 21:23:52 +00:00
Duncan P. N. Exon Smith
14009479b5 IR: Make MDNode::Context private, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 21:10:00 +00:00
Amaury Sechet
7527b8c02a Various style fix in Core.h/Core.cpp . NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265277 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 21:06:04 +00:00
Duncan P. N. Exon Smith
23e40368ee ValueMapper: Disallow metadata mapping recursion through mapValue
This adds an assertion to maintain the property from r265273.  When
Mapper::mapSimpleMetadata calls Mapper::mapValue, it should not find its
way back to mapMetadataImpl.  This guarantees that mapSimpleMetadata is
not involved in any recursion.

Since Mapper::mapValue calls out to arbitrary materializers, we need to
save a bit on the ValueMap to make this assertion effective.

There should be no functionality change here.  This co-recursion should
already have been impossible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 20:54:51 +00:00
Duncan P. N. Exon Smith
eb8001aa9a Work around MSVC failure from r265273
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/19726

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 20:42:21 +00:00
Simon Pilgrim
d00e70341d [X86] Removed duplicate code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265274 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 20:40:35 +00:00
Duncan P. N. Exon Smith
47ee3e9a00 ValueMapper: Avoid recursion in mapSimplifiedMetadata, NFC
The main change is to delay materializing GlobalValue initializers from
Mapper::mapValue until Mapper::~Mapper.  This effectively removes all
recursion from mapSimplifiedMetadata, as promised in r265270.
mapSimplifiedMetadata calls mapValue for ConstantAsMetadata nodes to
find the mapped constant, and now it shouldn't be possible for mapValue
to indirectly re-invoke mapMetadata.  I'll add an assertion to that
effect in a follow-up (separated so that the assertion can easily be
reverted independently, if it comes to that).

This a step toward a broader goal: converting Mapper::mapMetadataImpl
from a recursive to an iterative algorithm.

When a BlockAddress points at a BasicBlock inside an unmaterialized
function body, we need to delay it until the function body is
materialized in Mapper::~Mapper.  This commit creates a temporary
BasicBlock and returns a new BlockAddress, then RAUWs the BasicBlock
once it is known.  This situation should be extremely rare since a
BlockAddress is usually used from within the function it's referencing
(and BlockAddress itself is rare).

There should be no observable functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 20:17:45 +00:00
Peter Zotov
7ab7e0efeb [CodeGenPrepare] Fix r265264 (again).
Don't require TLI for SinkCmpExpression, like it wasn't before
r265264.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265271 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 19:32:13 +00:00
Duncan P. N. Exon Smith
9786f33c04 ValueMapper: Split out mapSimpleMetadata, NFC
Split out a helper for mapping metadata without operands.  This is any
metadata that is not an MDNode, and any MDNode where the answer is known
without looking at operands.

Through some weird twists, this function is co-recursive:

    mapSimpleMetadata
    => MapValue
    => materializeInitFor
    => linkFunctionBody
    => RemapInstructions
    => MapMetadata
    => mapSimpleMetadata

I plan to break the recursion in a follow-up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265270 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 19:31:01 +00:00
Duncan P. N. Exon Smith
f92cbb90d3 ValueMapper: Introduce Mapper helper class, NFC
Remove a bunch of boilerplate from ValueMapper.cpp by using a new
file-local class called Mapper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265268 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 19:06:24 +00:00
Simon Pilgrim
8714037727 [X86][SSE] Refreshed MOVMSK sign bit tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265267 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 18:59:42 +00:00
Simon Pilgrim
baf1e7a11a [X86][SSE] Support for MOVMSK signbit extraction instructions
Add support for lowering with the MOVMSK instruction to extract vector element signbits to a GPR.

This is an early step towards more optimal handling of vector comparison results.

Differential Revision: http://reviews.llvm.org/D18741

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 18:22:03 +00:00
Peter Zotov
ad9ddc5a39 [CodeGenPrepare] Fix r265264.
The case where there was no TargetLowering was not handled,
leading to null pointer dereferences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 17:11:53 +00:00
Peter Zotov
6a4952db2d [CodeGenPrepare] Avoid sinking soft-FP comparisons
Sinking comparisons in CGP can undo the job of hoisting them done
earlier by LICM, and soft-FP makes this an expensive mistake.

A common pattern that produces floating point comparisons uniform
over a loop is an explicit check for division by zero. If the divisor
is hoisted out of the loop, the comparison can also be, but hoisting
the function that unwinds is never legal, since it may cause side
effects in the loop body prior to the unwinding to not be executed.

Differential Revision: http://reviews.llvm.org/D18744

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265264 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 16:36:17 +00:00
Simon Pilgrim
118386614b [X86] Tidied up X86ISD instruction nodes. NFCI.
Tidied up comments, stripped trailing whitespace, split apart nodes that aren't related.

No change in ordering although there is definitely some scope for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265263 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 14:14:32 +00:00
Peter Zotov
8e620e76a8 Mark some FP intrinsics as safe to speculatively execute
Floating point intrinsics in LLVM are generally not speculatively
executed, since most of them are defined to behave the same as libm
functions, which set errno.

However, the only error that can happen  when executing ceil, floor,
nearbyint, rint and round libm functions per POSIX.1-2001 is -ERANGE,
and that requires the maximum value of the exponent to be smaller
than  the number of mantissa bits, which is not the case with any of
the floating point types supported by LLVM.

The trunc and copysign functions never set errno per per POSIX.1-2001.

Differential Revision: http://reviews.llvm.org/D18643

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265262 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 12:30:46 +00:00
Elena Demikhovsky
55991dff37 AVX-512: Load and Extended Load for i1 vectors
Implemented load+{sign|zero}_extend for i1 vectors
Fixed failures in i1 vector load.
Covered loading of v2i1, v4i1, v8i1, v16i1, v32i1, v64i1 vectors for KNL and SKX.

Differential Revision: http://reviews.llvm.org/D18737



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265259 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 08:41:12 +00:00
Davide Italiano
4e5a97a04b [SimplifyLibCalls] Garbage collect dead code.
We already skip optimizations if the return value
of printf() is used, so CI->use_empty() is always
true.

Differential Revision:  http://reviews.llvm.org/D18656


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265253 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 01:46:52 +00:00
Jacques Pienaar
5a07bd0af6 [lanai] Fix for LanaiDelaySlotFiller and LanaiMCInstLower.cpp
Summary:
* Fix to stop delay slot filler from inserting SP modifying instructions in the newly expanded call/return instructions.
* In LowerSymbol the outermost type was not LanaiMCExpr if there was a binary expression
* Remove printExpr in LanaiInstPrinter

Subscribers: joker.eph, llvm-commits

Differential Revision: http://reviews.llvm.org/D18734

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 00:49:27 +00:00
Zoran Jovanovic
3d20af9dc6 [mips][microMIPS] Revert commits r264245 and r264248.
Commit r264245 was the reason for failing tests in LLVM test suite.
Commit r264248 depends on the first one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 23:06:13 +00:00
Simon Pilgrim
3021e4235e [X86][SSE] Added 1024-bit vector comparison tests
More examples of PR22603, poor vector splitting for AVX512F targets as well as missing uses of PACKSS/MOVMSK

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265248 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 21:33:09 +00:00
Simon Pilgrim
6bf924bfe8 [X86][AVX512] Added AVX512 comparison tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265247 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 21:24:42 +00:00
Saleem Abdulrasool
3aae1a6760 AArch64: support .cpu directive
Add support for the AArch64 .cpu directive.  This is a slightly involved
directive since the parameter is actually a variable encoded string.  The
general structure is:

  <cpu>[[+-]<feature>]*

We now map some of the supported string names for features for internal
representation of feature flags.  If we encounter one which we do not support,
bail out as we cannot validate the assembly any longer.

Resolves PR27010.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 19:29:52 +00:00
Duncan P. N. Exon Smith
715c242f51 Linker: Split mapUnneededSubprograms into two; almost NFC
Split the loop through compile units in mapUnneededSubprograms in two.
First, visit imported entities to ensure that we've visited all need
subprograms.  Second, visit subprograms, and drop the ones we don't
need.

Hypothetically this protects against a subprogram from one compile unit
being referenced from an imported entity in a different compile unit.  I
don't think that's valid IR (a debug info expert could confirm), but I
think the refactor makes the code more clear.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265233 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 17:54:01 +00:00
Duncan P. N. Exon Smith
75949bd2ce Remove redundant assertion after cast, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265232 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 17:41:52 +00:00
Duncan P. N. Exon Smith
dcf3121094 Linker: Avoid unnecessary work when moving named metadata
IRLinker::mapUnneededSubprograms has to be sure that any "needed"
subprograms get linked in.  Rather than traversing through imported
entities using llvm::getSubprogram, call MapMetadata.  The latter
memoizes the result in the ValueMap (sharing work with
IRLinker::linkNamedMDNodes proper), and makes the local SmallPtrSet
redundant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265231 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 17:39:31 +00:00
Mehdi Amini
1cb85674c6 Rename FunctionIndex into GlobalValueIndex to reflect the recent changes (NFC)
The index used to contain only Function, but now contains GlobalValue
in general.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265230 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 17:29:47 +00:00
Duncan P. N. Exon Smith
f9fa1559e5 Linker: Remove IRMover::isMetadataUnneeded indirection; almost NFC
Instead of checking live during MapMetadata whether a subprogram is
needed, seed the ValueMap with `nullptr` up-front.

There is a small hypothetical functionality change.  Previously, calling
MapMetadataOp on a node whose "scope:" chain led to an unneeded
subprogram would return nullptr.  However, if that were ever called,
then the subprogram would be needed; a situation that the IRMover is
supposed to avoid a priori!

Besides cleaning up the code a little, this restores a nice property:
MapMetadataOp returns the same as MapMetadata.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265229 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 17:12:00 +00:00
Duncan P. N. Exon Smith
eeb2c7e32c ValueMapper: Add support for seeding metadata with nullptr
Support seeding a ValueMap with nullptr for Metadata entries, a
situation I didn't consider in the Metadata/Value split.

I added a ValueMapper::getMappedMD accessor that returns an
Optional<Metadata*> with the mapped (possibly null) metadata.  IRMover
needs to use this to avoid modifying the map when it's checking for
unneeded subprograms.  I updated a call from bugpoint since I find the
new code clearer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265228 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 17:04:38 +00:00
Duncan P. N. Exon Smith
ec78cb05a0 Document end of anonymous namespaces, NFC
Prevent clang-format from deleting the preceding newline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265227 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 16:45:51 +00:00
Duncan P. N. Exon Smith
be4ea76eaa Bitcode: Try to emit metadata in function blocks
Whenever metadata is only referenced by a single function, emit the
metadata just in that function block.  This should improve lazy-loading
by reducing the amount of metadata in the global block.

For now, this should catch all DILocations, and anything else that
happens to be referenced only by a single function.

It's also a first step toward a couple of possible future directions
(which this commit does *not* implement):

 1. Some debug info metadata is only referenced from compile units and
    individual functions.  If we can drop the link from the compile
    unit, this optimization will get more powerful.

 2. Any uniqued metadata that isn't referenced globally can in theory be
    emitted in every function block that references it (trading off
    bitcode size and full-parse time vs. lazy-load time).

Note: this assumes the new BitcodeReader error checking from r265223.
The metadata stored in function blocks gets purged after parsing each
function, which means unresolved forward references will get lost.
Since all the global metadata should have already been resolved by the
time we get to the function metadata blocks we just need to check for
that case.  (If for some reason we need to handle bitcode that fails the
checks in r265223, the fix is to store about-to-be-dropped unresolved
nodes in MetadataList::shrinkTo until they can be handled succesfully by
a future call to MetadataList::tryToResolveCycles.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265226 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 15:22:57 +00:00