1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

25594 Commits

Author SHA1 Message Date
Akira Hatanaka
a676a66323 [AttributeSet] Overload AttributeSet::addAttribute to reduce compile
time.

The new overloaded function is used when an attribute is added to a
large number of slots of an AttributeSet (for example, to function
parameters). This is much faster than calling AttributeSet::addAttribute
once per slot, because AttributeSet::getImpl (which calls
FoldingSet::FIndNodeOrInsertPos) is called only once per function
instead of once per slot.

With this commit, clang compiles a file which used to take over 22
minutes in just 13 seconds.

rdar://problem/23581000

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

llvm-svn: 254491
2015-12-02 06:58:49 +00:00
David Blaikie
3719678673 [llvm-dwp] Emit a rather fictional debug_cu_index
This is very rudimentary support for debug_cu_index, but it is enough to
allow llvm-dwarfdump to find the offsets for  contributions and
correctly dump debug_info.

It will need to actually find the real signature of the unit and build
the real hash table with the right number of buckets, as per the DWP
specification.

It will also need to be expanded to cover the tu_index as well.

llvm-svn: 254489
2015-12-02 06:21:34 +00:00
David Blaikie
4fd6a24d41 DebugInfo\DWARF: Privatize some accidentally public members
llvm-svn: 254488
2015-12-02 06:21:28 +00:00
Mehdi Amini
34766825ef Change ModuleLinker to take a set of GlobalValues to import instead of a single one
For efficiency reason, when importing multiple functions for the same Module,
we can avoid reparsing it every time.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 254486
2015-12-02 04:34:28 +00:00
Mehdi Amini
1909ee53b2 Modify FunctionImport to take a callback to load modules
When linking static archive, there is no individual module files to
load. Instead they can be mmap'ed and could be initialized from a
buffer directly. The callback provide flexibility to override the
scheme for loading module from the summary.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 254479
2015-12-02 02:00:29 +00:00
Xinliang David Li
c258245ddf Define member operator delete
For the struct with trailing objects, define
a member operator delete. Without this, the program
will fail when -fsized-deallocation option is used
where the wrong size will be passed to the global
delete operator.

llvm-svn: 254471
2015-12-01 23:05:27 +00:00
Xinliang David Li
5715dafdb5 [PGO] Add support for reading multiple versions of indexed profile format profile data
Profile readers using incompatible on-disk hash table format can now share the same 
implementation and interfaces. 

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

llvm-svn: 254458
2015-12-01 20:26:26 +00:00
Rafael Espindola
e3fda2ca99 Use references now that it is natural to do so.
The linker never takes ownership of a module or changes which module it
is refering to, making it natural to use references.

llvm-svn: 254449
2015-12-01 19:50:54 +00:00
Rafael Espindola
8c37192246 Delete dead code.
llvm-svn: 254436
2015-12-01 18:50:35 +00:00
Rafael Espindola
876cd0cb5e Use a forwarding constructor instead of an init method.
llvm-svn: 254435
2015-12-01 18:46:19 +00:00
Rafael Espindola
49b4ffd0b8 Delete the setModule method from the Linker.
It was only used from LTO for a debug feature, and LTO can just create
another linker.

It is pretty odd to have a method to reset the module in the middle of a
link. It would make IdentifiedStructTypes inconsistent with the Module
for example.

llvm-svn: 254434
2015-12-01 18:41:30 +00:00
Elena Demikhovsky
ce52715df6 Fixed a failure in cost calculation for vector GEP
Cost calculation for vector GEP failed with due to invalid cast to GEP index operand.
The bug is fixed, added a test.

http://reviews.llvm.org/D14976

llvm-svn: 254408
2015-12-01 12:08:36 +00:00
Yury Gribov
8eadab0fdb Introduce new @llvm.get.dynamic.area.offset.i{32, 64} intrinsics.
The @llvm.get.dynamic.area.offset.* intrinsic family is used to get the offset
from native stack pointer to the address of the most recent dynamic alloca on
the caller's stack. These intrinsics are intendend for use in combination with
@llvm.stacksave and @llvm.restore to get a pointer to the most recent dynamic
alloca. This is useful, for example, for AddressSanitizer's stack unpoisoning
routines.

Patch by Max Ostapenko.

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

llvm-svn: 254404
2015-12-01 11:40:55 +00:00
Oliver Stannard
c41a38aefa [ARM] Add ARMv8.2-A to TargetParser
Add ARMv8.2-A to TargetParser, so that it can be used by the clang
command-line options and the .arch directive.

Most testing of this will be done in clang, checking that the
command-line options that this enables work.

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

