1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

2216 Commits

Author SHA1 Message Date
Chandler Carruth
4ec346556c [LCG] Construct an actual call graph with call-edge SCCs nested inside
reference-edge SCCs.

This essentially builds a more normal call graph as a subgraph of the
"reference graph" that was the old model. This allows both to exist and
the different use cases to use the aspect which addresses their needs.
Specifically, the pass manager and other *ordering* constrained logic
can use the reference graph to achieve conservative order of visit,
while analyses reasoning about attributes and other properties derived
from reachability can reason about the direct call graph.

Note that this isn't necessarily complete: it doesn't model edges to
declarations or indirect calls. Those can be found by scanning the
instructions of the function if desirable, and in fact every user
currently does this in order to handle things like calls to instrinsics.
If useful, we could consider caching this information in the call graph
to save the instruction scans, but currently that doesn't seem to be
important.

An important realization for why the representation chosen here works is
that the call graph is a formal subset of the reference graph and thus
both can live within the same data structure. All SCCs of the call graph
are necessarily contained within an SCC of the reference graph, etc.

The design is to build 'RefSCC's to model SCCs of the reference graph,
and then within them more literal SCCs for the call graph.

The formation of actual call edge SCCs is not done lazily, unlike
reference edge 'RefSCC's. Instead, once a reference SCC is formed, it
directly builds the call SCCs within it and stores them in a post-order
sequence. This is used to provide a consistent platform for mutation and
update of the graph. The post-order also allows for very efficient
updates in common cases by bounding the number of nodes (and thus edges)
considered.

There is considerable common code that I'm still looking for the best
way to factor out between the various DFS implementations here. So far,
my attempts have made the code harder to read and understand despite
reducing the duplication, which seems a poor tradeoff. I've not given up
on figuring out the right way to do this, but I wanted to wait until
I at least had the system working and tested to continue attempting to
factor it differently.

This also requires introducing several new algorithms in order to handle
all of the incremental update scenarios for the more complex structure
involving two edge colorings. I've tried to comment the algorithms
sufficiently to make it clear how this is expected to work, but they may
still need more extensive documentation.

I know that there are some changes which are not strictly necessarily
coupled here. The process of developing this started out with a very
focused set of changes for the new structure of the graph and
algorithms, but subsequent changes to bring the APIs and code into
consistent and understandable patterns also ended up touching on other
aspects. There was no good way to separate these out without causing
*massive* merge conflicts. Ultimately, to a large degree this is
a rewrite of most of the core algorithms in the LCG class and so I don't
think it really matters much.

Many thanks to the careful review by Sanjoy Das!

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

llvm-svn: 261040
2016-02-17 00:18:16 +00:00
Craig Topper
62ff62909d Remove an unnecessary std::move to fix -Wpessimizing-move warning.
llvm-svn: 260931
2016-02-16 04:17:42 +00:00
Vedant Kumar
edda1d67ad [ADT] Add StringRef::{l,r}trim(char) overloads (NFC)
Add support for trimming a single kind of character from a StringRef.
This makes the common case of trimming null bytes much neater. It's also
probably a bit speedier too, since it avoids creating a std::bitset in
find_{first,last}_not_of.

llvm-svn: 260925
2016-02-16 01:48:39 +00:00
Amaury Sechet
c4e8893256 Kill LLVMAddTargetData
Summary: It's red, it's dead.

Reviewers: joker.eph, Wallbraker, echristo

Subscribers: llvm-commits, axw

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

llvm-svn: 260919
2016-02-16 00:22:02 +00:00
NAKAMURA Takumi
624565965f MITests: Update libdeps. llvm/Target/TargetOptions.h depends on MC.
llvm-svn: 260918
2016-02-16 00:17:56 +00:00
Matthias Braun
a9756e5294 unittests/MI: Add Core library reference
llvm-svn: 260915
2016-02-15 22:09:38 +00:00
Matthias Braun
bf680a3193 Fix typo in LiveIntervalTest
llvm-svn: 260907
2016-02-15 19:30:11 +00:00
Matthias Braun
45a7406c5e Add unittest for LiveIntervalAnalysis::handleMove()
llvm-svn: 260905
2016-02-15 19:25:34 +00:00
Keno Fischer
2e799f5e5e [Cloning] Clone every Function's Debug Info
Summary:
Export the CloneDebugInfoMetadata utility, which clones all debug info
associated with a function into the first module. Also use this function
in CloneModule on each function we clone (the CloneFunction entrypoint
already does this).

