Commit Graph

32403 Commits

Author SHA1 Message Date
Charles Saternos
4c314d6d30 [ThinLTO] Add FunctionAttrs to ThinLTO index
Adds function attributes to index: ReadNone, ReadOnly, NoRecurse, NoAlias. This attributes will be used for future ThinLTO optimizations that will propagate function attributes across modules.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 16:00:58 +00:00
Nikolai Bozhenov
406ae0691e [InstCombine] Canonicalize clamp of float types to minmax in fast mode.
Summary:
This commit allows matchSelectPattern to recognize clamp of float
arguments in the presence of FMF the same way as already done for
integers.

This case is a little different though. With integers, given the
min/max pattern is recognized, DAGBuilder starts selecting MIN/MAX
"automatically". That is not the case for float, because for them only
full FMINNAN/FMINNUM/FMAXNAN/FMAXNUM ISD nodes exist and they do care
about NaNs. On the other hand, some backends (e.g. X86) have only
FMIN/FMAX nodes that do not care about NaNS and the former NAN/NUM
nodes are illegal thus selection is not happening. So I decided to do
such kind of transformation in IR (InstCombiner) instead of
complicating the logic in the backend.

Reviewers: spatel, jmolloy, majnemer, efriedma, craig.topper

Reviewed By: efriedma

Subscribers: hiraditya, javed.absar, n.bozhenov, llvm-commits

Patch by Andrei Elovikov <andrei.elovikov@intel.com>

Differential Revision: https://reviews.llvm.org/D33186


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310054 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 12:22:17 +00:00
Victor Leschuk
e9c33c9ee0 Un-revert r310014: false revert, it wasn't the cause of build break
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310021 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 04:51:15 +00:00
Victor Leschuk
dbdaecd113 Revert r310014 as it breaks build lld-x86_64-darwin13
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310020 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 04:43:54 +00:00
Reid Kleckner
89c78d2b59 [Support] Update comments about stdout, raw_fd_ostream, and outs()
The full story is in the comments:

  // Do not attempt to close stdout or stderr. We used to try to maintain the
  // property that tools that support writing file to stdout should not also
  // write informational output to stdout, but in practice we were never able to
  // maintain this invariant. Many features have been added to LLVM and clang
  // (-fdump-record-layouts, optimization remarks, etc) that print to stdout, so
  // users must simply be aware that mixed output and remarks is a possibility.

NFC, I am just updating comments to reflect reality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310016 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 01:39:23 +00:00
Adrian Prantl
f413d6c7a3 Teach GlobalSRA to update the debug info for split-up globals.
This is similar to what we are doing in "regular" SROA and creates
DW_OP_LLVM_fragment operations to describe the resulting variables.

rdar://problem/33654891

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310014 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 01:19:54 +00:00
Teresa Johnson
dad922aba2 Use profile summary to disable peeling for huge working sets
Summary:
Detect when the working set size of a profiled application is huge,
by comparing the number of counts required to reach the hot percentile
in the profile summary to a large threshold*.

When the working set size is determined to be huge, disable peeling
to avoid bloating the working set further.

*Note that the selected threshold (15K) is significantly larger than the
largest working set value in SPEC cpu2006 (which is gcc at around 11K).

Reviewers: davidxl

Subscribers: mehdi_amini, mzolotukhin, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D36288

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310005 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 23:42:58 +00:00
Easwaran Raman
2bbed02c0b [Inliner] Increase threshold for hot callsites without PGO.
Summary:
This increases the inlining threshold for hot callsites. Hotness is
defined in terms of block frequency of the callsite relative to the
caller's entry block's frequency. Since this requires BFI in the
inliner, this only affects the new PM pipeline. This is enabled by
default at -O3.