llvm-svn: 254400
2015-12-01 10:33:56 +00:00
Sanjoy Das
1a33637ac1 Introduce a range version of std::find, and use in SCEV
Reviewers: dblaikie, pcc

Subscribers: llvm-commits

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

llvm-svn: 254391
2015-12-01 07:49:27 +00:00
Sanjoy Das
e90f281076 Introduce a range version of std::any_of, and use it in SCEV
Reviewers: dblaikie, pcc

Subscribers: llvm-commits

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

llvm-svn: 254390
2015-12-01 07:49:23 +00:00
Cong Hou
5d51a489ae Replace all weight-based interfaces in MBB with probability-based interfaces, and update all uses of old interfaces.
(This is the second attempt to submit this patch. The first caused two assertion
 failures and was reverted. See https://llvm.org/bugs/show_bug.cgi?id=25687)

The patch in http://reviews.llvm.org/D13745 is broken into four parts:

1. New interfaces without functional changes (http://reviews.llvm.org/D13908).
2. Use new interfaces in SelectionDAG, while in other passes treat probabilities
as weights (http://reviews.llvm.org/D14361).
3. Use new interfaces in all other passes.
4. Remove old interfaces.

This patch is 3+4 above. In this patch, MBB won't provide weight-based
interfaces any more, which are totally replaced by probability-based ones.
The interface addSuccessor() is redesigned so that the default probability is
unknown. We allow unknown probabilities but don't allow using it together
with known probabilities in successor list. That is to say, we either have a
list of successors with all known probabilities, or all unknown
probabilities. In the latter case, we assume each successor has 1/N
probability where N is the number of successors. An assertion checks if the
user is attempting to add a successor with the disallowed mixed use as stated
above. This can help us catch many misuses.

All uses of weight-based interfaces are now updated to use probability-based
ones.


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

llvm-svn: 254377
2015-12-01 05:29:22 +00:00
Matthias Braun
c3639e325e RegisterPressure: Remove support for recede()/advance() at MBB boundaries
Nobody was checking the returnvalue of recede()/advance() so we can
simply replace this code with asserts.

llvm-svn: 254371
2015-12-01 04:20:04 +00:00
Matthias Braun
57f3cb5cfc RegisterPressure: There is no need to make getCurSlot() public
llvm-svn: 254370
2015-12-01 04:20:01 +00:00
Matthias Braun
d05b1a39de RegisterPressure: There is no need to make discoverLive{In|Out} public
llvm-svn: 254369
2015-12-01 04:19:58 +00:00
Hans Wennborg
6d0b969988 Revert r254348: "Replace all weight-based interfaces in MBB with probability-based interfaces, and update all uses of old interfaces."
and the follow-up r254356: "Fix a bug in MachineBlockPlacement that may cause assertion failure during BranchProbability construction."

Asserts were firing in Chromium builds. See PR25687.

llvm-svn: 254366
2015-12-01 03:49:42 +00:00
David Blaikie
0483eddbd1 [llvm-dwp] Initial partial prototype
This just concatenates the common DWP sections without doing any of the
fancy DWP things like:

1) update str_offsets
2) deduplicating strings
3) merging/creating cu/tu_index

Patches for these will follow shortly.

(also not sure about target triple/object file type for this tool - do I
really need a whole triple just to write an object file that contains
purely static/hardcoded bytes in each section? & I guess I should just
pick it based on the first input, maybe, rather than hardcoding for now
- but we only produce .dwo on ELF platforms with objcopy for now anyway)

llvm-svn: 254355
2015-12-01 00:48:39 +00:00
Evgeniy Stepanov
154021c8a2 [safestack] Protect byval function arguments.
Detect unsafe byval function arguments and move them to the unsafe
stack.

llvm-svn: 254353
2015-12-01 00:40:05 +00:00
Cong Hou
b228d0caa6 Replace all weight-based interfaces in MBB with probability-based interfaces, and update all uses of old interfaces.
The patch in http://reviews.llvm.org/D13745 is broken into four parts:

1. New interfaces without functional changes (http://reviews.llvm.org/D13908).
2. Use new interfaces in SelectionDAG, while in other passes treat probabilities
as weights (http://reviews.llvm.org/D14361).
3. Use new interfaces in all other passes.
4. Remove old interfaces.

This patch is 3+4 above. In this patch, MBB won't provide weight-based
interfaces any more, which are totally replaced by probability-based ones.
The interface addSuccessor() is redesigned so that the default probability is
unknown. We allow unknown probabilities but don't allow using it together
with known probabilities in successor list. That is to say, we either have a
list of successors with all known probabilities, or all unknown
probabilities. In the latter case, we assume each successor has 1/N
probability where N is the number of successors. An assertion checks if the
user is attempting to add a successor with the disallowed mixed use as stated
above. This can help us catch many misuses.

All uses of weight-based interfaces are now updated to use probability-based
ones.


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

llvm-svn: 254348
2015-12-01 00:02:51 +00:00
Paul Robinson
6a55b6dd41 Have 'optnone' respect the -fast-isel=false option.
This is primarily useful for debugging optnone v. ISel issues.

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

llvm-svn: 254335
2015-11-30 21:56:16 +00:00
Sanjoy Das
3f2c3a2acc [ADT] Fix typo in comment
llvm-svn: 254278
2015-11-30 01:24:17 +00:00
Sanjoy Das
edaa1479cf Fix out of bounds access in hasStructRetAttr
llvm-svn: 254273
2015-11-29 23:15:43 +00:00
Craig Topper
233dd30406 [X86] int_x86_avx2_permps and X86ISD::VPERMV should take an integer vector for its shuffle indices.
llvm-svn: 254269
2015-11-29 22:53:22 +00:00
Davide Italiano
85963c8ad6 [SimplifyLibCalls] Tranform log(pow(x, y)) -> y*log(x).
This one is enabled only under -ffast-math. There are cases where the
difference between the value computed and the correct value is huge
even for ffast-math, e.g. as Steven pointed out:

x = -1, y = -4
log(pow(-1), 4) = 0
4*log(-1) = NaN

I checked what GCC does and apparently they do the same optimization
(which result in the dramatic difference). Future work might try to
make this (slightly) less worse.

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

llvm-svn: 254263
2015-11-29 20:58:04 +00:00
Xinliang David Li
2f7575a9de Minor code cleanups
- Add const keyword
 - fix code comments
 - move forward decl to the common file

llvm-svn: 254244
2015-11-29 04:52:34 +00:00
Xinliang David Li
1c888b8d73 [PGO] Move value profile format related structures and APIs to common file
This is the last step to enable profile runtime to share the same value prof
data format and reader/writer code with llvm host tools. The VP related 
data structures are moved to a section in InstrProfData.inc enabled with macro
INSTR_PROF_VALUE_PROF_DATA, and common API implementations are enabled with
INSTR_PROF_COMMON_API_IMPL. There should be no functional change.

llvm-svn: 254235
2015-11-28 19:07:09 +00:00
Jonas Paulsson
4e06f54193 [Stack realignment] Handling of aligned allocas.
This patch implements dynamic realignment of stack objects for targets
with a non-realigned stack pointer. Behaviour in FunctionLoweringInfo
is changed so that for a target that has StackRealignable set to
false, over-aligned static allocas are considered to be variable-sized
objects and are handled with DYNAMIC_STACKALLOC nodes.

It would be good to group aligned allocas into a single big alloca as
an optimization, but this is yet todo.

SystemZ benefits from this, due to its stack frame layout.

New tests SystemZ/alloca-03.ll for aligned allocas, and
SystemZ/alloca-04.ll for "no-realign-stack" attribute on functions.

Review and help from Ulrich Weigand and Hal Finkel.

llvm-svn: 254227
2015-11-28 11:02:32 +00:00
Xinliang David Li
8167574a24 [PGO] Add return code for vp rt record init routine to indicate error condition
llvm-svn: 254220
2015-11-28 05:47:34 +00:00
Xinliang David Li
16f0d8f3a9 [PGO] Allow value profile writer interface to allocated target buffer
Raw profile writer needs to write all data of one kind in one continuous block,
so the buffer needs to be pre-allocated and passed to the writer method in
pieces for function profile data. The change adds the support for raw value data
writing.

llvm-svn: 254219
2015-11-28 05:37:01 +00:00
Xinliang David Li
c87d1d6b3e Function name cleanup (NFC)
llvm-svn: 254218
2015-11-28 05:06:00 +00:00
Xinliang David Li
7cdfa09575 [PGO] Extract VP data integrity check code into a helper function (NFC)
llvm-svn: 254217
2015-11-28 04:56:07 +00:00
Keno Fischer
39e3d1456f [autoconf] Fix MinGW build
This is the autoconf analog of r251201. I realize autoconf is
deprecated, but while it's in tree, it should at least be kept working.

Also add the deprecation message to configure.ac such that AutoRegen
actually picks ip up.

llvm-svn: 254215
2015-11-28 00:54:12 +00:00
Rafael Espindola
4a063d8813 Simplify the linking of recursive data.
Now the ValueMapper has two callbacks. The first one maps the
declaration. The ValueMapper records the mapping and then materializes
the body/initializer.

llvm-svn: 254209
2015-11-27 20:28:19 +00:00
Charlie Turner
18cf3a8580 [LoopVectorize] Use MapVector rather than DenseMap for MinBWs.
The order in which instructions are truncated in truncateToMinimalBitwidths
effects code generation. Switch to a map with a determinisic order, since the
iteration order over a DenseMap is not defined.

This code is not hot, so the difference in container performance isn't
interesting.

Many thanks to David Blaikie for making me aware of MapVector!

Fixes PR25490.

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

llvm-svn: 254179
2015-11-26 20:39:51 +00:00
Krzysztof Parzyszek
f494c1982c [Hexagon] Hexagon V60 HVX intrinsic defintions
Author: Ron Lieberman <ronl@codeaurora.org>
llvm-svn: 254165
2015-11-26 16:54:33 +00:00
Craig Topper
e404cbe233 [SelectionDAG] Add a SDTCisSameSizeAs type constraint that can be used to ensure vector widths match even if the element size and count don't.
llvm-svn: 254138
2015-11-26 07:02:18 +00:00
Craig Topper
4b764921f1 Add type constraints to masked_load/masked_store to ensure the mask vector has the same number of elements as the other vectors.
llvm-svn: 254137
2015-11-26 06:30:42 +00:00
Tom Stellard
814127be3e AMDGPU: Fix typo
llvm-svn: 254120
2015-11-26 02:04:11 +00:00
Sanjoy Das
99ca015392 [OperandBundles] Treat "deopt" operand bundles specially
Teach LLVM optimize to more precisely in the presence of "deopt" operand
bundles.  "deopt" operand bundles imply that the call they're attached
to is at least `readonly` (i.e. they don't imply clobber semantics), and
they don't capture their bundle operands.

llvm-svn: 254118
2015-11-26 01:16:05 +00:00
Tom Stellard
eb7e999b29 AMDGPU: Add llvm.amdgcn.dispatch.ptr intrinsic
Summary:
This returns a pointer to the dispatch packet, which can be used to load
information about the kernel dispach.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 254116
2015-11-26 00:43:29 +00:00
Xinliang David Li
df875576b5 Fix a typo introduced in previous patches
llvm-svn: 254112
2015-11-26 00:02:23 +00:00
Xinliang David Li
739b63a55d [PGO] Implement ValueProfiling Closure interfaces for runtime value profile data
This is one of the many steps to commonize value profiling support between profile
runtime and compiler/llvm tools.

After this change, profiler runtime now can share the same C APIs to do VP
serialization/deseriazation with LLVM host tools (and produces value data
in identical format between indexed and raw profile).

It is not yet enabled in profiler runtime yet.

Also added a unit test case to test runtime profile data serialization/deserialization
interfaces implemented using common closure code.

llvm-svn: 254110
2015-11-25 23:31:18 +00:00
Artyom Skrobov
3803dae0a6 Expose isXxxConstant() functions from SelectionDAGNodes.h (NFC)
Summary:
Many target lowerings copy-paste the code to test SDValues for known constants.
This code can instead be shared in SelectionDAG.cpp, and reused in the targets.

Reviewers: MatzeB, andreadb, tstellarAMD

Subscribers: arsenm, jyknight, llvm-commits

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

llvm-svn: 254085
2015-11-25 19:41:11 +00:00
Eric Christopher
5f84aed4f6 Fix some places where we were assuming that memory type had been legalized
to a simple type when lowering a truncating store of a vector type. In this
case for an EVT we'll return Expand as we should in all of the cases anyhow.

The testcase triggered at the one in VectorLegalizer::LegalizeOp, inspection
found the rest.

llvm-svn: 254061
2015-11-25 09:11:53 +00:00
Xinliang David Li
29597bc958 [PGO] Convert InstrProfRecord based serialization methods to use common C methods
1. Convert serialization methods using InstrProfRecord as source into C (impl)
   interfaces using Closure.
2. Reimplement InstrProfRecord serialization method to use new C interface
   as dummy wrapper. 

Now it is ready to implement wrapper for runtime value profile data.

(The new code need better source location -- but not changed in this patch to
 minimize diffs. )

llvm-svn: 254057
2015-11-25 06:23:38 +00:00
Xinliang David Li
960920a165 [PGO] convert a subset of C++ interfaces into C (for sharing) (NFC)
llvm-svn: 254056
2015-11-25 04:29:24 +00:00
Xinliang David Li
03ec0b37d7 Add missing documentation. (NFC)
llvm-svn: 254051
2015-11-25 01:13:44 +00:00
Sanjoy Das
dcc5bddb02 [OperandBundles] Extract duplicated code into a helper function, NFC
llvm-svn: 254047
2015-11-25 00:42:24 +00:00
Sanjoy Das
d16b4e5c5e [InstCombine] Don't drop operand bundles
Reviewers: majnemer

Subscribers: llvm-commits

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

llvm-svn: 254046
2015-11-25 00:42:19 +00:00
Rong Xu
c4f897c441 [PGO] Revert revision r254021,r254028,r254035
Revert the above revision due to multiple issues.

llvm-svn: 254040
2015-11-24 23:49:08 +00:00
Xinliang David Li
ddeee8f963 [PGO] Add mapper callback to interfaces retrieving value data for site (NFC)
This allows cleaner implementation and merging retrieving/mapping in
one pass.

llvm-svn: 254038
2015-11-24 23:36:52 +00:00
Rong Xu
025bf7be0c [PGO] MST based PGO instrumentation infrastructure
This patch implements a minimum spanning tree (MST) based instrumentation for
PGO. The use of MST guarantees minimum number of CFG edges getting
instrumented. An addition optimization is to instrument the less executed
edges to further reduce the instrumentation overhead. The patch contains both the
instrumentation and the use of the profile to set the branch weights.

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

llvm-svn: 254021
2015-11-24 21:31:25 +00:00
Cong Hou
c0bb26286b [X86] Fix several issues related to X86's psadbw instruction.
This patch fixes the following issues:

1. Fix the return type of X86psadbw: it should not be the same type of inputs.
   For vNi8 inputs the output should be vMi64, where M = N/8.
2. Fix the return type of int_x86_avx512_psad_bw_512 accordingly.
3. Fix the definiton of PSADBW, VPSADBW, and VPSADBWY accordingly.
4. Adjust the return type when building a DAG node of X86ISD::PSADBW type.
5. Update related tests.


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

llvm-svn: 254010
2015-11-24 19:51:26 +00:00
Xinliang David Li
9766247b4e [PGO] Introduce value profile data closure type.
The closure is designed to abstact away two types of value profile
data:
  - InstrProfRecord which is the primary data structure used to
    represent profile data in host tools (reader, writer, and profile-use)
  - value profile runtime data structure suitable to be used by C
    runtime library.
Both sources of data need to serialize to disk/memory-buffer in common
format: ValueProfData.

The abstraction allows compiler-rt's raw profiler writer to share
the same code with indexed profile writer.

llvm-svn: 254008
2015-11-24 19:21:15 +00:00
Xinliang David Li
620aee58f0 [PGO] Small interface change to be profile rt ready
Convert two C++ static member functions to be C APIs. This
is one of the many steps to get ready to share VP writer code
with profiler runtime. 

llvm-svn: 253999
2015-11-24 18:15:46 +00:00
Xinliang David Li
57937fbcb6 Minor refactor to make VP writing more efficient
llvm-svn: 253994
2015-11-24 17:03:24 +00:00
Krzysztof Parzyszek
ce2383b240 Add vector types for intrinsics
Author: Ron Lieberman <ronl@codeaurora.org>
llvm-svn: 253992
2015-11-24 16:28:14 +00:00
Krzysztof Parzyszek
450319e8a0 Add new vector types for 512-, 1024- and 2048-bit vectors
Those types are needed to implement instructions for Hexagon Vector
Extensions (HVX): 16x32, 16x64, 32x16, 32x32, 32x64, 64x8, 64x16,
64x32, 128x8, 128x16, 256x8, 512x1, and 1024x1.

llvm-svn: 253978
2015-11-24 13:07:35 +00:00
Cong Hou
5747eb82f8 Let SelectionDAG start to use probability-based interface to add successors.
The patch in http://reviews.llvm.org/D13745 is broken into four parts:

1. New interfaces without functional changes.
2. Use new interfaces in SelectionDAG, while in other passes treat probabilities
as weights.
3. Use new interfaces in all other passes.
4. Remove old interfaces.

This the second patch above. In this patch SelectionDAG starts to use
probability-based interfaces in MBB to add successors but other MC passes are
still using weight-based interfaces. Therefore, we need to maintain correct
weight list in MBB even when probability-based interfaces are used. This is
done by updating weight list in probability-based interfaces by treating the
numerator of probabilities as weights. This change affects many test cases
that check successor weight values. I will update those test cases once this
patch looks good to you.


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

llvm-svn: 253965
2015-11-24 08:51:23 +00:00
Mehdi Amini
2fe02188ef Add a FunctionImporter helper to perform summary-based cross-module function importing
Summary:
This is a helper to perform cross-module import for ThinLTO. Right now
it is importing naively every possible called functions.

Reviewers: tejohnson

Subscribers: dexonsmith, llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 253954
2015-11-24 06:07:49 +00:00
Mehdi Amini
53aa625845 Add findFunctionInfoList() accessor to FunctionInfoIndex.
Summary:
This allows to query for a function in the map without creating an
entry, allowing to use a const FunctionInfoIndex.

Reviewers: tejohnson

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 253953
2015-11-24 06:07:42 +00:00
Davide Italiano
44f68f6357 [DIE] Make DIE.h NDEBUG conditional-free.
Switch dump()/print() method definitions to LLVM_DUMP_METHOD instead.

llvm-svn: 253945
2015-11-24 02:21:43 +00:00
Xinliang David Li
baa2f77b42 Use make_unique [NFC]
llvm-svn: 253942
2015-11-24 00:32:00 +00:00
Xinliang David Li
02a0716447 Remove trailing space in comments
llvm-svn: 253941
2015-11-24 00:31:41 +00:00
Krzysztof Parzyszek
af76cac3cc Revert r253923.
Per Eric's request.

llvm-svn: 253928
2015-11-23 22:19:57 +00:00
Krzysztof Parzyszek
6c363eee43 Add new vector types for 512-, 1024- and 2048-bit vectors
Those types are needed to implement instructions for Hexagon Vector
Extensions (HVX): 16x32, 16x64, 32x16, 32x32, 32x64, 64x8, 64x16,
64x32, 128x8, 128x16, 256x8, 512x1, and 1024x1.

llvm-svn: 253923
2015-11-23 22:00:17 +00:00
Nathan Slingerland
a06290a805 [Support] Add optional argument to SaturatingAdd() and SaturatingMultiply() to indicate that overflow occurred
Summary: Adds the ability for callers to detect when saturation occurred on the result of saturating addition/multiplication.

Reviewers: davidxl, silvas, rsmith

Subscribers: llvm-commits

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

llvm-svn: 253921
2015-11-23 21:54:22 +00:00
Xinliang David Li
0f29a15199 [PGO] Add --text option for llvm-profdata show|merge commands
The new option is similar to the SampleProfile dump option.

- dump raw/indexed format into text profile format
- merge the profile and output into text profile format.

Note that Value Profiling data text format is not yet designed. 
That functionality will be added later.

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

llvm-svn: 253913
2015-11-23 20:47:38 +00:00
Teresa Johnson
c0ecb3ad3f [ThinLTO] Deduplicate function index loading into shared helper (NFC)
Add a shared helper routine to read the function index from a file
and create/return the function index object. Use it in llvm-link and
llvm-lto.

llvm-svn: 253903
2015-11-23 19:19:11 +00:00
Xinliang David Li
0b39dbc2f8 [PGO] Introduce alignment macro for instr-prof control data(NFC)
llvm-svn: 253893
2015-11-23 18:02:59 +00:00
Xinliang David Li
a6bd292bad Fix comment not allowed in C90
llvm-svn: 253880
2015-11-23 17:05:45 +00:00
Nathan Slingerland
3f093e190d [Support] Fix SaturatingMultiply<T>() to be correct (and fast), Re-enable Unit Tests
Summary:
This change fixes the SaturatingMultiply<T>() function template to not cause undefined behavior with T=uint16_t.
Thanks to Richard Smith's contribution, it also no longer requires an integer division.

Patch by Richard Smith.

Reviewers: silvas, davidxl

Subscribers: rsmith, davidxl, llvm-commits

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

llvm-svn: 253870
2015-11-23 15:33:43 +00:00
Xinliang David Li
4878e2f9f9 Move two Value Profiler data structs to InstrProfData.inc (NFC)
llvm-svn: 253848
2015-11-23 05:29:51 +00:00
Xinliang David Li
076c9c59a2 [PGO] Fix remaining bugs in ProfData template file (when used by compiler-rt)
1. move const qualifier out of raw header field type as runtime use of the header
   needs to initialze the fields
2. use C style casting for integer types.

llvm-svn: 253844
2015-11-23 03:49:07 +00:00
Mehdi Amini
b100a96489 Add const qualifier for FunctionInfoIndex in ModuleLinker and linkInModule() (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 253840
2015-11-23 01:59:16 +00:00
Mehdi Amini
60d59439ad Add const qualifier on FunctionInfoIndex::hasExportedFunctions() (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 253839
2015-11-23 01:59:12 +00:00
Benjamin Kramer
ddaab51a02 [SCEV] Simplify code. NFC.
llvm-svn: 253825
2015-11-22 17:27:27 +00:00
Krzysztof Parzyszek
56c6ad68a8 Revert r253810. The builds should be fine now.
llvm-svn: 253822
2015-11-22 16:13:51 +00:00
Krzysztof Parzyszek
73d3ee06e8 Avoid dependency between TableGen and CodeGen
Duplicate a few common definitions between DFAPacketizer.cpp and
DFAPacketizerEmitter.cpp to avoid including files from CodeGen
in TableGen.

llvm-svn: 253820
2015-11-22 15:20:19 +00:00
Xinliang David Li
0a6ec9cd2c [PGO] move names of runtime sections definitions to InstrProfData.inc
In profile runtime implementation for Darwin, Linux and FreeBSD, the
names of sections holding profile control/counter/naming data need
to be known by the runtime in order to locate the start/end of the
data. Moving the name definitions to the common file to specify the
connection.

llvm-svn: 253814
2015-11-22 05:42:31 +00:00
NAKAMURA Takumi
c91f2dd88f Temporary fix broken build.ninja after r253790.
FIXME: This can be reverted several hours later.

r253790 introduced cyclic deps around llvm-tblgen and it was affecting after reverting.

  ninja: error: dependency cycle: include/llvm/IR/Attributes.inc -> include/llvm/IR/Attributes.inc.tmp -> bin/llvm-tblgen -> utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/DFAPacketizerEmitter.cpp.o -> include/llvm/IR/Attributes.inc

It may be a ninja's bug.

FYI, renaming DFAPacketizerEmitter.cpp would be useless.

llvm-svn: 253810
2015-11-22 02:32:49 +00:00
Xinliang David Li
fc1d455417 [PGO] move raw magic and version def to InstrProfData.inc
These are shared definitions too. (NFC)

llvm-svn: 253809
2015-11-22 02:05:50 +00:00
Xinliang David Li
dde2bc76c3 [PGO] InstrProf Template file documentation change
Add more complete description of the content and structure
of the template file. Made the comment in C style to be
shared by C runtime. Also enhance the file structure so
that it can included as standalone header for common 
definitions.

llvm-svn: 253807
2015-11-22 01:51:31 +00:00
Xinliang David Li
241cfd4800 [PGO] Move Value Profile Kind to InstrProfData.inc
ValueProfKind value affects runtime data structure and
definition is shared between compiler-rt and LLVM.

llvm-svn: 253806
2015-11-22 01:39:07 +00:00
Xinliang David Li
b823f0597b [PGO] Define value profiling updater API signature in InstrProfData.inc (NFC)
llvm-svn: 253805
2015-11-22 00:22:07 +00:00
Rafael Espindola
9cb8841b77 Have a single way for creating unique value names.
We had two code paths. One would create names like "foo.1" and the other
names like "foo1".

For globals it is important to use "foo.1" to help C++ name demangling.
For locals there is no strong reason to go one way or the other so I
kept the most common mangling (foo1).

llvm-svn: 253804
2015-11-22 00:16:24 +00:00
Xinliang David Li
64fc4b9d72 [PGO] Move Raw Header def into template file InstrProfData.inc
To enable code sharing with compiler-rt (NFC)

llvm-svn: 253803
2015-11-22 00:06:39 +00:00
Teresa Johnson
2b4369dd03 [ThinLTO] Handle bitcode without function summary sections gracefully
Summary:
Several fixes to the handling of bitcode files without function summary
sections so that they are skipped during ThinLTO processing in llvm-lto
and the gold plugin when appropriate instead of aborting.

1 Don't assert when trying to add a FunctionInfo that doesn't have
  a summary attached.
2 Skip FunctionInfo structures that don't have attached function summary
  sections when trying to create the combined function summary.
3 In both llvm-lto and gold-plugin, check whether a bitcode file has
  a function summary section before trying to parse the index, and skip
  the bitcode file if it does not.
4 Fix hasFunctionSummaryInMemBuffer in BitcodeReader, which had a bug
  where we returned to early while looking for the summary section.

Also added llvm-lto and gold-plugin based tests for cases where we
don't have function summaries in the bitcode file. I verified that
either the first couple fixes described above are enough to avoid the
crashes, or fixes 1,3,4. But have combined them all here for added
robustness.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

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

llvm-svn: 253796
2015-11-21 21:55:48 +00:00
Simon Pilgrim
37096d919a [MachineInstrBuilder] Support for adding a ConstantPoolIndex MO with an additional offset.
MachineInstrBuilder::addDisp can already add an immediate or global address MO with an adjusted offset, this patch adds support for constant pool indices as well.

All remaining MO types still assert - there are a number of other types that could support adjusted offsets but I have no test cases at this time.

Required to fix a regression in D13988 found by Mikael Holmén during stress testing (test case attached).

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

llvm-svn: 253795
2015-11-21 21:42:26 +00:00
Krzysztof Parzyszek
3a2a5e0f60 Hexagon V60/HVX DFA scheduler support
Extended DFA tablegen to:
  - added "-debug-only dfa-emitter" support to llvm-tblgen

  - defined CVI_PIPE* resources for the V60 vector coprocessor

  - allow specification of multiple required resources
    - supports ANDs of ORs
    - e.g. [SLOT2, SLOT3], [CVI_MPY0, CVI_MPY1] means:
           (SLOT2 OR SLOT3) AND (CVI_MPY0 OR CVI_MPY1)

  - added support for combo resources
    - allows specifying ORs of ANDs
    - e.g. [CVI_XLSHF, CVI_MPY01] means:
           (CVI_XLANE AND CVI_SHIFT) OR (CVI_MPY0 AND CVI_MPY1)

  - increased DFA input size from 32-bit to 64-bit
    - allows for a maximum of 4 AND'ed terms of 16 resources

  - supported expressions now include:

    expression     => term [AND term] [AND term] [AND term]
    term           => resource [OR resource]*
    resource       => one_resource | combo_resource
    combo_resource => (one_resource [AND one_resource]*)

Author: Dan Palermo <dpalermo@codeaurora.org>

kparzysz: Verified AMDGPU codegen to be unchanged on all llc
tests, except those dealing with instruction encodings.

Reapply the previous patch, this time without circular dependencies.

llvm-svn: 253793
2015-11-21 20:00:45 +00:00
Krzysztof Parzyszek
daec852689 Revert r253790: it breaks all builds for some reason.
llvm-svn: 253791
2015-11-21 17:38:33 +00:00
Krzysztof Parzyszek
e1cf64ffc3 Hexagon V60/HVX DFA scheduler support
Extended DFA tablegen to:
  - added "-debug-only dfa-emitter" support to llvm-tblgen

  - defined CVI_PIPE* resources for the V60 vector coprocessor

  - allow specification of multiple required resources
    - supports ANDs of ORs
    - e.g. [SLOT2, SLOT3], [CVI_MPY0, CVI_MPY1] means:
           (SLOT2 OR SLOT3) AND (CVI_MPY0 OR CVI_MPY1)

  - added support for combo resources
    - allows specifying ORs of ANDs
    - e.g. [CVI_XLSHF, CVI_MPY01] means:
           (CVI_XLANE AND CVI_SHIFT) OR (CVI_MPY0 AND CVI_MPY1)

  - increased DFA input size from 32-bit to 64-bit
    - allows for a maximum of 4 AND'ed terms of 16 resources

  - supported expressions now include:

    expression     => term [AND term] [AND term] [AND term]
    term           => resource [OR resource]*
    resource       => one_resource | combo_resource
    combo_resource => (one_resource [AND one_resource]*)

Author: Dan Palermo <dpalermo@codeaurora.org>

kparzysz: Verified AMDGPU codegen to be unchanged on all llc
tests, except those dealing with instruction encodings.

llvm-svn: 253790
2015-11-21 17:23:52 +00:00
Rong Xu
c3cbbad5f2 Add some constantness to GetSuccessorNumber().
llvm-svn: 253733
2015-11-20 23:02:06 +00:00
Nathan Slingerland
aae398c96d [llvm-profdata] Add merge() to InstrProfRecord
Summary:
This change refactors two aspects of InstrProfRecord:

1) Add a merge() method to InstrProfRecord (previously InstrProfWriter combineInstrProfRecords()) in order to better encapsulate this functionality and to make the InstrProfRecord and SampleRecord APIs more consistent.

2) Make InstrProfRecord mergeValueProfData() a private method since it is only ever called internally by merge().

Reviewers: dnovillo, bogner, davidxl

Subscribers: silvas, vsk, llvm-commits

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

llvm-svn: 253695
2015-11-20 19:12:43 +00:00
Artyom Skrobov
418223d583 Avoid duplicate entry for cortex-a7 in the TargetParser (NFC)
Reviewers: t.p.northover, rengolin

Subscribers: aemerson, rengolin, llvm-commits

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

llvm-svn: 253676
2015-11-20 16:46:14 +00:00