Without this, cloning a module will lead to DI quality regressions,
especially since r252219 reversed the Function <-> DISubprogram edge
(before we could get lucky and have this edge preserved if the
DISubprogram itself was, e.g. due to location metadata).

This was verified to fix missing debug information in julia and
a unittest to verify the new behavior is included.

Patch by Yichao Yu! Thanks!

Reviewers: loladiro, pcc
Differential Revision: http://reviews.llvm.org/D17165

llvm-svn: 260791
2016-02-13 02:04:29 +00:00
Matt Arsenault
b576160845 Add AMDGPU related triple vendors/OSes
As support expands to more runtimes, we'll need to
distinguish between more than just HSA and unknown.
This also lets us stop using unknown everywhere.

llvm-svn: 260790
2016-02-13 01:56:21 +00:00
Rong Xu
669262d490 [PGO] Add another interface for annotateValueSite
Add another interface to function annotateValueSite() which directly uses the
VauleData array.

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

llvm-svn: 260741
2016-02-12 21:36:17 +00:00
Argyrios Kyrtzidis
94fe44f7a0 [ADT] Revert the llvm/ADT/OptionSet.h header and unit test.
llvm-svn: 260714
2016-02-12 19:47:35 +00:00
Rafael Espindola
36d363a08a Delete the deprecated LLVMLinkModules.
llvm-svn: 260683
2016-02-12 15:28:45 +00:00
Argyrios Kyrtzidis
314b947efa [unittests/ADT] OptionSetTest: ifdef out for now a specific test that fails on MSVC.
llvm-svn: 260663
2016-02-12 07:50:01 +00:00
Argyrios Kyrtzidis
05cc472794 [unittests/ADT] OptionSetTest: ifdef out a part that fails to compile on MSVC.
llvm-svn: 260655
2016-02-12 05:52:37 +00:00
Argyrios Kyrtzidis
eaf4355f60 [ADT] Introduce ‘OptionSet’ in llvm/ADT headers, which is a utility class that makes it convenient to work with enumerators representing bit options.
llvm-svn: 260652
2016-02-12 02:48:26 +00:00
Tim Northover
49f7c6fb6b ARMv7k: use Cortex-A7 by default even for tvOS
Also actually test the default CPU from those triples.

llvm-svn: 260621
2016-02-11 23:49:08 +00:00
Jacques Pienaar
837592b498 [lanai] Add Lanai triple.
Add triple for the Lanai backend.

General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend".

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

llvm-svn: 260545
2016-02-11 17:16:20 +00:00
Rong Xu
9fde022792 [PGO] Make the number of records for each value site metada adjustable
The patch adds a parameter in annotateValueSite() to control the max number
of records written to the value profile meta data for each value site. The
default is kept as the current value of 3.

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

llvm-svn: 260450
2016-02-10 22:19:43 +00:00
Reid Kleckner
109dc763a3 Fix a -Wsign-compare in Support Path unittests
llvm-svn: 260418
2016-02-10 19:29:01 +00:00
Reid Kleckner
b554ce57f4 Silence some MSVC warnings about zero extending unsigned to void*
llvm-svn: 260413
2016-02-10 19:11:15 +00:00
Xinliang David Li
0c2d7cc3bc [PGO] fix prof symbol lookup bug
Patch by Rong Xu

The problem is exposed by intra-module indirect call promotion where
prof symtab is created from module which does not contain all symbols
from the program. With partial symtab, the result needs to be checked
more strictly.
 

llvm-svn: 260361
2016-02-10 06:36:55 +00:00
Lang Hames
5d09e23f7a [Orc] Add lazy-JITting support for i386.
This patch adds a new class, OrcI386, which contains the hooks needed to
support lazy-JITing on i386 (currently only for Pentium 2 or above, as the JIT
re-entry code uses the FXSAVE/FXRSTOR instructions).

Support for i386 is enabled in the LLI lazy JIT and the Orc C API, and
regression and unit tests are enabled for this architecture.

llvm-svn: 260338
2016-02-10 01:02:33 +00:00
Peter Collingbourne
54e8749794 WholeProgramDevirt: introduce.
This pass implements whole program optimization of virtual calls in cases
where we know (via bitset information) that the list of callees is fixed. This
includes the following:

- Single implementation devirtualization: if a virtual call has a single
  possible callee, replace all calls with a direct call to that callee.