This improves the performance of some internal benchmarks. Notably, an
internal benchmark for Gipfeli compression
(https://github.com/google/gipfeli) improves by ~7%. Povray in SPEC2006
improves by ~2.5%. I am running more experiments and will update the
thread if other benchmarks show improvement/regression.

In terms of text size, LLVM test-suite shows an 1.22% text size
increase. Diving into the results, 13 of the benchmarks in the
test-suite increases by > 10%. Most of these are small, but
Adobe-C++/loop_unroll (17.6% increases) and tramp3d(20.7% size increase)
have >250K text size. On a large application, the text size increases by
2%

Reviewers: chandlerc, davidxl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D36199

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309994 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 22:23:33 +00:00
Matt Arsenault
4bcb103953 DAG: Provide access to Pass instance from SelectionDAG
This allows accessing an analysis pass during lowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309991 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 21:54:00 +00:00
Reid Kleckner
63c839af68 [PDB] Fix section contributions
Summary:
PDB section contributions are supposed to use output section indices and
offsets, not input section indices and offsets.

This allows the debugger to look up the index of the module that it
should look up in the modules stream for symbol information. With this
change, windbg can now find line tables, but it still cannot print local
variables.

Fixes PR34048

Reviewers: zturner

Subscribers: hiraditya, ruiu, llvm-commits

Differential Revision: https://reviews.llvm.org/D36285

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309987 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 21:15:09 +00:00
Teresa Johnson
aebcb9ce1d Disable loop peeling during full unrolling pass.
Summary:
Peeling should not occur during the full unrolling invocation early
in the pipeline, but rather later with partial and runtime loop
unrolling. The later loop unrolling invocation will also eventually
utilize profile summary and branch frequency information, which
we would like to use to control peeling. And for ThinLTO we want
to delay peeling until the backend (post thin link) phase, just as
we do for most types of unrolling.

Ensure peeling doesn't occur during the full unrolling invocation
by adding a parameter to the shared implementation function, similar
to the way partial and runtime loop unrolling are disabled.

Performance results for ThinLTO suggest this has a neutral to positive
effect on some internal benchmarks.

Reviewers: chandlerc, davidxl

Subscribers: mzolotukhin, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D36258

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309966 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 17:52:38 +00:00
NAKAMURA Takumi
7b9531eb3a Prune linefeed at eof.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309932 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 11:36:44 +00:00
NAKAMURA Takumi
dd3b410ff3 llvm/Support/CodeGenCWrappers.h: Add missing "llvm/ADT/Optional.h", to fix modules build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309931 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 11:36:42 +00:00
Max Kazantsev
511c1a306c [SCEV] Re-enable "Cache results of computeExitLimit"
The patch rL309080 was reverted because it did not clean up the cache on "forgetValue"
method call. This patch re-enables this change, adds the missing check and introduces
two new unit tests that make sure that the cache is cleaned properly.

Differential Revision: https://reviews.llvm.org/D36087


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309925 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 08:41:30 +00:00
Daniel Sanders
daeea6f68d [globalisel][tablegen] Update a comment to use the name of the constant rather than the value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309924 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 08:38:04 +00:00
Rafael Espindola
cec5ec447c Add LLVM_FALLTHROUGH.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309918 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 03:52:34 +00:00
Rafael Espindola
9aafb854cc Delete Default and JITDefault code models
IMHO it is an antipattern to have a enum value that is Default.

At any given piece of code it is not clear if we have to handle
Default or if has already been mapped to a concrete value. In this
case in particular, only the target can do the mapping and it is nice
to make sure it is always done.

This deletes the two default enum values of CodeModel and uses an
explicit Optional<CodeModel> when it is possible that it is
unspecified.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309911 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 02:16:21 +00:00
Vedant Kumar
d7247b5f8f Move two functions to a nicer spot. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309906 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 23:35:27 +00:00
Vedant Kumar
c563b0447b Rely on autobrief, remove \briefs from a header. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309905 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 23:35:26 +00:00
Vedant Kumar
a8dfa81a14 [Coverage] Add an API to retrive all instantiations of a function (NFC)
The CoverageMapping::getInstantiations() API retrieved all function
records corresponding to functions with more than one instantiation (e.g
template functions with multiple specializations). However, there was no
simple way to determine *which* function a given record was an
instantiation of. This was an oversight, since it's useful to aggregate
coverage information over all instantiations of a function.

llvm-cov works around this by building a mapping of source locations to
instantiation sets, but this duplicates logic that libCoverage already
has (see FunctionInstantiationSetCollector).

This change adds a new API, CoverageMapping::getInstantiationGroups(),
which returns a list of InstantiationGroups. A group contains records
for each instantiation of some particular function, and also provides
utilities to get the total execution count within the group, the source
location of the common definition, etc.

This lets removes some hacky logic in llvm-cov by reusing
FunctionInstantiationSetCollector and makes the CoverageMapping API
friendlier for other clients.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 23:35:25 +00:00
Zachary Turner
50b0dc9e5b [pdb/lld] Write a valid FPM.
The PDB reserves certain blocks for the FPM that describe which
blocks in the file are allocated and which are free.  We weren't
filling that out at all, and in some cases we were even stomping
it with incorrect data.  This patch writes a correct FPM.

Differential Revision: https://reviews.llvm.org/D36235

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309896 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 22:31:39 +00:00
Zachary Turner
34173def44 [pdbutil] Add a command to dump the FPM.
Recently problems have been discovered in the way we write the FPM
(free page map).  In order to fix this, we first need to establish
a baseline about what a correct FPM looks like using an MSVC
generated PDB, so that we can then make our own generated PDBs
match.  And in order to do this, the dumper needs a mode where it
can dump an FPM so that we can write tests for it.

This patch adds a command to dump the FPM, as well as a test against
a known-good PDB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309894 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 22:25:52 +00:00
Teresa Johnson
99dd11f7e8 [PM] Split LoopUnrollPass and make partial unroller a function pass
Summary:
This is largely NFC*, in preparation for utilizing ProfileSummaryInfo
and BranchFrequencyInfo analyses. In this patch I am only doing the
splitting for the New PM, but I can do the same for the legacy PM as
a follow-on if this looks good.

*Not NFC since for partial unrolling we lose the updates done to the
loop traversal (adding new sibling and child loops) - according to
Chandler this is not very useful for partial unrolling, but it also
means that the debugging flag -unroll-revisit-child-loops no longer
works for partial unrolling.

Reviewers: chandlerc

Subscribers: mehdi_amini, mzolotukhin, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D36157

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309886 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 20:35:29 +00:00
Rafael Espindola
2600a677c9 Don't pass the code model to MC
I was surprised to see the code model being passed to MC. After all,
it assembles code, it doesn't create it.

The one place it is used is in the expansion of .cfi directives to
handle .eh_frame being more that 2gb away from the code.

As far as I can tell, gnu assembler doesn't even have an option to
enable this. Compiling a c file with gcc -mcmodel=large produces a
regular looking .eh_frame. This is probably because in practice linker
parse and recreate .eh_frames.

In llvm this is used because the JIT can place the code and .eh_frame
very far apart. Ideally we would fix the jit and delete this
option. This is hard.

Apart from confusion another problem with the current interface is
that most callers pass CodeModel::Default, which is bad since MC has
no way to map it to the target default if it actually needed to.

This patch then replaces the argument with a boolean with a default
value. The vast majority of users don't ever need to look at it. In
fact, only CodeGen and llvm-mc use it and llvm-mc just to enable more
testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309884 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 20:32:26 +00:00
David Blaikie
61dba579be DebugInfo: Test & handle (differently) non-zero DW_AT_ranges_base
Followup to r309570, fixing it slightly differently (ranges_base and
addr_base should never be read from a DWO file - so there shouldn't be
any issue with 'overriding' the values - conditionalize the code and
assert that the values aren't being overriden).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309879 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 20:16:22 +00:00
Jakub Kuderski
95e74fa238 [Dominators] Teach LoopDeletion to use the new incremental API
Summary:
This patch makes LoopDeletion use the incremental DominatorTree API.

We modify LoopDeletion to perform the deletion in 5 steps:
1. Create a new dummy edge from the preheader to the exit, by adding a conditional branch.
2. Inform the DomTree about the new edge.
3. Remove the conditional branch and replace it with an unconditional edge to the exit. This removes the edge to the loop header, making it unreachable.
4. Inform the DomTree about the deleted edge.
5. Remove the unreachable block from the function.

Creating the dummy conditional branch is necessary to perform incremental DomTree update.
We should consider using the batch updater when it's ready.

Reviewers: dberlin, davide, grosser, sanjoy

Reviewed By: dberlin, grosser

Subscribers: mzolotukhin, llvm-commits

Differential Revision: https://reviews.llvm.org/D35391

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309850 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 18:17:52 +00:00
Adrian Prantl
810c1b6a3c Remove the unused Offset field from MachineLocation (NFC)
rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309831 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 17:07:38 +00:00
Adrian Prantl
1c11c833ab Assert that the offset in MachineLocation::set() is always 0. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309818 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 14:45:50 +00:00
Alexey Bataev
340067cec4 [SLPVectorizer] Generalize interface of functions, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309816 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 14:38:07 +00:00
Diana Picus
bb326e2526 [MIR] Print target-specific constant pools
This should enable us to test the generation of target-specific constant
pools, e.g. for ARM:

constants:
 - id:              0
   value:           'g(GOT_PREL)-(LPC0+8-.)'
   alignment:       4
   isTargetSpecific: true

I intend to use this to test PIC support in GlobalISel for ARM.

This is difficult to test outside of that context, since the existing
MIR tests usually rely on parser support as well, and that seems a bit
trickier to add. We could try to add a unit test, but the setup for that
seems rather convoluted and overkill.

We do test however that the parser reports a nice error when
encountering a target-specific constant pool.

Differential Revision: https://reviews.llvm.org/D36092

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309806 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 11:09:30 +00:00
Daniel Sanders
e36182d580 [globalisel][tablegen] Do not merge memoperands from instructions that weren't in the match.
Summary:
Fix a bug discovered in an out-of-tree target where memoperands from
pseudo-instructions that weren't part of the match were being merged into the
result instructions as part of GIR_MergeMemOperands.

This bug was caused by a change to the handling of State.MIs between rules when
the state machine tables were fused into a single table. Previously, each rule
would reset State.MIs using State.MIs.resize(1) but this is no longer done, as a
result stale data is occasionally left in some elements of State.MIs. Most
opcodes aren't affected by this but GIR_MergeMemOperands merges all memoperands
from the intructions recorded in State.MIs into the result instruction.

Suppose for example, we processed but rejected the following pattern:
  (signextend (load x))
at this point, State.MIs contains the signextend and the load. Now suppose we
process and accept this pattern:
  (add x, y)
at this point, State.MIs contains the add as well as the (now irrelevant) load.
When GIR_MergeMemOperands is processed, the memoperands from that irrelevant
load will be merged into the result instruction even though it was not part of
the match.

Bringing back the State.MIs.resize(1) would fix the problem but it would limit
our ability to optimize the table in the future. Instead, this patch fixes the
problem by explicitly stating which instructions should be merged into the result.

There's no direct test case in this commit because a test case would be very brittle.
However, at the time of writing this should fix the failures in
http://green.lab.llvm.org/green/job/Compiler_Verifiers_GlobalISEL/ as well as a
failure in test/CodeGen/ARM/GlobalISel/arm-isel.ll when expensive checks are enabled.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Subscribers: fhahn, kristof.beyls, igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D36094



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 11:03:36 +00:00
Dehao Chen
b929c3e6e4 Fix the bug that parseAAPipeline is not invoked in runNewPMPasses in release compiler.
Summary: The logic is guarded by "assert".

Reviewers: davidxl, davide, chandlerc

Reviewed By: davide, chandlerc

Subscribers: sanjoy, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D36195

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 03:03:19 +00:00
Chandler Carruth
759393be2d [PM] Fix a bug where through CGSCC iteration we can get
infinite-inlining across multiple runs of the inliner by keeping a tiny
history of internal-to-SCC inlining decisions.

This is still a bit gross, but I don't yet have any fundamentally better
ideas and numerous people are blocked on this to use new PM and ThinLTO
together.

The core of the idea is to detect when we are about to do an inline that
has a chance of re-splitting an SCC which we have split before with
a similar inlining step. That is a critical component in the inlining
forming a cycle and so far detects all of the various cyclic patterns
I can come up with as well as the original real-world test case (which
comes from a ThinLTO build of libunwind).

I've added some tests that I think really demonstrate what is going on
here. They are essentially state machines that march the inliner through
various steps of a cycle and check that we stop when the cycle is closed
and that we actually did do inlining to form that cycle.

A lot of thanks go to Eric Christopher and Sanjoy Das for the help
understanding this issue and improving the test cases.

The biggest "yuck" here is the layering issue -- the CGSCC pass manager
is providing somewhat magical state to the inliner for it to use to make
itself converge. This isn't great, but I don't honestly have a lot of
better ideas yet and at least seems nicely isolated.

I have tested this patch, and it doesn't block *any* inlining on the
entire LLVM test suite and SPEC, so it seems sufficiently narrowly
targeted to the issue at hand.

We have come up with hypothetical issues that this patch doesn't cover,
but so far none of them are practical and we don't have a viable
solution yet that covers the hypothetical stuff, so proceeding here in
the interim. Definitely an area that we will be back and revisiting in
the future.

Differential Revision: https://reviews.llvm.org/D36188

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309784 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 02:09:22 +00:00
Adrian Prantl
88d9e5d614 Remove unused accessor (NFC)
rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309763 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 23:16:36 +00:00
Adrian Prantl
6aacb6c808 Assert that the offset of a MachineLocation is always 0.
This is to convince me that it may safely be removed in a follow-up commit.

rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309761 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 22:57:05 +00:00
Adrian Prantl
2cd77a8486 Remove PrologEpilogInserter's usage of DBG_VALUE's offset field
In the last half-dozen commits to LLVM I removed code that became dead
after removing the offset parameter from llvm.dbg.value gradually
proceeding from IR towards the backend. Before I can move on to
DwarfDebug and friends there is one last side-called offset I need to
remove:  This patch modifies PrologEpilogInserter's use of the
DBG_VALUE's offset argument to use a DIExpression instead. Because the
PrologEpilogInserter runs at the Machine level I had to play a little
trick with a named llvm.dbg.mir node to get the DIExpressions to print
in MIR dumps (which print the llvm::Module followed by the
MachineFunction dump).

I also had to add rudimentary DwarfExpression support to CodeView and
as a side-effect also fixed a bug (CodeViewDebug::collectVariableInfo
was supposed to give up on variables with complex DIExpressions, but
would fail to do so for fragments, which are also modeled as
DIExpressions).

With this last holdover removed we will have only one canonical way of
representing offsets to debug locations which will simplify the code
in DwarfDebug (and future versions of CodeViewDebug once it starts
handling more complex expressions) and make it easier to reason about.

This patch is NFC-ish: All test case changes are for assembler
comments and the binary output does not change.

rdar://problem/33580047
Differential Revision: https://reviews.llvm.org/D36125

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309751 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 21:45:24 +00:00
Vedant Kumar
e72b881e28 [llvm-cov] Allow specifying distinct architectures for each loaded binary
The coverage tool needs to know which slice to look at when it's handed
a universal binary. Some projects need to look at aggregate coverage
reports for a variety of slices in different binaries: this patch adds
support for these kinds of projects to llvm-cov.

rdar://problem/33579007

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309747 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 21:23:26 +00:00
Chad Rosier
0d8a77755a [Value Tracking] Default argument to true and rename accordingly. NFC.
IMHO this is a bit more readable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309739 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 20:18:54 +00:00
Daniel Sanders
b97dd2dd48 [globalisel][tablegen] Removed unnecessary typedef pointed out in post-commit review for r308599. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 14:55:34 +00:00
Tobias Grosser
ca05253041 [PostDom] Fix typo in comment [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 11:01:28 +00:00
Craig Topper
0104e2f6f9 [MathExtras] Remove unnecessary cast of a constant 1 in a subtract.
Pretty sure this will automatically promoted to match the type of the other operand of the subtract. There's plenty of other similar code around here without this cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309653 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 04:18:34 +00:00
Hiroshi Inoue
eeca49d1ac [StackColoring] Update AliasAnalysis information in stack coloring pass
Stack coloring pass need to maintain AliasAnalysis information when merging stack slots of different types.
Actually, there is a FIXME comment in StackColoring.cpp

// FIXME: In order to enable the use of TBAA when using AA in CodeGen,
// we'll also need to update the TBAA nodes in MMOs with values
// derived from the merged allocas.

But, TBAA has been already enabled in CodeGen without fixing this pass.
The incorrect TBAA metadata results in recent failures in bootstrap test on ppc64le (PR33928) by allowing unsafe instruction scheduling.
Although we observed the problem on ppc64le, this is a platform neutral issue.

This patch makes the stack coloring pass maintains AliasAnalysis information when merging multiple stack slots.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309651 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 03:32:15 +00:00
Alina Sbirlea
211f7eebce Allow None as a MemoryLocation to getModRefInfo
Summary:
Adding part of the changes in D30369 (needed to make progress):
Current patch updates AliasAnalysis and MemoryLocation, but does _not_ clean up MemorySSA.

Original summary from D30369, by dberlin:
Currently, we have instructions which affect memory but have no memory
location. If you call, for example, MemoryLocation::get on a fence,
it asserts. This means things specifically have to avoid that. It
also means we end up with a copy of each API, one taking a memory
location, one not.

This starts to fix that.

We add MemoryLocation::getOrNone as a new call, and reimplement the
old asserting version in terms of it.

We make MemoryLocation optional in the (Instruction, MemoryLocation)
version of getModRefInfo, and kill the old one argument version in
favor of passing None (it had one caller). Now both can handle fences
because you can just use MemoryLocation::getOrNone on an instruction
and it will return a correct answer.

We use all this to clean up part of MemorySSA that had to handle this difference.

Note that literally every actual getModRefInfo interface we have could be made private and replaced with:

getModRefInfo(Instruction, Optional<MemoryLocation>)
and
getModRefInfo(Instruction, Optional<MemoryLocation>, Instruction, Optional<MemoryLocation>)

and delegating to the right ones, if we wanted to.

I have not attempted to do this yet.

Reviewers: dberlin, davide, dblaikie

Subscribers: sanjoy, hfinkel, chandlerc, llvm-commits

Differential Revision: https://reviews.llvm.org/D35441

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309641 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 00:28:29 +00:00
Zachary Turner
548addb1f1 [lld/pdb] Add an empty globals stream.
We don't write any actual symbols to this stream yet, but for
now we just create the stream and hook it up to the appropriate
places and give it a valid header.

Differential Revision: https://reviews.llvm.org/D35290

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309608 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31 19:36:08 +00:00
Quentin Colombet
6131fb56ca [TargetPassConfig] Feature generic options to setup start/stop-after/before
This patch refactors the code used in llc such that all the users of the
addPassesToEmitFile API have access to a homogeneous way of handling
start/stop-after/before options right out of the box.

In particular, just invoking addPassesToEmitFile will set the proper
pipeline without additional effort (modulo parsing a .mir file if the
start-before/after options are used.

NFC.

Differential Revision: https://reviews.llvm.org/D30913

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309599 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31 18:24:07 +00:00
Spyridoula Gravani
d40539f8e3 [DWARF] Added verification check for tags in accelerator tables. This patch verifies that the atom tag is actually the same with the tag of the DIE that we retrieve from the table.
Differential Revision: https://reviews.llvm.org/D35963

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309596 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31 18:01:16 +00:00
Alexey Bataev
5a34abfe3e [Cost] Rename getReductionCost() to getArithmeticReductionCost(), NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309563 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31 14:19:32 +00:00
Tobias Grosser
31ba5f1125 Fix typo in comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309519 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30 18:01:16 +00:00
David Blaikie
ed297a61b7 DebugInfo: Use DWP cu_index to speed up symbolizing (as intended)
I was a bit lazy when I first implemented this & skipped the index
lookup - obviously for large files this becomes pretty crucial, so here
we go, do the index lookup. Speeds up large DWP symbolizing by... lots.
(20m -> 20s, actually, maybe more in a release build (that was a release
build without index lookup, compared to a debug/non-release build with
the index usage))

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309507 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30 08:12:07 +00:00
David Blaikie
49fd7fe40d DebugInfo: Group member variable along with the rest
Committed in r309498 I didn't spot where the rest of the private members
were in DWARFContext at the time - group them up again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309506 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30 08:12:05 +00:00
Dehao Chen
7b5ab7f124 Refactor the build{Module|Function}SimplificationPipeline to expose optimization phase.
Summary: This is in preparation of https://reviews.llvm.org/D36052

Reviewers: chandlerc, davidxl, tejohnson

Reviewed By: chandlerc

Subscribers: sanjoy, llvm-commits

Differential Revision: https://reviews.llvm.org/D36053

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309500 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30 04:55:39 +00:00
David Blaikie
4cf772e1b7 DebugInfo: Provide option for explicitly specifying the name of the DWP file
If you've archived the DWP file somewhere it's probably useful to be
able to just tell llvm-symbolizer where it is when you're symbolizing
stack traces from the binary.

This only provides a mechanism for specifying a single DWP file, good if
you're symbolizing a program with a single DWP file, but it's likely if
the program is dynamically linked that you might have a DWP for each
dynamic library - in which case this feature won't help (at least as
it's surfaced in llvm-symbolizer for now) - in theory it could be
extended to specify a collection of DWP files that could all be
consulted for split CU hash resolution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30 01:34:08 +00:00
Sam Elliott
2567d81a06 Migrate PGOMemOptSizeOpt to use new OptimizationRemarkEmitter Pass
Summary:
Fixes PR33790.

This patch still needs a yaml-style test, which I shall write tomorrow

Reviewers: anemet

Reviewed By: anemet

Subscribers: anemet, llvm-commits

Differential Revision: https://reviews.llvm.org/D35981

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309497 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30 00:35:33 +00:00
Dehao Chen
04fe17a734 Refine the PGOOpt and SamplePGOSupport handling.
Summary:
Now that SamplePGOSupport is part of PGOOpt, there are several places that need tweaking:
1. AddDiscriminator pass should *not* be invoked at ThinLTOBackend (as it's already invoked in the PreLink phase)
2. addPGOInstrPasses should only be invoked when either ProfileGenFile or ProfileUseFile is non-empty.
3. SampleProfileLoaderPass should only be invoked when SampleProfileFile is non-empty.
4. PGOIndirectCallPromotion should only be invoked in ProfileUse phase, or in ThinLTOBackend of SamplePGO.

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: chandlerc

Subscribers: sanjoy, mehdi_amini, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D36040

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309478 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 04:10:24 +00:00
Jessica Paquette
38e69b8dcf [MachineOutliner] NFC: Change IsTailCall to a call class + frame class
This commit

- Removes IsTailCall and replaces it with a target-defined unsigned
- Refactors getOutliningCallOverhead and getOutliningFrameOverhead so that they don't use IsTailCall
- Adds a call class + frame class classification to OutlinedFunction and Candidate respectively

This accomplishes a couple things.

Firstly, we don't need the notion of *tail call* in the general outlining algorithm.

Secondly, we now can have different "outlining classes" for each candidate within a set of candidates.
This will make it easy to add new ways to outline sequences for certain targets and dynamically choose
an appropriate cost model for a sequence depending on the context that that sequence lives in.

Ultimately, this should get us closer to being able to do something like, say avoid saving the link
register when outlining AArch64 instructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309475 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 02:55:46 +00:00
Alexander Shaposhnikov
b5b38546f9 [llvm] Update MachOObjectFile::exports interface
This diff removes the second argument of the method MachOObjectFile::exports.
In all in-tree uses this argument is equal to "this" and 
without this argument the interface seems to be cleaner.

Test plan: make check-all


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309462 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:30:45 +00:00
Adrian Prantl
4df9b5f8fb Remove the unused offset from DBG_VALUE (NFC)
Followup to r309426.
rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309450 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 23:00:45 +00:00
Adrian Prantl
30ac8d28e3 Remove the unused DBG_VALUE offset parameter from GlobalISel (NFC)
Followup to r309426.
rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309449 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 22:46:20 +00:00
Adrian Prantl
0521b1a7f6 Remove the unused dbg.value offset from SelectionDAG (NFC)
Followup to r309426.
rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309436 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 21:27:35 +00:00
Adrian Prantl
5d0334a48c Remove the obsolete offset parameter from @llvm.dbg.value
There is no situation where this rarely-used argument cannot be
substituted with a DIExpression and removing it allows us to simplify
the DWARF backend. Note that this patch does not yet remove any of
the newly dead code.

rdar://problem/33580047
Differential Revision: https://reviews.llvm.org/D35951

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309426 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 20:21:02 +00:00
Wei Mi
7d0c810188 [GVN] Recommit the patch "Add phi-translate support in scalarpre"
Recommit after workaround the bug PR31652.

Three bugs fixed in previous recommits: The first one is to use CurrentBlock
instead of PREInstr's Parent as param of performScalarPREInsertion because
the Parent of a clone instruction may be uninitialized. The second one is stop
PRE when CurrentBlock to its predecessor is a backedge and an operand of CurInst
is defined inside of CurrentBlock. The same value defined inside of loop in last
iteration can not be regarded as available. The third one is an out-of-bound
array access in a flipped if guard.

Right now scalarpre doesn't have phi-translate support, so it will miss some
simple pre opportunities. Like the following testcase, current scalarpre cannot
recognize the last "a * b" is fully redundent because a and b used by the last
"a * b" expr are both defined by phis.

long a[100], b[100], g1, g2, g3;
__attribute__((pure)) long goo();

void foo(long a, long b, long c, long d) {

  g1 = a * b;
  if (__builtin_expect(g2 > 3, 0)) {
    a = c;
    b = d;
    g2 = a * b;
  }
  g3 = a * b;      // fully redundant.

}

The patch adds phi-translate support in scalarpre. This is only a temporary
solution before the newpre based on newgvn is available.

Differential Revision: https://reviews.llvm.org/D32252


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309397 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 15:47:25 +00:00
Chad Rosier
c252763623 [ValueTracking] Remove a number of unused arguments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309385 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 14:39:06 +00:00
Saleem Abdulrasool
86b02f9e76 MC: add support for cfi_return_column
This adds support for the CFI pseudo-op return_column.  This specifies
the frame table column which contains the return address.

Addresses PR33953!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309360 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 03:39:19 +00:00
Sanjoy Das
e47ec8cfbd Revert "[SCEV] Cache results of computeExitLimit"
This reverts commit r309080.  The patch needs to clear out the
ScalarEvolution::ExitLimits cache in forgetMemoizedResults.

I've replied on the commit thread for the patch with more details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309357 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 03:25:07 +00:00
Jessica Paquette
b1318fc0e6 [MachineOutliner] NFC: Split up getOutliningBenefit
This is some more cleanup in preparation for some actual
functional changes. This splits getOutliningBenefit into
two cost functions: getOutliningCallOverhead and
getOutliningFrameOverhead. These functions return the
number of instructions that would be required to call
a specific function and the number of instructions
that would be required to construct a frame for a
specific funtion. The actual outlining benefit logic
is moved into the outliner, which calls these functions.

The goal of refactoring getOutliningBenefit is to:

- Get us closer to getting rid of the IsTailCall flag

- Further split up "target-specific" things and
"general algorithm" things




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 03:21:58 +00:00
David Blaikie
ab57bf1130 DebugInfo: Consider a CU containing only local imported entities to be 'empty'
This can come up in ThinLTO & wastes space & makes degenerate IR.

As per the added FIXME, ultimately, local imported entities should hang
off the function and that way the imported entity list on the CU can be
tested for emptiness like all the other CU lists.

(function-attached local imported entities are probably also the best
path forward for fixing how imported entities are handled both in
cross-module use (currently, while ThinLTO preserves the imported
entities, they would not get used at the imported inlined location -
only in the abstract origin that appears in the partial CU created by
the import (which isn't emitted under Fission due to cross-CU
limitations there)) and to reduce the number of points where imported
entities are emitted (they're currently emitted into every inlined
instance, concrete instance, and abstract origin - they should only go
in teh abstract origin if there is one, otherwise in the concrete
instance - but this requires lots of delayed handling and wiring up,
same as abstract variables & subprograms))

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309354 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 03:06:25 +00:00
Dehao Chen
87452e81d0 Separate the ICP total threshold and remaining threshold.
Summary: In the current implementation, isPromotionProfitable only checks if the call count to a direct target is no less than a certain percentage threshold of the remaining call counts that have not been promoted. This causes code size problems when the target count is small but greater than a large portion of remaining counts. E.g. target1 takes 99.9%, while target2 takes 0.1%. Both targets will be promoted and inlined, makes the function size too large, which potentially prevents it from further inlining into its callers. This patch adds another percentage threshold against the total indirect call count. If the target count needs to be no less than both thresholds in order to be promoted speculatively.

Reviewers: davidxl, tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits

Differential Revision: https://reviews.llvm.org/D35962

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309345 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 01:02:54 +00:00
Kostya Serebryany
be07cfbcbd [sanitizer-coverage] rename sanitizer-coverage-create-pc-table into sanitizer-coverage-pc-table and add plumbing for a clang flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309337 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 00:09:29 +00:00
Hiroshi Yamauchi
d3335c2a9e [InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have other uses and one non-constant index
Summary:
Pointer difference simplifications currently happen only if input GEPs don't have other uses or their indexes are all constants, to avoid duplicating indexing arithmetic.

This patch enables cases with exactly one non-constant index among input GEPs to happen where there is no duplicated arithmetic or code size increase even if input GEPs have other uses.

For example, this patch allows "(&A[42][i]-&A[42][0])" --> "i", which didn't happen previously, if the input GEP(s) have other uses.

Reviewers: sanjoy, bkramer

Reviewed By: sanjoy

Subscribers: mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D35499

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309304 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 18:27:11 +00:00
Reid Kleckner
91b875c229 [PDB] Write public symbol records and the publics hash table
Summary:
MSVC link.exe records all external symbol names in the publics stream.
It provides similar functionality to an ELF .symtab.

Reviewers: zturner, ruiu

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D35871

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309303 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 18:25:59 +00:00
Adam Nemet
ad8bced2d5 [ICP] Migrate to OptimizationRemarkEmitter
This is a module pass so for the old PM, we can't use ORE, the function
analysis pass.  Instead ORE is created on the fly.

A few notes:

- isPromotionLegal is folded in the caller since we want to emit the Function
in the remark but we can only do that if the symbol table look-up succeeded.

- There was good test coverage for remarks in this pass.

- promoteIndirectCall uses ORE conditionally since it's also used from
SampleProfile which does not use ORE yet.

Fixes PR33792.

Differential Revision: https://reviews.llvm.org/D35929

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309294 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 16:54:15 +00:00
Adam Nemet
426d57c134 [OptRemark] Allow streaming of 64-bit integers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309293 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 16:54:13 +00:00
Daniel Neilson
9e8e51fbc4 All libcalls should be considered to be GC-leaf functions.
Summary:
It is possible for some passes to materialize a call to a libcall (ex: ldexp, exp2, etc),
but these passes will not mark the call as a gc-leaf-function. All libcalls are
actually gc-leaf-functions, so we change llvm::callsGCLeafFunction() to tell us that
available libcalls are equivalent to gc-leaf-function calls.

Reviewers: sanjoy, anna, reames

Reviewed By: anna

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35840

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309291 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 16:49:39 +00:00
Florian Hahn
5a3180dd84 [TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.

FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.

Reviewers: rengolin, javed.absar, chandlerc, rovka

Reviewed By: rovka

Subscribers: aemerson, kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D35882

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309287 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 16:27:56 +00:00
Daniel Sanders
e0714cfc0f Re-commit: r309094 [globalisel][tablegen] Fuse the generated tables together.
Summary:
Now that we have control flow in place, fuse the per-rule tables into a
single table. This is a compile-time saving at this point. However, this will
also enable the optimization of a table so that similar instructions can be
tested together, reducing the time spent on the matching the code.

This is NFC in terms of externally visible behaviour but some internals have
changed slightly. State.MIs is no longer reset between each rule that is
attempted because it's not necessary to do so. As a consequence of this the
restriction on the order that instructions are added to State.MIs has been
relaxed to only affect recorded instructions that require new elements to be
added to the vector. GIM_RecordInsn can now write to any element from 1 to
State.MIs.size() instead of just State.MIs.size().

The compile-time regressions from the last commit were caused by the ARM target
including a non-const variable (zero_reg) in the table and therefore generating
an initializer for it. That variable is now const.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D35681



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309264 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 11:03:45 +00:00
Aditya Nandakumar
8d30f66962 [GISel]: Missed passing in a parameter to addUsesFromArgs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309243 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 02:15:34 +00:00
Jakub Kuderski
12eeed54bf [Dominators] Fix typos. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309170 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 20:26:13 +00:00
Aditya Nandakumar
d5413e8a8f [GISel]: Avoid zero length array when building Instrs that don't have
uses.

Also splitting the buildSources part allows more overloads such as
adding MachineOperands directly in the arguments for buildInstr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309163 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 19:58:03 +00:00
Peter Collingbourne
0bc3b75ed9 Change CallLoweringInfo::CS to be an ImmutableCallSite instead of a pointer. NFCI.
This was a use-after-free waiting to happen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309159 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 19:15:29 +00:00
Adam Nemet
7d3d44a14c Migrate SimplifyLibCalls to new OptimizationRemarkEmitter
Summary:
This changes SimplifyLibCalls to use the new OptimizationRemarkEmitter
API.

In fact, as SimplifyLibCalls is only ever called via InstCombine,
(as far as I can tell) the OptimizationRemarkEmitter is added there,
and then passed through to SimplifyLibCalls later.

I have avoided changing any remark text.

This closes PR33787

Patch by Sam Elliott!

Reviewers: anemet, davide

Reviewed By: anemet

Subscribers: davide, mehdi_amini, eraman, fhahn, llvm-commits

Differential Revision: https://reviews.llvm.org/D35608

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309158 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 19:03:18 +00:00
Jakub Kuderski
a65cddf557 [Dominators] Change Roots type to SmallVector
Summary: We can use the template parameter `IsPostDom` to pick an appropriate SmallVector size to store DomTree roots for dominators and postdominators. Before, the code would always allocate memory with `std::vector`.

Reviewers: dberlin, davide, sanjoy, grosser

Reviewed By: grosser

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35636

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309148 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 18:27:39 +00:00
Jakub Kuderski
22072158f3 [Dominators] Move root-finding out of DomTreeBase and simplify it
Summary:
This patch moves root-finding logic from DominatorTreeBase to GenericDomTreeConstruction.h.
It makes the behavior simpler and more consistent by always adding a virtual root to PostDominatorTrees.

Reviewers: dberlin, davide, grosser, sanjoy

Reviewed By: dberlin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35597

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309146 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 18:07:40 +00:00
Dehao Chen
d2fb04a72a Make new PM honor -fdebug-info-for-profiling
Summary: The new PM needs to invoke add-discriminator pass when building with -fdebug-info-for-profiling.

Reviewers: chandlerc, davidxl

Reviewed By: chandlerc

Subscribers: sanjoy, llvm-commits

Differential Revision: https://reviews.llvm.org/D35744

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309121 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 15:01:20 +00:00
Daniel Sanders
d0d2059ec3 Revert r309094: [globalisel][tablegen] Fuse the generated tables together.
The ARM bots have started failing and while this patch should be an improvement
for these bots, it's also the only suspect in the blamelist. Reverting while
Diana and I investigate the problem.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309111 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 13:28:40 +00:00
Zvi Rackover
8ec224a8e2 DAGCombiner: Extend reduceBuildVecToTrunc to handle non-zero offset
Summary:
Adding support for combining power2-strided build_vector's where the
first build_vectori's operand is extracted from a non-zero index.

Example:

 v4i32 build_vector((extract_elt V, 1),
                    (extract_elt V, 3),
                    (extract_elt V, 5),
                    (extract_elt V, 7))
 -->
 v4i32 truncate (bitcast (shuffle<1,u,3,u,5,u,7,u> V, u) to v4i64)

Reviewers: delena, RKSimon, guyblank

Reviewed By: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35700

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309108 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 12:57:03 +00:00
Daniel Sanders
18698d1733 [globalisel][tablegen] Fuse the generated tables together.
Summary:
Now that we have control flow in place, fuse the per-rule tables into a
single table. This is a compile-time saving at this point. However, this will
also enable the optimization of a table so that similar instructions can be
tested together, reducing the time spent on the matching the code.

This is NFC in terms of externally visible behaviour but some internals have
changed slightly. State.MIs is no longer reset between each rule that is
attempted because it's not necessary to do so. As a consequence of this the
restriction on the order that instructions are added to State.MIs has been
relaxed to only affect recorded instructions that require new elements to be
added to the vector. GIM_RecordInsn can now write to any element from 1 to
State.MIs.size() instead of just State.MIs.size().

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D35681

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 10:20:56 +00:00
George Rimar
2e3a5b7cc6 [libOption] - Add flag allowing to print options aliases in help text.
By default, we display only options that are not
hidden and have help texts. This patch adds flag
allowing to display aliases that have no help text.
In this case help text of aliased option used instead.

Differential revision: https://reviews.llvm.org/D35476

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309087 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 09:09:56 +00:00
Zvi Rackover
8849d30d5f TargetLowering: Change isShuffleMaskLegal's mask argument type to ArrayRef<int>. NFCI.
Changing mask argument type from const SmallVectorImpl<int>& to
ArrayRef<int>.

This came up in D35700 where a mask is received as an ArrayRef<int> and
we want to pass it to TargetLowering::isShuffleMaskLegal().
Also saves a few lines of code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309085 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 08:06:58 +00:00
Max Kazantsev
8df9b4fbf9 [SCEV] Cache results of computeExitLimit
This patch adds a cache for computeExitLimit to save compilation time. A lot of examples of
tests that take extensive time to compile are attached to the bug 33494.

Differential Revision: https://reviews.llvm.org/D35827


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309080 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 04:55:54 +00:00
Dehao Chen
c87493d497 Add test coverage for new PM PGOOpt handling.
Summary: This patch adds flags and tests to cover the PGOOpt handling logic in new PM.

Reviewers: chandlerc, davide

Reviewed By: chandlerc

Subscribers: sanjoy, llvm-commits

Differential Revision: https://reviews.llvm.org/D35807

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309076 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 02:00:43 +00:00
Eric Beckmann
f74bed27b4 Move manifest utils into separate lib, to reduce libxml2 deps.
Summary:
Previously were in support.  Since many many things depend on support,
were all forced to also depend on libxml2, which we only want in a few cases.
This puts all the libxml2 deps in a separate lib to be used only in a few
places.

Reviewers: ruiu, thakis, rnk

Subscribers: mgorny, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D35819

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309070 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 01:21:55 +00:00
Spyridoula Gravani
c88d81fa3e [DWARF] Generalized verification of .apple_names accelerator table to be applicable to any acceleration table. Added verification for .apple_types, .apple_namespaces and .apple_objc sections.
Differential Revision: https://reviews.llvm.org/D35853

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309068 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 00:52:31 +00:00
Reid Kleckner
4a753bdddf [PDB] Improve GSI hash table dumping for publics and globals
The PDB "symbol stream" actually contains symbol records for the publics
and the globals stream. The globals and publics streams are essentially
hash tables that point into a single stream of records. In order to
match cvdump's behavior, we need to only dump symbol records referenced
from the hash table. This patch implements that, and then implements
global stream dumping, since it's just a subset of public stream
dumping.

Now we shouldn't see S_PROCREF or S_GDATA32 records when dumping
publics, and instead we should see those record in the globals stream.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309066 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 00:40:36 +00:00
Eric Beckmann
ec76cbbaaa Reapply "llvm-mt: implement simple merging of manifests, not factoring namespaces.
This time with correct #if.

This reverts commit 9cf4eca0e0383040c1ff1416815c7f649650c2a0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309064 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 00:25:12 +00:00
Eric Beckmann
0c862f5c0f Revert "llvm-mt: implement simple merging of manifests, not factoring namespaces."
This reverts commit 813308e240792ca70ed2f998f21df24a5061ada0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309050 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 23:06:46 +00:00
Eric Beckmann
b0707e1a0d llvm-mt: implement simple merging of manifests, not factoring namespaces.
Summary:
Does a simple merge, where mergeable elements are combined, all others
are appended.  Does not apply trickly namespace rules.

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35753

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309047 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 22:50:25 +00:00
Don Hinton
9ed22432b4 [CMAKE] Speedup developer builds when passing LLVM_APPEND_VC_REV = OFF
Make sure multiple targets don't get rebuilt unnecessarily when LLVM_APPEND_VC_REV = OFF.

Differential Revision: https://reviews.llvm.org/D35377

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309031 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 21:13:18 +00:00
Teresa Johnson
a63ab3c9ea [LTO] Prevent dead stripping and internalization of symbols with sections
Summary:
ELF linkers generate __start_<secname> and __stop_<secname> symbols
when there is a value in a section <secname> where the name is a valid
C identifier.  If dead stripping determines that the values declared
in section <secname> are dead, and we then internalize (and delete)
such a symbol, programs that reference the corresponding start and end
section symbols will get undefined reference linking errors.

To fix this, add the section name to the IRSymtab entry when a symbol is
defined in a specific section. Then use this in the gold-plugin to mark
the symbol as external and visible from outside the summary when the
section name is a valid C identifier.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D35639

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309009 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 19:42:32 +00:00
Eric Christopher
94c534f4bd Revert "This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements."
This reverts commit r308966.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309005 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 19:22:09 +00:00
Simon Pilgrim
ae9f3ffd87 [DAG] Move DAGCombiner::GetDemandedBits to SelectionDAG
This patch moves the DAGCombiner::GetDemandedBits function to SelectionDAG::GetDemandedBits as a first step towards making it easier for targets to get to the source of any demanded bits without the limitations of SimplifyDemandedBits.

Differential Revision: https://reviews.llvm.org/D35841

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308983 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 16:36:44 +00:00
Matan Haroush
0000a717e9 This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements.
Differential Revision:
https://reviews.llvm.org/D33277
https://reviews.llvm.org/D33278



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308966 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 10:44:09 +00:00
Eugene Zelenko
4114bcf1b9 [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308936 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 23:16:33 +00:00
Spyridoula Gravani
ef55e4c1a3 [DWARF] Added verification check for die ranges. If highPC is an address, then it should be greater than lowPC for each range.
Differential Revision: https://reviews.llvm.org/D35733

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308928 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 21:04:11 +00:00
Rafael Espindola
8121aebb83 Move DWARFSectionMap to a .cpp file.
Thanks to Paul Robinson for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 19:34:26 +00:00
Reid Kleckner
78116356ca [codeview] Emit 'D' as the cv source language for D code
This matches DMD:
522263965c/src/ddmd/backend/cv8.c (L199)

Fixes PR33899.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308890 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 16:16:42 +00:00
Alexandre Isoard
9988d29df5 [DOTGraphTraits] Propagate Graph template argument, NFC
Propagates the GraphT template argument to the default value of
the AnalysisGraphTraitsT template argument. This allows to specialize
the DefaultAnalysisGraphTraits<AnalysisT,GraphT> for analysis with a
graph type different from the analysis type and it will automatically
get picked-up.

Note: This was probably the intended purpose and should not result in any
      functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308878 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 12:55:00 +00:00
Simon Pilgrim
a3e6de066d Fix spelling in comments. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308877 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 12:44:35 +00:00
Momchil Velikov
3f41ea0274 Fix typo: GETTER to SETTER (NFC)
Use the CALLSITE_DELEGATE_SETTER macro in CallSiteBase::setCannotDuplicate.
Comitted as obvious.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308853 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-23 22:27:34 +00:00
Erich Keane
cc55cc2451 Remove Bitrig: LLVM Changes
Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned.

Differential Revision: https://reviews.llvm.org/D35707


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308799 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 22:48:47 +00:00
David Blaikie
8fc7dc6aaf [ProfData] Detect if zlib is available
As discussed on [1], if the profile is compressed and llvm-profdata is not built with zlib support, the error message is not informative. Give a better error message if zlib is not available.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-July/115571.html

Reviewers: davidxl, dblaikie

Differential Revision: https://reviews.llvm.org/D35586

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308789 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 21:41:15 +00:00
Eugene Zelenko
15a56d4ec1 [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 21:37:46 +00:00
Reid Kleckner
f45e52bfbe Fix DebugInfo/PDB build by adding missing changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308765 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 18:32:00 +00:00
Reid Kleckner
cf6f650daf [PDB] Dump extra info about the publics stream
This includes the hash table, the address map, and the thunk table and
section offset table. The last two are only used for incremental
linking, which LLD doesn't support, so they are less interesting. The
hash table is particularly important to get right, since this is the one
of the streams that debuggers use to translate addresses to symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308764 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 18:28:55 +00:00
Haojie Wang
e7ac9f3115 ThinLTO Minimized Bitcode File Size Reduction
Summary: Currently the ThinLTO minimized bitcode file only strip the debug info, but there is still a lot of information in the minimized bit code file that will be not used for thin linker. In this patch, most of the extra information is striped to reduce the minimized bitcode file. Now only ModuleVersion, ModuleInfo, ModuleGlobalValueSummary, ModuleHash, Symtab and Strtab are left. Now the minimized bitcode file size is reduced to 15%-30% of the debug info stripped bitcode file size.

Reviewers: danielcdh, tejohnson, pcc

Reviewed By: pcc

Subscribers: mehdi_amini, aprantl, inglorion, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D35334

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308760 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 17:25:20 +00:00
Jonas Paulsson
ed69aeeaad [SystemZ, LoopStrengthReduce]
This patch makes LSR generate better code for SystemZ in the cases of memory
intrinsics, Load->Store pairs or comparison of immediate with memory.

In order to achieve this, the following common code changes were made:

 * New TTI hook: LSRWithInstrQueries(), which defaults to false. Controls if
 LSR should do instruction-based addressing evaluations by calling
 isLegalAddressingMode() with the Instruction pointers.
 * In LoopStrengthReduce: handle address operands of memset, memmove and memcpy
 as address uses, and call isFoldableMemAccessOffset() for any LSRUse::Address,
 not just loads or stores.

SystemZ changes:

 * isLSRCostLess() implemented with Insns first, and without ImmCost.
 * New function supportedAddressingMode() that is a helper for TTI methods
 looking at Instructions passed via pointers.

Review: Ulrich Weigand, Quentin Colombet
https://reviews.llvm.org/D35262
https://reviews.llvm.org/D35049

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308729 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 11:59:37 +00:00
Spyridoula Gravani
e95e3157f4 [DWARF] Generalized verification of .debug_abbrev to be applicable to both .debug_abbrev and .debug_abbrev.dwo sections.
Differential Revision: https://reviews.llvm.org/D35698

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308703 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 00:51:32 +00:00
Eric Beckmann
49a3b27df8 Only defined CombinedRoot if libxml2 is used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308694 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 23:14:12 +00:00
Kevin Enderby
ed0a9e113b Add error handling to the dyld compact export entries in libObject.
lld needs a matching change for this will be my next commit.
Expect it to fail build until that matching commit is picked up by the bots.

Like the changes in r296527 for dyld bind entires and the changes in
r298883 for lazy bind, weak bind and rebase entries the export
entries are the last of the dyld compact info to have error handling added.

This follows the model of iterators that can fail that Lang Hanes
designed when fixing the problem for bad archives r275316 (or r275361).

So that iterating through the exports now terminates if there is an error
and returns an llvm::Error with an error message in all cases for malformed
input.

This change provides the plumbing for the error handling, all the needed
testing of error conditions and test cases for all of the unique error messages.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 23:08:41 +00:00
Eric Beckmann
c1527448ed Implement parsing and writing of a single xml manifest file.
Summary: Implement parsing and writing of a single xml manifest file.

Subscribers: mgorny, llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35425

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308679 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 21:42:04 +00:00
Matt Arsenault
20f8334c2a Add an ID field to StackObjects
On AMDGPU SGPR spills are really spilled to another register.
The spiller creates the spills to new frame index objects,
which is used as a placeholder.

This will eventually be replaced with a reference to a position
in a VGPR to write to and the frame index deleted. It is
most likely not a real stack location that can be shared
with another stack object.

This is a problem when StackSlotColoring decides it should
combine a frame index used for a normal VGPR spill with
a real stack location and a frame index used for an SGPR.

Add an ID field so that StackSlotColoring has a way
of knowing the different frame index types are
incompatible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 21:03:45 +00:00
Mandeep Singh Grang
8c714df517 [COFF, ARM64, CodeView] Add support to emit CodeView debug info for ARM64 COFF
Reviewers: compnerd, ruiu, rnk, zturner

Reviewed By: rnk

Subscribers: majnemer, aemerson, aprantl, javed.absar, kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D35518

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 20:20:00 +00:00
Krzysztof Parzyszek
cf138ec142 Implement LaneBitmask::getNumLanes and LaneBitmask::getHighestLane
This should eliminate most uses of countPopulation and Log2_32 on
the lane mask values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308658 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 19:43:19 +00:00
Daniel Sanders
3a512afe38 [globalisel][tablegen] Fix an unintended fallthrough that is currently unreachable. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308613 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 13:10:17 +00:00
Daniel Sanders
35ce55c79f [globalisel][tablegen] Fix an issue with lambdas when compiling with older GCC's
It seems that G++ 4.8 doesn't accept the 'enum A' in code of the form:
  enum A { ... };
  const auto &F = []() -> enum A { ... };
However, it does accept:
  typedef enum { ... } A;
  const auto &F = []() -> A { ... };



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308599 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 10:25:00 +00:00
Daniel Sanders
1d22eb0749 [globalisel][tablegen] Add control-flow to the MatchTable.
Summary:
This will allow us to merge the various sub-tables into a single table. This is a
compile-time saving at this point. However, this will also enable the optimization
of a table so that similar instructions can be tested together, reducing the time
spent on the matching the code.

The bulk of this patch is a mechanical conversion to the new MatchTable object
which is responsible for tracking label definitions and filling in the index of
the jump targets. It is also responsible for nicely formatting the table.

This was necessary to support the new GIM_Try opcode which takes the index to
jump to if the match should fail. This value is unknown during table
construction and is filled in during emission. To support nesting try-blocks
(although we currently don't emit tables with nested try-blocks), GIM_Reject
has been re-introduced to explicitly exit a try-block or fail the overall match
if there are no active try-blocks.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D35117

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308596 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 09:25:44 +00:00
Spyridoula Gravani
85dd4f9605 [DWARF] Added check that verifies that no abbreviation declaration has more than one attribute with the same name.
SUMMARY

This patch adds a verification check on the abbreviation declarations in the .debug_abbrev section.
The check makes sure that no abbreviation declaration has more than one attributes with the same name.

Differential Revision: https://reviews.llvm.org/D35643

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308579 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 02:06:52 +00:00
Matthias Braun
01337d5a14 Support, IR, ADT: Check nullptr after allocation with malloc/realloc or calloc
As a follow up of the bad alloc handler patch, this patch introduces nullptr checks on pointers returned from the
malloc/realloc/calloc functions.  In addition some memory size assignments  are moved behind the allocation
of the corresponding memory to fulfill exception safe memory management (RAII).

patch by Klaus Kretzschmar

Differential Revision: https://reviews.llvm.org/D35414

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308576 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 01:30:39 +00:00
Francis Visoiu Mistrih
0775d243ea [AsmPrinter] Constify needsCFIMoves. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308557 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 23:47:33 +00:00
Derek Schuff
634301e0f6 Update module map for RuntimeLibcalls
The def file was created in r308531

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308547 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 23:15:29 +00:00
Francis Visoiu Mistrih
63847878e2 [NFC] Fix typo in comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308545 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 22:28:08 +00:00
Rafael Espindola
ee809acd59 Use delegation instead of inheritance.
This changes DwarfContext to delegate to DwarfObject instead of having
pure virtual methods.

With this DwarfContextInMemory is replaced with an implementation of
DwarfObject that is local to a .cpp file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308543 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 22:27:28 +00:00
Derek Schuff
acdb8f988e Move Runtime libcall definitions to a .def file
This will allow eliminating the duplication of the names, and allow adding
extra information such as signatures in a future commit.

Differential Revision: https://reviews.llvm.org/D35522

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 21:53:30 +00:00
Petr Hosek
e7726ca81f [yaml2obj][ELF] Add support for program headers
This change adds basic support for program headers.

I need to do some testing which requires generating program headers but
I can't use ld.lld or clang to produce programs that have headers. I'd
also like to test some strange things that those programs may never
produce.

Patch by Jake Ehrlich

Differential Revision: https://reviews.llvm.org/D35276

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308520 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 20:38:46 +00:00
Dinar Temirbulatov
86f1776395 [LoopUtils] Add an extra parameter OpValue to propagateIRFlags function,
If OpValue is non-null, we only consider operations similar to OpValue
when intersecting.

Differential Revision: https://reviews.llvm.org/D35292


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308428 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 10:02:07 +00:00
Daniel Sanders
4729bc52ff [globalisel][tablegen] 80-col corrections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308424 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 09:28:20 +00:00
Chandler Carruth
ee48043ceb [PM/LCG] Follow-up fix to r308088 to handle deletion of library
functions.

In the prior commit, we provide ordering to the LCG between functions
and library function definitions that they might begin to call through
transformations. But we still would delete these library functions from
the call graph if they became dead during inlining.

While this immediately crashed, it also exposed a loss of information.
We shouldn't remove definitions of library functions that can still
usefully participate in the LCG-powered CGSCC optimization process. If
new call edges are formed, we want to have definitions to be called.

We can still remove these functions if truly dead using global-dce, etc,
but removing them during the CGSCC walk is premature.

This fixes a crash in the new PM when optimizing some unusual libraries
that end up with "internal" lib functions such as the code in the "R"
language's libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308417 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 04:12:25 +00:00
Saleem Abdulrasool
abab2b9ec9 Object: preserve more information about DEF file
Preserve the actual library name as provided by the user.  This is
required to properly replicate link's behaviour about the module import
name handling.  This requires an associated change to lld for updating
the tests for the proper behaviour for the import library module name
handling in various cases.

Associated tests will be part of the lld change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308406 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 02:01:22 +00:00
Adrian Prantl
9563b5a5e1 Debug Info: Add a file: field to DIImportedEntity.
DIImportedEntity has a line number, but not a file field. To determine
the decl_line/decl_file we combine the line number from the
DIImportedEntity with the file from the DIImportedEntity's scope. This
does not work correctly when the parent scope is a DINamespace or a
DIModule, both of which do not have a source file.

This patch adds a file field to DIImportedEntity to unambiguously
identify the source location of the using/import declaration.  Most
testcase updates are mechanical, the interesting one is the removal of
the FIXME in test/DebugInfo/Generic/namespace.ll.

This fixes PR33822. See https://bugs.llvm.org/show_bug.cgi?id=33822
for more context.

<rdar://problem/33357889>
https://bugs.llvm.org/show_bug.cgi?id=33822

Differential Revision: https://reviews.llvm.org/D35583

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308398 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 00:09:54 +00:00
Saleem Abdulrasool
0b89845991 Object: rename parameter from DLLName to ImportName
When I originally wrote this code, I neglected the fact that the import
library may be created for executables.  This name is not the name of
the DLL, but rather the name for the imported module.  It will be
embedded into the IAT/ILT reference.  Rename it to make it more obvious.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 22:11:01 +00:00
Martell Malone
d888646bf4 llvm: add llvm-dlltool support to the archiver
A PE COFF spec compliant import library generator.
Intended to be used with mingw-w64.

Supports:
PE COFF spec (section 8, Import Library Format)
PE COFF spec (Aux Format 3: Weak Externals)

Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D29892

This reapplies rL308329, which was reverted in rL308374

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 21:26:38 +00:00
Rui Ueyama
441b4ee1b0 Revert r308329: llvm: add llvm-dlltool support to the archiver
This reverts commit r308329 because it broke buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308374 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 21:07:13 +00:00
Jakub Kuderski
95801038d6 [Dominators] Improve error checking in deleteEdge
Summary: This patch improves error detection in deleteEdge. It asserts that the edge doesn't exist in the CFG and that DomTree knew about this edge before.

Reviewers: dberlin, grosser, brzycki, sanjoy

Reviewed By: dberlin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35571

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308354 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 20:19:52 +00:00
Martell Malone
5d7d0e869f llvm: add llvm-dlltool support to the archiver
A PE COFF spec compliant import library generator.
Intended to be used with mingw-w64.

Supports:
PE COFF spec (section 8, Import Library Format)
PE COFF spec (Aux Format 3: Weak Externals)

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D29892

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308329 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 17:39:11 +00:00
Frederich Munch
b547c3d9cf Make EHFrames available to sub-classes of RTDyldMemoryManager.
Summary: This information can be useful; and in the case of Win64, necessary for getting exceptions to work in the JIT.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35102

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308321 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 15:50:28 +00:00
Daniel Sanders
f9e61eebbf [globalisel][tablegen] Enable the import of rules involving fma.
Summary:
G_FMA was recently added to GlobalISel which enables the import of rules
involving fma. Add the mapping to allow it.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, javed.absar, igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D35130

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308308 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 14:10:07 +00:00
Dorit Nuzman
bdc92341e1 PSCEV] Create AddRec for Phis in cases of possible integer overflow,
using runtime checks

Extend the SCEVPredicateRewriter to work a bit harder when it encounters an
UnknownSCEV for a Phi node; Try to build an AddRecurrence also for Phi nodes
whose update chain involves casts that can be ignored under the proper runtime
overflow test. This is one step towards addressing PR30654.

Differential revision: http://reviews.llvm.org/D30041



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308299 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 11:57:08 +00:00
Javed Absar
937f85f25c [ARM|CodeGen] Improve the code in FastISel
Cleaned up the code in FastISel a bit.
Had to add make_range to MCInstrDesc as that was needed and seems missing.

Reviewed by: @t.p.northover
Differential Revision: https://reviews.llvm.org/D35494



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308291 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 10:19:48 +00:00
NAKAMURA Takumi
71a7fca51e llvm/DebugInfo/CodeView/TypeStreamMerger.h: Prune a couple of \param(s), removed in r308212. [-Wdocumentation]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 08:52:02 +00:00
Spyridoula Gravani
0ea156d8ef [DWARF] Modification of code for the verification of .debug_info section.
Summary:
This patch modifies the handleDebugInfo() function so that we verify the contents of each unit
in the .debug_info section only if its header has been successfully verified.

This change will allow for more/different verification checks depending on the type of the unit since from
dwarf5, the .debug_info section may consist of different types of units.

Subscribers: aprantl

Differential Revision: https://reviews.llvm.org/D35521

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308245 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 01:00:26 +00:00
Reid Kleckner
3361fafaf7 [PDB] Finish and simplify TPI hashing
Summary:
This removes the CVTypeVisitor updater and verifier classes. They were
made dead by the minimal type dumping refactoring. Replace them with a
single function that takes a type record and produces a hash. Call this
from the minimal type dumper and compare the hash.

I also noticed that the microsoft-pdb reference repository uses a basic
CRC32 for records that aren't special. We already have an implementation
of that CRC ready to use, because it's used in COFF for ICF.

I'll make LLD call this hashing utility in a follow-up change. We might
also consider using this same hash in type stream merging, so that we
don't have to hash our records twice.

Reviewers: inglorion, ruiu

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35515

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308240 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 00:33:45 +00:00
Reid Kleckner
b672df825a [PDB] Merge in types and items from type servers (/Zi)
Summary:
Object files compiled with /Zi emit type information into a type server
PDB. The .debug$S section will contain a single TypeServer2Record with
the absolute path and GUID of the type server. LLD needs to load the
type server PDB and merge all types and items it finds in it into the
destination PDB.

Depends on D35495

Reviewers: ruiu, inglorion

Subscribers: zturner, llvm-commits

Differential Revision: https://reviews.llvm.org/D35504

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308235 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 00:21:25 +00:00
Reid Kleckner
5c238d611e [codeview] Fix YAML for LF_TYPESERVER2 by hoisting PDB_UniqueId
Summary:
We were treating the GUIDs in TypeServer2Record as strings, and the
non-ASCII bytes in the GUID would not round-trip through YAML.

We already had the PDB_UniqueId type portably represent a Windows GUID,
but we need to hoist that up to the DebugInfo/CodeView library so that
we can use it in the TypeServer2Record as well as in PDB parsing code.

Reviewers: inglorion, amccarth

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35495

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308234 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 23:59:44 +00:00
Reid Kleckner
53034fb6bd [codeview] Remove TypeServerHandler and PDBTypeServerHandler
Summary:
Instead of wiring these through the CVTypeVisitor interface, clients
should inspect the CVTypeArray before visiting it and potentially load
up the type server's TPI stream if they need it.

No tests relied on this functionality because LLD was the only client.

Reviewers: ruiu

Subscribers: mgorny, hiraditya, zturner, llvm-commits

Differential Revision: https://reviews.llvm.org/D35394

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308212 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 20:28:06 +00:00
Martin Storsjo
6c132cb749 [AArch64] Extend CallingConv::X86_64_Win64 to AArch64 as well
Rename the enum value from X86_64_Win64 to plain Win64.

The symbol exposed in the textual IR is changed from 'x86_64_win64cc'
to 'win64cc', but the numeric value is kept, keeping support for
old bitcode.

Differential Revision: https://reviews.llvm.org/D34474

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308208 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 20:05:19 +00:00
Lang Hames
ebf3850de8 [ORC] Remove extraneous else.
As suggested by Dave Blaikie in review on r307952. Thanks Dave!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308203 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 18:36:35 +00:00
Ulrich Weigand
b5bf1de320 [SystemZ] Add support for IBM z14 processor (2/3)
This adds support for the new 32-bit vector float instructions of z14.
This includes:
- Enabling the instructions for the assembler/disassembler.
- CodeGen for the instructions, including new LLVM intrinsics.
- Scheduler description support for the instructions.
- Update to the vector cost function calculations.

In general, CodeGen support for the new v4f32 instructions closely
matches support for the existing v2f64 instructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308195 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 17:42:48 +00:00
Ulrich Weigand
8ab242ce95 [SystemZ] Add support for IBM z14 processor (1/3)
This patch series adds support for the IBM z14 processor.  This part includes:
- Basic support for the new processor and its features.
- Support for new instructions (except vector 32-bit float and 128-bit float).
- CodeGen for new instructions, including new LLVM intrinsics.
- Scheduler description for the new processor.
- Detection of z14 as host processor.

Support for the new 32-bit vector float and 128-bit vector float
instructions is provided by separate patches.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308194 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 17:41:11 +00:00
Alex Bradbury
325ccf1c3d [YAMLTraits] Add filename support to yaml::Input
Summary:
The current yaml::Input constructor takes a StringRef of data as its
first parameter, discarding any filename information that may have been
present when a YAML file was opened. Add an alterate yaml::Input
constructor that takes a MemoryBufferRef, which can have a filename
associated with it. This leads to clearer diagnostic messages.

Sponsored By: DARPA, AFRL

Reviewed By: arphaman

Differential Revision: https://reviews.llvm.org/D35398

Patch by: Jonathan Anderson (trombonehero)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 11:41:30 +00:00
Jakub Kuderski
1efe842f5a Apply explicit instantiation workaround to DominanceFrontier
This is a workaround for the same explicit instantiation bug
as in DominatorTreeBase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-16 17:29:19 +00:00
Jakub Kuderski
d3c313212e [Dominators] Workaround explicit instantiation bug.
Some platforms have problems with emmiting constructors when class
templates get explicitly instantiated.
This patch fixes the bug reported in D35315 by replacing `= default`
with an empty constructor body.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308140 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-16 17:01:40 +00:00
Craig Topper
fce917909c [IR] Implement Constant::isNegativeZeroValue/isZeroValue/isAllOnesValue/isOneValue/isMinSignedValue for ConstantDataVector without going through getElementAsConstant
Summary:
Currently these methods call ConstantDataVector::getSplatValue which uses getElementsAsConstant to create a Constant object representing the element value. This method incurs a map lookup to see if we already have created such a Constant before and if not allocates a new Constant object.

This patch changes these methods to use getElementAsAPFloat and getElementAsInteger so we can just examine the data values directly.

Reviewers: spatel, pcc, dexonsmith, bogner, craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35040

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308112 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 22:06:19 +00:00
Reid Kleckner
4a5ccd44d5 [CodeView] Dump BuildInfoSym and ProcSym type indices
I need to print the type index in hex so that I can match it in
FileCheck for a test I'm writing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308107 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 18:10:39 +00:00
Reid Kleckner
0b189e17f8 Fix mis-use of std::lower_bound
Binary search in C++ is such a PITA. =/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308106 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 18:10:15 +00:00
Chandler Carruth
ed504111e8 [PM/LCG] Teach the LazyCallGraph to maintain reference edges from every
function to every defined function known to LLVM as a library function.

LLVM can introduce calls to these functions either by replacing other
library calls or by recognizing patterns (such as memset_pattern or
vector math patterns) and replacing those with calls. When these library
functions are actually defined in the module, we need to have reference
edges to them initially so that we visit them during the CGSCC walk in
the right order and can effectively rebuild the call graph afterward.

This was discovered when building code with Fortify enabled as that is
a common case of both inline definitions of library calls and
simplifications of code into calling them.

This can in extreme cases of LTO-ing with libc introduce *many* more
reference edges. I discussed a bunch of different options with folks but
all of them are unsatisfying. They either make the graph operations
substantially more complex even when there are *no* defined libfuncs, or
they introduce some other complexity into the callgraph. So this patch
goes with the simplest possible solution of actual synthetic reference
edges. If this proves to be a memory problem, I'm happy to implement one
of the clever techniques to save memory here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308088 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 08:08:19 +00:00
Haicheng Wu
8c939cb97f [TTI] Refine the cost of EXT in getUserCost()
Now, getUserCost() only checks the src and dst types of EXT to decide it is free
or not. This change first checks the types, then calls isExtFreeImpl(), and
check if EXT can form ExtLoad at last. Currently, only AArch64 has customized
implementation of isExtFreeImpl() to check if EXT can be folded into its use.

Differential Revision: https://reviews.llvm.org/D34458

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308076 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 02:12:16 +00:00
Jakub Kuderski
37b0ef0bdf [Dominators] Fix reachable visitation and reenable a unit test
This fixes a minor bug in insertion to a reachable node that caused
DominatorTree.InsertDeleteExhaustive flakiness. The patch also adds
a new testcase for this exact failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308074 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 01:27:16 +00:00
Adrian Prantl
f8411a4be9 Add missing space to comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308068 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 23:23:58 +00:00
Jakub Kuderski
82f51d560c [Dominators] Implement incremental deletions
Summary:
This patch implements incremental edge deletions.

It also makes DominatorTreeBase store a pointer to the parent function. The parent function is needed to perform full rebuilts during some deletions, but it is also used to verify that inserted and deleted edges come from the same function.

Reviewers: dberlin, davide, grosser, sanjoy, brzycki

Reviewed By: dberlin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35342

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308062 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 21:58:53 +00:00
Jakub Kuderski
b3f60e3cd4 [Dominators] Add a missing include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308058 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 21:38:15 +00:00
Jakub Kuderski
79eefe9ee2 [Dominators] Implement incremental insertions
Summary:
This patch introduces incremental edge insertions based on the Depth Based Search algorithm.

Insertions should work for both dominators and postdominators.

Reviewers: dberlin, grosser, davide, sanjoy, brzycki

Reviewed By: dberlin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35341

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308054 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 21:17:33 +00:00
Craig Topper
c68f8f2fd3 [TableGen][MC] Fix a few places where we didn't hide the underlying type of LaneBitmask very well.
One place compared with 32, which I've replaced with LaneBitmask::BitWidth.

The other places are shifts of a constant 1 by a lane number. But if LaneBitmask were to be a larger type than 32-bits like 64-bits, the 1 would need to be 1ULL to do a 64-bit shift. To hide this I've added a LanebitMask::getLane that hides the shift and make sures the 1 is casted to correct type first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308042 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 18:30:09 +00:00
Jakub Kuderski
cb105529db [Dominators] Make IsPostDominator a template parameter
Summary:
DominatorTreeBase used to have IsPostDominators (bool) member to indicate if the tree is a dominator or a postdominator tree. This made it possible to switch between the two 'modes' at runtime, but it isn't used in practice anywhere.

This patch makes IsPostDominator a template argument. This way, it is easier to switch between different algorithms at compile-time based on this argument and design external utilities around it. It also makes it impossible to incidentally assign a postdominator tree to a dominator tree (and vice versa), and to further simplify template code in GenericDominatorTreeConstruction.

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin

Subscribers: mzolotukhin, llvm-commits

Differential Revision: https://reviews.llvm.org/D35315

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308040 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 18:26:09 +00:00
Jakub Kuderski
3a82e3504d [Dominators] Simplify block and node printing
Summary:
This patch adds `BlockPrinter`-- a small wrapper for printing CFG nodes and DomTree nodes to `raw_ostream`. It is meant to be only used internally, for debugging and printing errors.

Reviewers: dberlin, sanjoy, grosser, davide

Reviewed By: grosser, davide

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35286

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308036 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 16:56:35 +00:00
Krzysztof Parzyszek
9d612bd4f5 [Hexagon] Add intrinsics for data cache operations
This is the LLVM part, adding definitions for
  void @llvm.hexagon.Y2.dccleana(i8*)
  void @llvm.hexagon.Y2.dccleaninva(i8*)
  void @llvm.hexagon.Y2.dcinva(i8*)
  void @llvm.hexagon.Y2.dczeroa(i8*)
  void @llvm.hexagon.Y4.l2fetch(i8*, i32)
  void @llvm.hexagon.Y5.l2fetch(i8*, i64)
The clang part will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308032 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 15:58:48 +00:00
Spyridoula Gravani
e302dc70dd [DWARF] Introduce verification for the unit header chain in .debug_info section to llvm-dwarfdump.
This patch adds verification checks for the unit header chain in the .debug_info section.
Specifically, for each unit in the .debug_info section, the verifier checks that:

The unit length is valid (i.e. the unit can actually fit in the .debug_info section)
The dwarf version of the unit is valid
The address size is valid (4 or 8)
The unit type (if the unit is in dwarf5) is valid
The debug_abbrev_offset is valid

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307975 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 23:25:24 +00:00
Reid Kleckner
c3e0164ec9 Fix build due to const-correctness issue after last minute refactoring
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 22:05:30 +00:00
Reid Kleckner
773ac0d316 [PDB] Fix quadratic behavior when writing a BinaryItemStream
Binary streams are an abstraction over a discontiguous buffer. To write
a discontiguous buffer, we want to copy each contiguous chunk
individually. Currently BinaryStreams do not expose a way to iterate
over the chunks, so the code repeatedly calls
readLongestContiguousChunk() with an increasing offset. In order to
lookup the chunk by offset, we would iterate the items list to figure
out which chunk the offset is within. This is obviously O(n^2).

Instead, pre-compute a table of offsets and do a binary search to figure
out which chunk to use. This is still only an O(n^2) to O(n log n)
improvement, but it's a very local fix that seems worth doing.

This improves self-linking lld.exe with PDBs from 90s to 10s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307970 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 22:02:23 +00:00
Jakub Kuderski
1a2e7d2ddc [Dominators] Simplify templates
Summary: DominatorTreeBase and related classes used overcomplicated template machinery. This patch simplifies them and gets rid of DominatorTreeBaseTraits and DominatorTreeBaseByTraits, which weren't actually used outside the DomTree construction.

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin, davide, grosser

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35285

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307953 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 20:45:32 +00:00
Lang Hames
1ff1f35f8b [Orc] Fix some Error-related fixmes in CompileOnDemandLayer now that the layer
interface has been errorized.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307952 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 20:44:46 +00:00
Jakub Kuderski
b49a90071a [Dominators] Split SemiNCA into smaller functions
Summary:
This patch splits the SemiNCA algorithm into smaller functions. It also adds a new debug macro.

In order to perform incremental updates, we need to be able to refire SemiNCA on a subset of CFG nodes (determined by a DFS walk results). We also need to skip nodes that are not deep enough in a DomTree.

Reviewers: dberlin, davide, sanjoy, grosser

Reviewed By: dberlin, davide

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35282

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307950 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 20:35:01 +00:00
Reid Kleckner
fe30dbf0ab [PDB] Fix type server handling for archives
Summary:
This fixes type indices for SDK or CRT static archives. Previously we'd
try to look next to the archive object file path, which would not exist
on the local machine.

Also error out if we can't resolve a type server record. Hypothetically
we can recover from this error by discarding debug info for this object,
but that is not yet implemented.

Reviewers: ruiu, amccarth

Subscribers: aprantl, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D35369

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307946 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 20:12:23 +00:00
Jakub Kuderski
1745e246f8 [Dominators] Improve reachability verification
Summary:
This patch improves verification by making `verifyReachablility` look for CFG not found in the DomTree.
It also makes the verification work with postdominators by handling virtual root.

Reviewers: dberlin, davide, grosser, sanjoy

Reviewed By: dberlin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35279

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307936 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 18:55:52 +00:00
Rafael Espindola
d7b55ebbd0 Documentation fix. NFC.
A MCFixup might not even be in an instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307926 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 17:00:30 +00:00
Frederich Munch
d6657666e9 Support: Add llvm::center_justify.
Summary: Completes the set.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: ruiu, llvm-commits

Differential Revision: https://reviews.llvm.org/D35278

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 16:11:08 +00:00
Amara Emerson
51a4b73703 [AArch64] Add an SVE target feature to the backend and TargetParser.
The feature will be used properly once assembler/disassembler support
begins to land.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307917 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 15:19:56 +00:00
Geoff Berry
cc6cfc778f [TargetLowering] Add hook for adding target MMO flags when doing ISel.
Summary: Add TargetLowering hook getMMOFlags() to add target specific
MMO flags to load/store instructions created by ISel.

Reviewers: bogner, hfinkel, qcolombet, MatzeB

Subscribers: mcrosier, javed.absar, llvm-commits

Differential Revision: https://reviews.llvm.org/D34962

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307879 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 03:49:42 +00:00
Geoff Berry
9bf66c730c [MIR] Add support for printing and parsing target MMO flags
Summary: Add target hooks for printing and parsing target MMO flags.
Targets may override getSerializableMachineMemOperandTargetFlags() to
return a mapping from string to flag value for target MMO values that
should be serialized/parsed in MIR output.

Add implementation of this hook for AArch64 SuppressPair MMO flag.

Reviewers: bogner, hfinkel, qcolombet, MatzeB

Subscribers: mcrosier, javed.absar, llvm-commits

Differential Revision: https://reviews.llvm.org/D34962

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307877 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 02:28:54 +00:00
Daniel Neilson
a06b091075 Add element atomic memset intrinsic
Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memset intrinsic. This intrinsic is essentially memset with the implementation requirement that all stores used for the assignment are done with unordered-atomic stores of a given element size.

Reviewers: eli.friedman, reames, mkazantsev, skatkov

Reviewed By: reames

Subscribers: jfb, dschuff, sbc100, jgravelle-google, aheejin, efriedma, llvm-commits

Differential Revision: https://reviews.llvm.org/D34885

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 21:57:23 +00:00
Frederich Munch
9d9b7c829a Allow clients to specify search order of DynamicLibraries.
Summary: Different JITs and other clients of LLVM may have different needs in how symbol resolution should occur.

Reviewers: v.g.vassilev, lhames, karies

Reviewed By: v.g.vassilev

Subscribers: pcanal, llvm-commits

Differential Revision: https://reviews.llvm.org/D33529

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 21:22:45 +00:00
Rafael Espindola
41cc19a3ac Don't expose a map in the DWARFContext interface.
Doing so is leaking an implementation detail.

I have an implementation that uses the lld infrastructure and doesn't
use a map or object::SectionRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307846 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 21:08:24 +00:00
Sam Clegg
fc19aecdbe Remove unneeded use of #undef DEBUG_TYPE. NFC
Where is is needed (at the end of headers that define it), be
consistent about its use.

Also fix a few header guards that I found in the process.

Differential Revision: https://reviews.llvm.org/D34916

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 20:49:21 +00:00
Reid Kleckner
de79ef835a Fix non-Windows build after PDB native builtin type change
Some C++14 features slipped in along with an extra member qualification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307835 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 19:46:35 +00:00
Adrian McCarthy
39bfdfaa94 [PDB] Enable NativeSession to create symbols for built-in types on demand
Summary:
There is a reserved range of type indexes for built-in types (like integers).
This will create a symbol for a built-in type if the caller askes for one by
type index.  This is also plumbing for being able to recall symbols by type
index in general, but user-defined types will come in subsequent patches.

Reviewers: rnk, zturner

Subscribers: mgorny, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D35163

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307834 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 19:38:11 +00:00
Evandro Menezes
0dedcfc77f [CodeGen] Add dependency printer
Add SDep printer to make debugging sessions more productive.

Differential revision: https://reviews.llvm.org/D35144

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307799 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 15:30:59 +00:00
Daniel Neilson
c96acc5425 Add element atomic memmove intrinsic
Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memmove intrinsic. This intrinsic is essentially memmove with the implementation requirement that all loads/stores used for the copy are done with unordered-atomic loads/stores of a given element size.

Reviewers: eli.friedman, reames, mkazantsev, skatkov

Reviewed By: reames

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34884

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307796 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 15:25:26 +00:00
Serge Guelton
fbec1c990e Have Module::createRNG return a unique_ptr
Instead of a raw pointer, this makes memory management safer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307762 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 08:03:44 +00:00
Mikael Holmen
97e16560aa [MemoryBuiltins] Allow truncation in visitAllocaInst()
Summary:
Solves PR33689.

If the pointer size is less than the size of the type used for the array
size in an alloca (the <ty> type below) then we could trigger the assert in
the PR. In that example we have pointer size i16 and <ty> is i32.

<result> = alloca [inalloca] <type> [, <ty> <NumElements>] [, align <alignment>]

Handle the situation by allowing truncation as well as zero extension in
ObjectSizeOffsetVisitor::visitAllocaInst().

Also, we now detect overflow in visitAllocaInst(), similar to how it was
already done in visitCallSite().

Reviewers: craig.topper, rnk, george.burgess.iv

Reviewed By: george.burgess.iv

Subscribers: davide, llvm-commits

Differential Revision: https://reviews.llvm.org/D35003

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307754 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 06:19:10 +00:00
Jakub Kuderski
3b58ca74d3 [Dominators][NFC] Remove extra semicolon...
to silence a gcc warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307742 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 00:29:16 +00:00
Sam Clegg
c9c28d96fa [WebAssembly] Expose the offset of each data segment
Summary:
This allows tools like lld that process relocations
to apply data relocation correctly. This information
is required because relocation are stored as section
offset.

Subscribers: jfb, dschuff, jgravelle-google, aheejin

Differential Revision: https://reviews.llvm.org/D35234

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307741 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 00:24:54 +00:00
Rafael Espindola
210f522486 Simplify interface now that we don't need to pass IsPCRel. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307734 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 23:56:10 +00:00
Rafael Espindola
4aebf83110 Fully fix the movw/movt addend.
The issue is not if the value is pcrel. It is whether we have a
relocation or not.

If we have a relocation, the static linker will select the upper
bits. If we don't have a relocation, we have to do it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307730 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 23:18:25 +00:00
Jakub Kuderski
3f91c64c16 [Dominators] Use a custom DFS implementation
Summary:
Custom DFS implementation allows us to skip over certain nodes without adding them to the visited map, which is not easily doable with llvm's dfs iterators. What's more, caching predecessors becomes easy.

This patch implements a single DFS function (template) for both forward and reverse DFS, which should be easier to maintain then separate two ones.

Skipping over nodes based on a predicate will be necessary later to implement incremental updates.

There also seems to be a very slight performance improved when bootstrapping clang with this patch on my machine (3:28s -> 3:26s) .

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34651

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307727 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 22:55:04 +00:00
Konstantin Zhuravlyov
8f85685860 Enhance synchscope representation
OpenCL 2.0 introduces the notion of memory scopes in atomic operations to
  global and local memory. These scopes restrict how synchronization is
  achieved, which can result in improved performance.

  This change extends existing notion of synchronization scopes in LLVM to
  support arbitrary scopes expressed as target-specific strings, in addition to
  the already defined scopes (single thread, system).

  The LLVM IR and MIR syntax for expressing synchronization scopes has changed
  to use *syncscope("<scope>")*, where <scope> can be "singlethread" (this
  replaces *singlethread* keyword), or a target-specific name. As before, if
  the scope is not specified, it defaults to CrossThread/System scope.

  Implementation details:
    - Mapping from synchronization scope name/string to synchronization scope id
      is stored in LLVM context;
    - CrossThread/System and SingleThread scopes are pre-defined to efficiently
      check for known scopes without comparing strings;
    - Synchronization scope names are stored in SYNC_SCOPE_NAMES_BLOCK in
      the bitcode.

Differential Revision: https://reviews.llvm.org/D21723



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307722 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 22:23:00 +00:00
Reid Kleckner
5cc2236f0f [Support] - Add bad alloc error handler for handling allocation malfunctions
Summary:
Patch by Klaus Kretzschmar

We would like to introduce a new type of llvm error handler for handling
bad alloc fault situations.  LLVM already provides a fatal error handler
for serious non-recoverable error situations which by default writes
some error information to stderr and calls exit(1) at the end (functions
are marked as 'noreturn').

For long running processes (e.g. a server application), exiting the
process is not an acceptable option, especially not when the system is
in a temporary resource bottleneck with a good chance to recover from
this fault situation. In such a situation you would rather throw an
exception to stop the current compilation and try to overcome the
resource bottleneck. The user should be aware of the problem of throwing
an exception in bad alloc situations, e.g. you must not do any
allocations in the unwind chain. This is especially true when adding
exceptions in existing unfamiliar code (as already stated in the comment
of the current fatal error handler)

So the new handler can also be used to distinguish from general fatal
error situations where recovering is no option.  It should be used in
cases where a clean unwind after the allocation is guaranteed.

This patch contains:
- A report_bad_alloc function which calls a user defined bad alloc
  error handler. If no user handler is registered the
  report_fatal_error function is called. This function is not marked as
  'noreturn'.
- A install/restore_bad_alloc_error_handler to install/restore the bad
  alloc handler.
- An example (in Mutex.cpp) where the report_bad_alloc function is
  called in case of a malloc returns a nullptr.

If this patch gets accepted we would create similar patches to fix
corresponding malloc/calloc usages in the llvm code.

Reviewers: chandlerc, greened, baldrick, rnk

Reviewed By: rnk

Subscribers: llvm-commits, MatzeB

Differential Revision: https://reviews.llvm.org/D34753

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 16:45:30 +00:00
Daniel Sanders
599e6ee1eb [globalisel][tablegen] Change method of squashing unused variable warnings following post-commit comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307659 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 14:23:14 +00:00
Daniel Sanders
ec48fd1277 [globalisel][tablegen] Correct matching of intrinsic ID's.
TreePatternNode considers them to be plain integers but MachineInstr considers
them to be a distinct kind of operand.

The tweak to AArch64InstrInfo.td to produce a simple test case is a NFC for
everything except GlobalISelEmitter (confirmed by diffing the tablegenerated
files). GlobalISelEmitter is currently unable to infer the type of operands in
the Dst pattern from the operands in the Src pattern.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307634 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 08:57:29 +00:00
Hiroshi Inoue
0eb884f61d fix typos in comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307626 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 06:04:59 +00:00
NAKAMURA Takumi
e582c6f55e Revert r307581, "Avoid doing conservative phi checks in aliasSameBasePointerGEPs() if no phis have been visited yet."
It broke stage2 tests in selfhosting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307613 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 02:31:51 +00:00
David Blaikie
1b67e9a22a llvm-profdata: Improve memory usage by tuning SmallDenseMap size
This takes memory usage from 5.1GB to 970MB - it could go further by
using a small size of 2 instead of the default of 4, but given the
rather high cost of going over this limit by much, I figured a little
slosh would be worth the ~130MB of memory usage.

& this'll might not be such a big deal if we use a custom slab allocator
for the DenseMaps here anyway

While the vast majority (99.9%) of records use only 1 entry, the tuning
parameter to SmallDenseMap is the the number of buckets, not the number
of entries - so a small size of 1 wasn't useful, even for 1 element, it
would tip over into allocating (much, 64 slots worth) more space - none
of them ended up small.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307608 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 01:18:28 +00:00
Zachary Turner
c1422a59e8 [lld/pdb] Create an empty public symbol record stream.
This is part of the continuing effort to increase parity between
LLD and MSVC PDBs.  link still doesn't like our PDBs, so the most
obvious thing to check was whether adding an empty publics stream
would get it to do something else.  It still fails in the same way
but at least this removes one more variable from the equation.
The next logical step would be to try creating an empty globals
stream.

Differential Revision: https://reviews.llvm.org/D35224

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307598 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 22:40:20 +00:00
Joel Jones
6ed70a89d6 Doxygen formatting. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307597 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 22:11:50 +00:00
Zachary Turner
8a3ff6431f [lld/pdb] Add some basic linker module symbols.
Differential Revision: https://reviews.llvm.org/D35152

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307590 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 21:01:37 +00:00
Nirav Dave
c7acbe2ea6 Add DAG argument to canMergeStoresTo NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307583 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 20:25:54 +00:00
Farhana Aleen
b0d5344402 Avoid doing conservative phi checks in aliasSameBasePointerGEPs() if no phis have been visited yet.
Reviewers: Daniel Berlin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34478

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 20:15:40 +00:00
Dehao Chen
a569cab404 Use DenseMap instead std::map for GVSummaryMapTy.
Summary: This speeds-up thin-link by ~47% for large programs.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D35148

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307578 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 20:12:54 +00:00
Philip Pfaffe
19045617b3 [PM] Enable registration of out-of-tree passes with PassBuilder
Summary:
This patch adds a callback registration API to the PassBuilder,
enabling registering out-of-tree passes with it.

Through the Callback API, callers may register callbacks with the
various stages at which passes are added into pass managers, including
parsing of a pass pipeline as well as at extension points within the
default -O pipelines.

Registering utilities like `require<>` and `invalidate<>` needs to be
handled manually by the caller, but a helper is provided.

Additionally, adding passes at pipeline extension points is exposed
through the opt tool. This patch adds a `-passes-ep-X` commandline
option for every extension point X, which opt parses into pipelines
inserted into that extension point.

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: lksbhm, grosser, davide, mehdi_amini, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D33464

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 10:57:55 +00:00
David Blaikie
cb16061ea7 llvm-profdata: Reduce memory usage by using Error callback rather than member
Reduces llvm-profdata memory usage on a large profile from 7.8GB to 5.1GB.

The ProfData API now supports reporting all the errors/warnings rather
than only the first, though llvm-profdata ignores everything after the
first for now to preserve existing behavior. (if there's a desire for
other behavior, happy to implement that - but might be as well left for
a separate patch)

Reviewers: davidxl

Differential Revision: https://reviews.llvm.org/D35149

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307516 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 03:04:59 +00:00
Chandler Carruth
fe40a5a3de [PM] Fix a nasty bug in the new PM where we failed to properly
invalidation of analyses when merging SCCs.

While I've added a bunch of testing of this, it takes something much
more like the inliner to really trigger this as you need to have
partially-analyzed SCCs with updates at just the right time. So I've
added a direct test for this using the inliner and verifying the
domtree. Without the changes here, this test ends up finding a stale
dominator tree.

However, to handle this properly, we need to invalidate analyses
*before* merging the SCCs. After talking to Philip and Sanjoy about this
they convinced me this was the right approach. To do this, we need
a callback mechanism when merging SCCs so we can observe the cycle that
will be merged before the merge happens. This API update ended up being
surprisingly easy.

With this commit, the new PM passes the test-suite again. It hadn't
since MemorySSA was enabled for EarlyCSE as that also will find this bug
very quickly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 13:45:11 +00:00
Chandler Carruth
b86a95f1b6 [PM] Add unittesting of the call graph update logic with complex
dependencies between analyses.

This uncovers even more issues with the proxies and the splitting apart
of SCCs which are fixed in this patch. I discovered this while trying to
add more rigorous testing for a change I'm making to the call graph
update invalidation logic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307497 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 13:16:55 +00:00
Chandler Carruth
79b7faac96 [PM] Teach PreservedAnalyses to have an allInSet static factory
function template to simplify building a quick object with a set marked
as preserved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307493 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 07:23:27 +00:00
Craig Topper
eb41f6a345 [IR] Add Type::isIntOrIntVectorTy(unsigned) similar to the existing isIntegerTy(unsigned), but also works for vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307492 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 07:04:03 +00:00
Craig Topper
1060082924 [IR] Make use of Type::isPtrOrPtrVectorTy/isIntOrIntVectorTy/isFPOrFPVectorTy to shorten code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307491 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 07:04:00 +00:00
Chandler Carruth
cc60d7b17d [ADT] Add a default constructor and a bool conversion to function_ref.
The internal representation has a natural way to handle this and it
seems nicer than having to wrap this in an optional (with its own
separate flag).

This also matches how std::function works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 06:12:56 +00:00
Yuka Takahashi
fb5cc8884b [Bash-autocompletion] Auto complete cc1 options if -cc1 is specified
Summary:
We don't want to autocomplete flags whose Flags class has `NoDriverOption` when argv[1] is not `-cc1`.

Another idea for this implementation is to make --autocomplete a cc1
option and handle it in clang Frontend, by porting --autocomplete
handler from Driver to Frontend, so that we can handle Driver options
and CC1 options in unified manner.

Differential Revision: https://reviews.llvm.org/D34770

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-08 17:48:59 +00:00
Eric Beckmann
b618c820b0 Revert "Revert "Revert "Revert "Switch external cvtres.exe for llvm's own resource library.""""
This reverts commit 147f45ff24456aea59575fa4ac16c8fa554df46a.

Revert "Revert "Revert "Revert "Replace trivial use of external rc.exe by writing our own .res file.""""

This reverts commit 61a90a67ed54a1f0dfeab457b65abffa129569e4.

The patches were intially reverted because they were causing a failure
on CrWinClangLLD.  Unfortunately, this was done haphazardly and didn't
compile, so the revert was reverted again quickly to fix this.  One that
was done, the revert of the revert was itself reverted.  This allowed me
to finally fix the actual bug in r307452.  This patch re-enables the
code path that had originally been causing the bug, now that it (should)
be fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307460 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-08 03:06:10 +00:00
Eric Beckmann
ec7b3bff58 Add name offset flags, for parity with cvtres.exe.
Summary:
The original cvtres.exe sets the high bit when an identifier offset
points to a string.  Even though this is not mentioned in the spec, and
in fact does not seem to cause errors with most cases, for some reason
this causes a failure in Chromium where the new resource file is not
verified as a new version.  This patch sets this high bit flag, and also
adds a test case to check that the output of our library is always
identical to original cvtres.

Reviewers: zturner, ruiu

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35099

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307452 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 23:23:53 +00:00
Dehao Chen
b1f864a947 Increase the import-threshold for crtical functions.
Summary: For interative sample-pgo, if a hot call site is inlined in the profiling binary, we should inline it in before profile annotation in the backend. Before that, the compile phase first collects all GUIDs that needs to be imported and creates virtual "hot" call edge in the summary. However, "hot" is not good enough to guarantee the callsites get inlined. This patch introduces "critical" call edge, and assign much higher importing threshold for those edges.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, mehdi_amini, llvm-commits, eraman

Differential Revision: https://reviews.llvm.org/D35096

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 21:01:00 +00:00
Dehao Chen
59bf0ba318 Add sample PGO support to ThinLTO new pass manager.
Summary:
For SamplePGO + ThinLTO, because profile annotation is done twice at both PrepareForThinLTO pipeline and backend compiler, the following changes are needed at the PrepareForThinLTO phase to ensure the IR is not changed dramatically. Otherwise the profile annotation will be inaccurate in the backend compiler.

* disable hot-caller heuristic
* disable loop unrolling
* disable indirect call promotion

This will unblock the new PM testing for sample PGO (tools/clang/test/CodeGen/pgo-sample-thinlto-summary.c), which will be covered in another cfe patch.

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: sanjoy, mehdi_amini, Prazek, inglorion, llvm-commits

Differential Revision: https://reviews.llvm.org/D34895

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307437 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 20:53:10 +00:00
Craig Topper
9fec2431ce [PatternMatch] Implemenet m_SignMask using Constant::isMinSignedValue instead of doing splat detection and analyzing the resulting APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307433 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 19:56:23 +00:00
Craig Topper
7383d9c9fd [PatternMatch] Implement m_AnyZero using Constant::isZeroValue instead of ORing together isNullValue and isNegativeZeroValue. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 19:56:21 +00:00
Craig Topper
caa219e9a8 [PatternMatch] Implement m_One and m_AllOnes using Constant::isOneValue/isAllOnesValue instead of doing our own splat detection and checking the resulting APInt.
Should result in less compiled code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 19:56:20 +00:00
Craig Topper
8614bf0c87 [APInt] Add a fastpath for the single word case of isOneValue to match isNullValue, isAllOnesValue, etc. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307430 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 19:56:18 +00:00
Quentin Colombet
b8caa0933a [RegAllocFast] Add the proper initialize method to use the .mir infrastructure
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307427 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 19:25:42 +00:00
Zachary Turner
b85b70f834 Fix some differences between lld and MSVC generated PDBs.
A couple of things were different about our generated PDBs.

1) We were outputting the wrong Version on the PDB Stream.
   The version we were setting was newer than what MSVC is setting.
   It's not clear what the implications are, but we change LLD
   to use PdbImplVC70, as MSVC does.
2) For the optional debug stream indices in the DBI Stream, we
   were outputting 0 to mean "the stream is not present".  MSVC
   outputs uint16_t(-1), which is the "correct" way to specify
   that a stream is not present.  So we fix that as well.
3) We were setting the PDB Stream signature to 0.  This is supposed
   to be the result of calling time(nullptr).  Although this leads
   to non-deterministic builds, a better way to solve that is by
   having a command line option explicitly for generating a
   reproducible build, and have the default behavior of lld-link
   match the default behavior of link.

To test this, I'm making use of the new and improved `pdb diff`
sub command.  To make it suitable for writing tests against, I had
to modify the diff subcommand slightly to print less verbose output.
Previously it would always print | <column> | <value1> | <value2> |
which is quite verbose, and the values are fragile.  All we really
want to know is "did we produce the same value as link?"  So I added
command line options to print a single character representing the
result status (different, identical, equivalent), and another to
hide the value display.  Note that just inspecting the diff output
used to write the test, you can see some things that are obviously
wrong.  That is just reflective of the fact that this is the state
of affairs today, not that we're asserting that this is "correct".
We can use this as a starting point to discover differences, fix
them, and update the test.

Differential Revision: https://reviews.llvm.org/D35086

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307422 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 18:45:56 +00:00
Zachary Turner
3324d0bf04 [llvm-pdbutil] Improve diff mode.
We're getting to the point that some MS tools (e.g. DIA) can recognize
our PDBs but others (e.g. link.exe) cannot. I think the way forward is
to improve our tooling to help us find differences more easily. For
example, if we can compile the same program with clang-cl and cl and
have a tool tell us all the places where the PDBs differ, this could
tell us what we're doing wrong. It's tricky though, because there are a
lot of "benign" differences in a PDB. For example, if the string table
in one PDB consists of "foo" followed by "bar" and in the other PDB it
consists of "bar" followed by "foo", this is not necessarily a critical
difference, as long as the uses of these strings also refer to the
correct location. On the other hand, if the second PDB doesn't even
contain the string "foo" at all, this is a critical difference.

diff mode has been in llvm-pdbutil for quite a while, but because of the
above challenge along with some others, it's been hard to make it
useful. I think this patch addresses that. It looks for all the same
things, but it now prints the output in tabular format (carefully
formatted and aligned into tables and fields), and it highlights
critical differences in red, non-critical differences in yellow, and
identical fields in green.  This makes it easy to spot the places we
differ, and the general concept of outputting arbitrary fields in
tabular format can be extended to provide analysis into many of the
different types of information that show up in a PDB.

Differential Revision: https://reviews.llvm.org/D35039

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307421 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 18:45:37 +00:00
Daniel Jasper
9889fe2290 Fix uninitalized memory access introduced in r307350.
Found by MSAN :).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307383 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 10:23:13 +00:00
Rafael Espindola
ef8ed10be5 Reduce code duplication.
By addding a mapNameToDWARFSection we only need to check section names
in one place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307359 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 05:36:53 +00:00
Zachary Turner
5974613ee5 [PDB] Teach libpdb to write DBI Stream ECNames.
Based strictly on the name, this seems to have something to do
width edit & continue.  The goal of this patch has nothing to do
with supporting edit and continue though.  msvc link.exe writes
very basic information into this area even when *not* compiling
with support for E&C, and so the goal here is to bring lld-link
to parity.  Since we cannot know what assumptions standard tools
make about the content of PDB files, we need to be as close as
possible.

This ECNames data structure is a standard PDB string hash table.
link.exe puts a single string into this hash table, which is the
full path to the PDB file on disk.  It then references this string
from the module descriptor for the compiler generated `* Linker *`
module.

With this patch, lld-link will generate the exact same sequence of
bytes as MSVC link for this subsection for a given object file
input (as reported by `llvm-pdbutil bytes -ec`).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 05:04:36 +00:00
Lang Hames
7df94ee855 [Orc] Add missing return value (left out in r307350).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307354 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 03:22:57 +00:00
Matthias Braun
192187283c RegisterScavenging: Fix PR33687
When scavenging for a use in instruction MI, we will reload after
that instruction and hence cannot spill uses/defs of this instruction.

This fixes http://llvm.org/PR33687

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307352 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 03:02:18 +00:00
Matthias Braun
a819fad865 LiveRegUnits: Rename accumulateBackward()->accumulate()
Contrary to the stepForward()/stepBackward() method accumulate() doesn't
have a direction as defs, uses and clobbers all have the same effect.

Also improve the documentation comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307351 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 03:02:17 +00:00
Lang Hames
a81793582b [ORC] Errorize the ORC APIs.
This patch updates the ORC layers and utilities to return and propagate
llvm::Errors where appropriate. This is necessary to allow ORC to safely handle
error cases in cross-process and remote JITing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307350 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 02:59:13 +00:00
Sam Clegg
20bde08716 [WebAssembly] Support weak defined symbols
Model weakly defined symbols as symbols that are both
exports and imported and marked as weak. Local references
to the symbols refer to the import but the linker can
resolve this to the weak export if not strong symbol
is found at link time.

Differential Revision: https://reviews.llvm.org/D35029

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307348 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 02:01:29 +00:00
Sean Fertile
471398ffea Extend memcpy expansion in Transform/Utils to handle wider operand types.
Adds loop expansions for known-size and unknown-sized memcpy calls, allowing the
target to provide the operand types through TTI callbacks. The default values
for the TTI callbacks use int8 operand types and matches the existing behaviour
if they aren't overridden by the target.

Differential revision: https://reviews.llvm.org/D32536

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307346 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 02:00:06 +00:00
Wei Mi
8e52a552c3 [ConstHoisting] choose to hoist when frequency is the same.
The patch is to adjust the strategy of frequency based consthoisting:
Previously when the candidate block has the same frequency with the existing
blocks containing a const, it will not hoist the const to the candidate block.
For that case, now we change the strategy to hoist the const if only existing
blocks have more than one block member. This is helpful for reducing code size.

Differential Revision: https://reviews.llvm.org/D35084


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307328 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 22:32:27 +00:00
Lang Hames
513399718a [ORC] Add missing <memory> include for shared_ptr.
Accidentally left out of r307319.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 22:02:49 +00:00
Lang Hames
0125881b40 [ORC] Update GlobalMappingLayer::addModuleSet to addModule.
This layer was accidentally left out of r306166.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307319 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 21:33:48 +00:00
Chad Rosier
91054ccf0a [ValueTracking] Support icmps fed by 'and' and 'or'.
This patch adds support for handling some forms of ands and ors in
ValueTracking's isImpliedCondition API.

PR33611
https://reviews.llvm.org/D34901

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307304 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 20:00:25 +00:00
Aditya Nandakumar
3c86b1705b [GISel]: Enhance the MachineIRBuilder API
Allows the MachineIRBuilder APIs to directly create registers (based on
LLT or TargetRegisterClass) as well as accept MachineInstrBuilders
and implicitly converts to register(with getOperand(0).getReg()).

Eg usage:
LLT s32 = LLT::scalar(32);
auto C32 = Builder.buildConstant(s32, 32);
auto Tmp = Builder.buildInstr(TargetOpcode::G_SUB, s32, C32,
OtherReg);
auto Tmp2 = Builder.buildInstr(Opcode, DstReg,
Builder.buildConstant(s32, 31)); ....

Only a few methods added for now.

Reviewed by Tim

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307302 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 19:40:07 +00:00
David Blaikie
450ef2ab9d Prototype: Reduce llvm-profdata merge memory usage further
The InstrProfWriter already stores the name and hash of the record in
the nested maps it uses for lookup while merging - this data is
duplicated in the value within the maps.

Refactor the InstrProfRecord to use a nested struct for the counters
themselves so that InstrProfWriter can use this nested struct alone
without the name or hash duplicated there.

This work is incomplete, but enough to demonstrate the value (around a
50% decrease in memory usage for a large test case (10GB -> 5GB)).
Though most of that decrease is probably from removing the
SoftInstrProfError as well, but I haven't implemented a replacement for
it yet. (it needs to go with the counters, because the operations on the
counters - merging, etc, are where the failures are - unlike the
name/hash which are totally unused by those counter-related operations
and thus easy to split out)

Ongoing discussion about removing SoftInstrProfError as a field of the
InstrProfRecord is happening on the thread that added it - including
the possibility of moving back towards an earlier version of that
proposed patch that passed SoftInstrProfError through the various APIs,
rather than as a member of InstrProfRecord.

Reviewers: davidxl

Differential Revision: https://reviews.llvm.org/D34838

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307298 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 19:00:12 +00:00