- Virtual constant propagation: if the virtual function's return type is an
  integer <=64 bits and all possible callees are readnone, for each class and
  each list of constant arguments: evaluate the function, store the return
  value alongside the virtual table, and rewrite each virtual call as a load
  from the virtual table.

- Uniform return value optimization: if the conditions for virtual constant
  propagation hold and each function returns the same constant value, replace
  each virtual call with that constant.

- Unique return value optimization for i1 return values: if the conditions
  for virtual constant propagation hold and a single vtable's function
  returns 0, or a single vtable's function returns 1, replace each virtual
  call with a comparison of the vptr against that vtable's address.

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

llvm-svn: 260312
2016-02-09 22:50:34 +00:00
Xinliang David Li
e95e49766e Add comments to some tests
llvm-svn: 260200
2016-02-09 05:47:08 +00:00
Xinliang David Li
96970a064d Further reduce test overhead
llvm-svn: 260198
2016-02-09 05:36:57 +00:00
Nick Lewycky
6c9fb2428f Use std::forward to make ErrorOr<T> constructible from a value that has a user-defined conversion to T. No functionality change intended.
llvm-svn: 260196
2016-02-09 04:47:58 +00:00
Richard Smith
b4e9da2037 Remove TrailingObjects::operator delete. It's still suffering from
compiler-specific issues. Instead, repeat an 'operator delete' definition in
each derived class that is actually deleted, and give up on the static type
safety of an error when sized delete is accidentally used on a type derived
from TrailingObjects.

llvm-svn: 260190
2016-02-09 02:09:16 +00:00
Richard Smith
2b282a4b56 Re-commit r259942 (reverted in r260053) with a different workaround for the MSVC bug.
This fixes undefined behavior in C++14 due to the size of the object being
deleted being different from sizeof(dynamic type) when it is allocated with
trailing objects.

MSVC seems to have several bugs around using-declarations changing the access
of a member inherited from a base class, so use forwarding functions instead of
using-declarations to make TrailingObjects::operator delete accessible where
desired.

llvm-svn: 260180
2016-02-09 01:03:42 +00:00
David Blaikie
886bbb8e7b Simplify some expressions involving unique_ptr and ErrorOr
llvm-svn: 260179
2016-02-09 01:02:24 +00:00
Michael Zolotukhin
31609a52c9 Factor out UnrollAnalyzer to Analysis, and add unit tests for it.
Summary:
Unrolling Analyzer is already pretty complicated, and it becomes harder and harder to exercise it with usual IR tests, as with them we can only check the final decision: whether the loop is unrolled or not. This change factors this framework out from LoopUnrollPass to analyses, which allows to use unit tests.
The change itself is supposed to be NFC, except adding a couple of tests.

I plan to add more tests as I add new functionality and find/fix bugs.

Reviewers: chandlerc, hfinkel, sanjoy

Subscribers: zzheng, sanjoy, llvm-commits

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

llvm-svn: 260169
2016-02-08 23:03:59 +00:00
Adrian Prantl
3fb6e70cce Simplify this unittest.
Thanks to dblaikie for the suggestion!

llvm-svn: 260125
2016-02-08 19:13:15 +00:00
Adrian Prantl
2fe87b5f30 Add a unit test for r259973.
llvm-svn: 260111
2016-02-08 17:02:34 +00:00
Nico Weber
54e14a897a Revert 259942, r259943, r259948.
The Windows bots have been failing for the last two days, with:

FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe -c LLVMContextImpl.cpp
D:\buildslave\clang-x64-ninja-win7\llvm\lib\IR\LLVMContextImpl.cpp(137) :
    error C2248: 'llvm::TrailingObjects<llvm::AttributeSetImpl,
                                        llvm::IndexAttrPair>::operator delete' :
        cannot access private member declared in class 'llvm::AttributeSetImpl'
    TrailingObjects.h(298) : see declaration of
        'llvm::TrailingObjects<llvm::AttributeSetImpl,
                               llvm::IndexAttrPair>::operator delete'
    AttributeImpl.h(213) : see declaration of 'llvm::AttributeSetImpl'

llvm-svn: 260053
2016-02-07 20:09:18 +00:00
Richard Smith
2127c4d2a2 More workarounds for undefined behavior exposed when compiling in C++14 with
-fsized-deallocation. Disable sized deallocation for all objects derived from
TrailingObjects, as we expect the storage allocated for these objects to be
larger than the size of their dynamic type.

llvm-svn: 259942
2016-02-05 22:32:52 +00:00
Xinliang David Li
0afdede2aa [PGO] Add interfaces to annotate instr with VP data
Add interfaces to do value profile data IR annnotation
  and read. Needed by both FE and IR based PGO.

llvm-svn: 259813
2016-02-04 19:11:43 +00:00
Xinliang David Li
fa6cd53219 [PGO] Profile interface cleanup
- Remove unused valuemapper parameter
  - add totalcount optional parameter

llvm-svn: 259756
2016-02-04 05:29:51 +00:00
Reid Kleckner
0bfde8fac7 [unittests] Move TargetRegistry test from Support to MC
This removes the dependency from SupportTests to all of the LLVM
backends, and makes it link faster.

llvm-svn: 259705
2016-02-03 21:41:24 +00:00
Reid Kleckner
d66cb7f668 Silence -Wsign-conversion issue in ProgramTest.cpp
Unfortunately, ProgramInfo::ProcessId is signed on Unix and unsigned on
Windows, breaking the standard fix of using '0U' in the gtest
expectation.

llvm-svn: 259704
2016-02-03 21:41:12 +00:00
Joseph Tremoulet
6905486a9e [Unittest] Clean up formatting, NFC
Summary:
Use an early return to reduce indentation.
Remove unused local.

Reviewers: dblaikie, lhames

Subscribers: lhames, llvm-commits

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

llvm-svn: 259663
2016-02-03 17:11:24 +00:00
Xinliang David Li
f9d9bfe484 [PGO] Profile summary reader/writer support
With this patch, the profile summary data will be available in indexed
profile data file so that profiler reader/compiler optimizer can start
to make use of.

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

llvm-svn: 259626
2016-02-03 04:08:18 +00:00
Chandler Carruth
1906ef7bf0 [LCG] Build an edge abstraction for the LazyCallGraph and use it to
differentiate between indirect references to functions an direct calls.

This doesn't do a whole lot yet other than change the print out produced
by the analysis, but it lays the groundwork for a very major change I'm
working on next: teaching the call graph to actually be a call graph,
modeling *both* the indirect reference graph and the call graph
simultaneously. More details on that in the next patch though.

The rest of this is essentially a bunch of over-engineering that won't
be interesting until the next patch. But this also isolates essentially
all of the churn necessary to introduce the edge abstraction from the
very important behavior change necessary in order to separately model
the two graphs. So it should make review of the subsequent patch a bit
easier at the cost of making this patch seem poorly motivated. ;]

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

llvm-svn: 259463
2016-02-02 03:57:13 +00:00
Frederic Riss
1d92f7befd [MCDwarf] Fix encoding of line tables with weird custom parameters
With poorly chosen custom parameters, the line table encoding logic would
sometimes end up generating a special opcode bigger than 255, which is wrong.
The set of default parameters that LLVM uses isn't subject to this bug.

When carefully chosing the line table parameters, it's impossible to fall into the
corner case that this patch fixes. The standard however doesn't require that these
parameters be carefully chosen. And even if it did, we shouldn't generate broken
encoding.

Add a unittest for this specific encoding bug, and while at it, create some unit
tests for the encoding logic using different sets of parameters.

llvm-svn: 259334
2016-01-31 22:06:35 +00:00
Xinliang David Li
8023b69367 Further reduce test time
llvm-svn: 259285
2016-01-30 01:37:32 +00:00
Vedant Kumar
e1a3d86600 [Profiling] Add a -sparse mode to llvm-profdata merge
Add an option to llvm-profdata merge for writing out sparse indexed
profiles. These profiles omit InstrProfRecords for functions which are
never executed.

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

llvm-svn: 259258
2016-01-29 22:54:45 +00:00
Xinliang David Li
9d4377234c Improve test speed/trial 2
llvm-svn: 259253
2016-01-29 22:29:15 +00:00
Xinliang David Li
7af0af1bd5 Revert 259242, 259243 -- irrelvante changes pulled in
llvm-svn: 259244
2016-01-29 21:26:31 +00:00
Xinliang David Li
ce448a7fa3 Use range for loop
llvm-svn: 259243
2016-01-29 21:23:47 +00:00
Xinliang David Li
af68b79bbc Improve test speed (interchange loop, reducing padding)
llvm-svn: 259242
2016-01-29 21:13:55 +00:00
Matthias Braun
6b6916f5aa SmallPtrSetTest: More checks for the swap() testing
llvm-svn: 259152
2016-01-29 03:34:36 +00:00