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
Matthias Braun
a51e4b9705 SmallPtrSetTest: Check that iterators are still valid after erase()
llvm-svn: 259151
2016-01-29 03:34:34 +00:00
Reid Kleckner
52a5e5edf7 Reland "[CodeView] Use assembler directives for line tables"
This reverts commit r259126 and relands r259117.

This time with updated library dependencies.

llvm-svn: 259130
2016-01-29 00:49:42 +00:00
Reid Kleckner
5bd9b33ade Revert "[CodeView] Use assembler directives for line tables"
This reverts commit r259117.

The LineInfo constructor is defined in the codeview library and we have
to link against it now. Doing that isn't trivial, so reverting for now.

llvm-svn: 259126
2016-01-29 00:13:28 +00:00
Reid Kleckner
7cc33b4fa4 [CodeView] Use assembler directives for line tables
Adds a new family of .cv_* directives to LLVM's variant of GAS syntax:

- .cv_file: Similar to DWARF .file directives

- .cv_loc: Similar to the DWARF .loc directive, but starts with a
  function id. CodeView line tables are emitted by function instead of
  by compilation unit, so we needed an extra field to communicate this.
  Rather than overloading the .loc direction further, we decided it was
  better to have our own directive.

- .cv_stringtable: Emits the codeview string table at the current
  position. Currently this just contains the filenames as
  null-terminated strings.

- .cv_filechecksums: Emits the file checksum table for all files used
  with .cv_file so far. There is currently no support for emitting
  actual checksums, just filenames.

This moves the line table emission code down into the assembler.  This
is in preparation for implementing the inlined call site line table
format. The inline line table format encoding algorithm requires knowing
the absolute code offsets, so it must run after the assembler has laid
out the code.

David Majnemer collaborated on this patch.

llvm-svn: 259117
2016-01-28 23:31:52 +00:00
Elena Demikhovsky
532f2e9d69 Fixed compilation issue.
llvm-svn: 259087
2016-01-28 20:36:46 +00:00
Kevin Enderby
1a3115548c Fix identify_magic() to check that a file that starts with MH_MAGIC is
at least as big as the mach header to be identified as a Mach-O file and
make sure smaller files are not identified as a Mach-O files but as
unknown files. Also fix identify_magic() so it looks at all 4 bytes of
the filetype field when determining the type of the Mach-O file.
Then fix the macho-invalid-header test case to check that it is an
unknown file and make sure it does not get the error for
object_error::parse_failed.  And also update the unit tests.

llvm-svn: 258883
2016-01-26 23:43:37 +00:00
Reid Kleckner
cadb41690d Handle more edge cases in intrinsic name binary search
I tried to make the AMDGPU intrinsic info table use this instead of
another StringMatcher, and some issues arose.

llvm-svn: 258871
2016-01-26 22:33:19 +00:00
Chris Bieneman
1b8d4f74aa Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

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

llvm-svn: 258861
2016-01-26 21:29:08 +00:00
Eugene Zelenko
966902f532 Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes.
Differential revision: reviews.llvm.org/D16568

llvm-svn: 258831
2016-01-26 18:48:36 +00:00
Rafael Espindola
3bf30c1acf Add a test showing we can write a vector of floats.
llvm-svn: 258701
2016-01-25 19:02:20 +00:00
NAKAMURA Takumi
297ef6c65b ObjectTransformLayerTest.cpp: Rework r258633. [-Winconsistent-missing-override]
Sorry for the noise.

llvm-svn: 258635
2016-01-23 20:48:50 +00:00
NAKAMURA Takumi
bf43da04ea ObjectTransformLayerTest.cpp: Fix a warning. [-Wredundant-move]
llvm-svn: 258634
2016-01-23 20:45:55 +00:00
NAKAMURA Takumi
c4428c11d5 ObjectTransformLayerTest.cpp: Fix a warning. [-Winconsistent-missing-override]
llvm-svn: 258633
2016-01-23 20:45:50 +00:00
Joseph Tremoulet
59d64a8443 [ORC] Update ObjectTransformLayer signature
Summary:
Update ObjectTransformLayer::addObjectSet to take the object set by
value rather than reference and pass it to the base layer with move
semantics rather than copy, to match r258185's changes to
ObjectLinkingLayer.

Update the unit test to verify that ObjectTransformLayer's signature stays
in sync with ObjectLinkingLayer's.


Reviewers: lhames

Subscribers: llvm-commits

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

llvm-svn: 258630
2016-01-23 18:36:01 +00:00
Xinliang David Li
960dc56746 Revert 258486 -- for a better fix coming soon
llvm-svn: 258538
2016-01-22 19:53:31 +00:00
Rafael Espindola
c626c394ea Add ArrayRef support to EndianStream.
Using an array instead of ArrayRef would allow type inference, but
(short of using C99) one would still need to write

    typedef uint16_t VT[];
    LE.write(VT{0x1234, 0x5678});

llvm-svn: 258535
2016-01-22 19:44:46 +00:00
Xinliang David Li
c552031128 [PGO] add an interface needed by icall promotion
llvm-svn: 258509
2016-01-22 18:13:34 +00:00
Xinliang David Li
16253b4d49 [PGO] eliminate use of static variable
llvm-svn: 258486
2016-01-22 05:48:40 +00:00
Lang Hames
7bbae4dc58 [Orc] Try to turn Orc execution unit tests back on for Linux.
The fix in r258324 (plus r258354) should allow Orc execution tests to run on
Linux.

llvm-svn: 258358
2016-01-20 22:16:14 +00:00
Xinliang David Li
67f63b17f1 Fix a bug in test
llvm-svn: 258276
2016-01-20 02:49:53 +00:00
Xinliang David Li
8c526c0741 [PGO] Add a new interface to be used by Indirect Call Promotion
llvm-svn: 258271
2016-01-20 01:26:34 +00:00
Lang Hames
526cf61162 [Orc] Refactor ObjectLinkingLayer::addObjectSet to defer loading objects until
they're needed.

Prior to this patch objects were loaded (via RuntimeDyld::loadObject) when they
were added to the ObjectLinkingLayer, but were not relocated and finalized until
a symbol address was requested. In the interim, another object could be loaded
and finalized with the same memory manager, causing relocation/finalization of
the first object to fail (as the first finalization call may have marked the
allocated memory for the first object read-only).

By deferring the loadObject call (and subsequent memory allocations) until an
object file is needed we can avoid prematurely finalizing memory.

llvm-svn: 258185
2016-01-19 21:06:38 +00:00
Lang Hames
c6ee17b71b [Orc] Revert r258031 - it broke the builders.
llvm-svn: 258034
2016-01-18 01:51:51 +00:00
Lang Hames
2d38694617 [Orc] Expand a comment explaining a unit test.
llvm-svn: 258032
2016-01-18 01:00:19 +00:00
Lang Hames
c96132f0d0 [Orc] Enable ORC execution unit tests on non-windows platforms.
Previously these were Darwin-only. Since the switch to direct binary emission
of stubs, trampolines and resolver blocks, these should work on other *nix
platforms too.

These tests can be enabled on Windows once known issues with ORC's handling of
Windows symbol mangling (see e.g. https://llvm.org/PR25940) have been fixed.

llvm-svn: 258031
2016-01-18 00:47:25 +00:00
Joseph Tremoulet
314b93ff26 [InstructionsTest] delete via unique_ptr (NFC)
Summary:
Simplify the memory management of mock IR in test AlterInvokeBundles.


Reviewers: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 257892
2016-01-15 15:08:36 +00:00
Keno Fischer
13b300b864 [Verifier] Check parentage of GVs in dbg metadata
Summary:
Before this the Verifier didn't complain if the GlobalVariable
referenced from a DIGlobalVariable was not in fact in the correct
module (it would crash while writing bitcode though). Fix this by
always checking parantage of GlobalValues while walking constant
expressions and changing the DIGlobalVariable visitor to also
visit the constant it contains.

Reviewers: rafael
Differential Revision: http://reviews.llvm.org/D16059

llvm-svn: 257825
2016-01-14 22:42:02 +00:00
Keno Fischer
d180976ef4 [Verifier] Verify that a GlobalValue is only used in this Module
Summary:
We already have the inverse verification that we only use globals
that are defined in this module. This essentially catches the
same mistake, but when verifying the module that contains the
definition.

Reviewers: rafael
Differential Revision: http://reviews.llvm.org/D15272

llvm-svn: 257823
2016-01-14 22:20:56 +00:00
Rui Ueyama
dca64dbccc Update to use new name alignTo().
llvm-svn: 257804
2016-01-14 21:06:47 +00:00
NAKAMURA Takumi
4c6d639e0b InstructionsTest.cpp: Fix a warning. [-Wsign-compare]
llvm-svn: 257752
2016-01-14 09:21:49 +00:00
Joseph Tremoulet
6f341ceb23 [UnitTest] Fix warning, NFC.
Use an unsigned literal to avoid signedness mismatch in the compare.

llvm-svn: 257747
2016-01-14 06:30:19 +00:00
Joseph Tremoulet
b8804f1378 [OperandBundles] Copy DebugLoc with calls/invokes
Summary:
The overloads of CallInst::Create and InvokeInst::Create that are used to
adjust operand bundles purport to create a new instruction "identical in
every way except [for] the operand bundles", so copy the DebugLoc along
with everything else.


Reviewers: sanjoy, majnemer

Subscribers: majnemer, dblaikie, llvm-commits

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

llvm-svn: 257745
2016-01-14 06:21:42 +00:00
Michael Gottesman
b04f462e22 Fix PointerIntPair so that it can use an enum class as its integer template argument.
Summary:
The problem here is that an enum class can not be implicitly converted to an
integer. That assumption snuck back into PointerIntPair. This commit fixes the
issue and more importantly adds some unittests to make sure that we do not break
this again.

rdar://23594806

Reviewers: gribozavr

Subscribers: llvm-commits

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

llvm-svn: 257574
2016-01-13 05:59:13 +00:00
Nathan Slingerland
8932d29166 [Support] Add saturating multiply-add support function
Summary: Add SaturatingMultiplyAdd convenience function template since A + (X * Y) comes up frequently when doing weighted arithmetic.

Reviewers: davidxl, silvas

Subscribers: llvm-commits

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

llvm-svn: 257532
2016-01-12 22:34:00 +00:00
Sanjay Patel
eb6cf93f57 function names start with a lower case letter ; NFC
llvm-svn: 257496
2016-01-12 18:03:37 +00:00
Lang Hames
dac7e64ae5 [Orc] Add support for remote JITing to the ORC API.
This patch adds utilities to ORC for managing a remote JIT target. It consists
of:

1. A very primitive RPC system for making calls over a byte-stream.  See
RPCChannel.h, RPCUtils.h.

2. An RPC API defined in the above system for managing memory, looking up
symbols, creating stubs, etc. on a remote target. See OrcRemoteTargetRPCAPI.h.

3. An interface for creating high-level JIT components (memory managers,
callback managers, stub managers, etc.) that operate over the RPC API. See
OrcRemoteTargetClient.h.

4. A helper class for building servers that can handle the RPC calls. See
OrcRemoteTargetServer.h.

The system is designed to work neatly with the existing ORC components and
functionality. In particular, the ORC callback API (and consequently the
CompileOnDemandLayer) is supported, enabling lazy compilation of remote code.

Assuming this doesn't trigger any builder failures, a follow-up patch will be
committed which tests these utilities by using them to replace LLI's existing
remote-JITing demo code.

llvm-svn: 257305
2016-01-11 01:40:11 +00:00
Lang Hames
387a94a205 [RuntimeDyld] Add alignment arguments to the reserveAllocationSpace method of
RuntimeDyld::MemoryManager.

The RuntimeDyld::MemoryManager::reserveAllocationSpace method is called when
object files are loaded, and gives clients a chance to pre-allocate memory for
all segments. Previously only the size of each segment (code, ro-data, rw-data)
was supplied but not the alignment. This hasn't caused any problems so far, as
most clients allocate via the MemoryBlock interface which returns page-aligned
blocks. Adding alignment arguments enables finer grained allocation while still
satisfying alignment restrictions.

llvm-svn: 257294
2016-01-10 18:51:50 +00:00
NAKAMURA Takumi
e3f56c7faa OrcJITTests//ObjectLinkingLayerTest.cpp: Appease msc18's C2327. It seems definition of nested class would confuse the context.
llvm\unittests\ExecutionEngine\Orc\ObjectLinkingLayerTest.cpp(115) : error C2327: 'llvm::OrcExecutionTest::TM' : is not a type name, static, or enumerator
  llvm\unittests\ExecutionEngine\Orc\ObjectLinkingLayerTest.cpp(115) : error C2065: 'TM' : undeclared identifier

FYI, "this->TM" was valid even before moving class SectionMemoryManagerWrapper.

llvm-svn: 257290
2016-01-10 15:56:49 +00:00
Chandler Carruth
8bbd7bacc1 [ADT] Add an abstraction for embedding an integer within a pointer-like
type.

This makes it easy and safe to use a set of flags as one elmenet of
a tagged union with pointers. There is quite a bit of code that has
historically done this by casting arbitrary integers to "pointers" and
assuming that this was safe and reliable. It is neither, and has started
to rear its head by triggering safety asserts in various abstractions
like PointerLikeTypeTraits when the integers chosen are invariably poor
choices for *some* platform and *some* situation. Not to mention the
(hopefully unlikely) prospect of one of these integers actually getting
allocated!

With this, it will be straightforward to build type safe abstractions
like this without being error prone. The abstraction itself is also
remarkably simple thanks to the implicit conversion.

This use case and pattern was also independently created by the folks
working on Swift, and they're going to incrementally add any missing
functionality they find.

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

llvm-svn: 257284
2016-01-10 09:40:13 +00:00
Chandler Carruth
2cfc282af1 [ADT] Add a sum type abstraction for pointer-like types.
This is a much more general and powerful form of PointerUnion. It
provides a reasonably complete sum type (from type theory) for
pointer-like types. It has several significant advantages over the
existing PointerUnion infrastructure:

1) It allows more than two pointer types to participate without awkward
   nesting structures.
2) It directly exposes the tag so that it is convenient to write
   switches over the possible members.
3) It can re-use the same type for multiple tag values, something that
   has been worked around by either abusing PointerIntPair or defining
   nonce types and doing unsafe pointer casting.
4) It supports customization of the PointerLikeTypeTraits used for
   specific member types. This means it could (in theory) be used even
   with types that are over-aligned on allocation to expose larger
   numbers of bits to the tag.

All in all, I think it is at least complimentary to the existing
infrastructure, and a strict improvement for some use cases.

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

llvm-svn: 257282
2016-01-10 08:48:23 +00:00
Lang Hames
f1200209c6 [Orc][RuntimeDyld] Prevent duplicate calls to finalizeMemory on shared memory
managers.

Prior to this patch, recursive finalization (where finalization of one
RuntimeDyld instance triggers finalization of another instance on which the
first depends) could trigger memory access failures: When the inner (dependent)
RuntimeDyld instance and its memory manager are finalized, memory allocated
(but not yet relocated) by the outer instance is locked, and relocation in the
outer instance fails with a memory access error.

This patch adds a latch to the RuntimeDyld::MemoryManager base class that is
checked by a new method: RuntimeDyld::finalizeWithMemoryManagerLocking, ensuring
that shared memory managers are only finalized by the outermost RuntimeDyld
instance.

This allows ORC clients to supply the same memory manager to multiple calls to
addModuleSet. In particular it enables the use of user-supplied memory managers
with the CompileOnDemandLayer which must reuse the supplied memory manager for
each function that is lazily compiled.

llvm-svn: 257263
2016-01-09 19:50:40 +00:00
NAKAMURA Takumi
1732a996dc InstrProfTest.cpp: Fix a warning. [-Wsign-compare]
llvm-svn: 257157
2016-01-08 07:58:20 +00:00
Xinliang David Li
e2ec30b8bd Add value site truncation unit test
llvm-svn: 257153
2016-01-08 06:54:27 +00:00
Xinliang David Li
1561504810 [PGO] Ensure vp data in indexed profile always sorted
Done in  InstrProfWriter to eliminate the need for client
code to do the sorting. The operation is done once and reused 
many times so it is more efficient. Update unit test to remove
sorting. Also update expected output of affected tests.

llvm-svn: 257145
2016-01-08 05:45:21 +00:00
Xinliang David Li
2f2839b268 [PGO] Fix a bug in InstProfWriter addRecord
For a new record with weight != 1, only edge profiling
counters are scaled, VP data is not properly scaled.

This patch refactors the code and fixes the problem.
Also added sort by count interface (for follow up patch).

llvm-svn: 257143
2016-01-08 03:49:59 +00:00
Mehdi Amini
c074efe1c7 Fix crash when printing instructions that have a metadata attached but no parent.
Fix PR24852 (crash with -debug -instcombine)

Patch by Than McIntosh <thanm@google.com>

Summary:
Add guards to the asm writer to prevent crashing
when dumping an instruction that has no basic
block.

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

From: Than McIntosh <thanm@google.com>
llvm-svn: 257094
2016-01-07 20:14:30 +00:00
Teresa Johnson
ae16c1fff2 Add unittest for new CanReplace flag on MDNodes
This adds a unittest for the support added in r256648 to add
a flag that can be used to prevent RAUW on temporary metadata
used as a map key.

llvm-svn: 256938
2016-01-06 15:02:40 +00:00
Jordan Rose
cfdd350538 Add != to YAMLParser's basic_collection_iterator.
...and mark it as merely an input_iterator rather than a forward_iterator,
since it is destructive. And then rewrite == to take advantage of that.

Patch by Alex Denisov!

llvm-svn: 256913
2016-01-06 05:17:12 +00:00
Xinliang David Li
7c6ecf817a Add explicit string checks in test
llvm-svn: 256796
2016-01-04 23:59:14 +00:00
Dimitry Andric
0614f2a55e Fix several accidental DOS line endings in source files
Summary:
There are a number of files in the tree which have been accidentally checked in with DOS line endings.  Convert these to native line endings.

There are also a few files which have DOS line endings on purpose, and I have set the svn:eol-style property to 'CRLF' on those.

Reviewers: joerg, aaron.ballman

Subscribers: aaron.ballman, sanjoy, dsanders, llvm-commits

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

llvm-svn: 256707
2016-01-03 17:22:03 +00:00
Sanjay Patel
216791ca21 add FMF for CreateCall variant
The version with OpBundles was missed in:
http://reviews.llvm.org/rL255555

llvm-svn: 256674
2015-12-31 15:39:34 +00:00
Xinliang David Li
20f66720da [PGO]: Implement Func PGO name string compression
This is part of the effort/prepration to reduce the size
instr-pgo (object, binary, memory footprint, and raw data).

The functionality is currently off by default and not yet
used by any clients.

llvm-svn: 256667
2015-12-31 07:57:16 +00:00
Chandler Carruth
fdea2f9ee2 [ADT] Teach alignment helpers to work correctly for abstract classes.
This is necessary to use them as part of pointer traits and is generally
useful. I've added unit test coverage to isolate and ensure this works
correctly.

I'll watch the build bots to try to see if any compilers can't tolerate
this bit of magic (and much credit goes to Richard Smith for coming up
with this magical production!) but give a shout if you see issues.

llvm-svn: 256553
2015-12-29 09:52:41 +00:00
James Y Knight
37bdf9ea3e [TrailingObjects] Dynamically realign under-aligned trailing objects.
Previously, the code enforced non-decreasing alignment of each trailing
type. However, it's easy enough to allow for realignment as needed, and
thus avoid the developer having to think about the possiblilities for
alignment requirements on all architectures.

(E.g. on Linux/x86, a struct with an int64 member is 4-byte aligned,
while on other 32-bit archs -- and even with other OSes on x86 -- it has
8-byte alignment. This sort of thing is irritating to have to manually
deal with.)

llvm-svn: 256533
2015-12-29 04:00:43 +00:00
Chandler Carruth
60283c96ef [ADT] Use a nonce type with at least 4 byte alignment.
We didn't actually statically check this, and so it worked 25% of the
time for me. =/ Really sorry it took so long to fix, I shouldn't leave
the commit log editor window open without saving and landing the commit.
=[

llvm-svn: 256528
2015-12-29 00:03:24 +00:00
Chandler Carruth
37e9125e68 [ADT] Don't use a fixture just to get a nonce type for this unittest.
Instead, actually produce a nonce type in the test and use that. This
makes the test, IMO, both simpler and more clear.

llvm-svn: 256518
2015-12-28 20:03:16 +00:00
NAKAMURA Takumi
908789394c InstrProfTest.cpp: Don't assume string literals are always merged.
MSC18 Debug didn't merge them.

FIXME: I tweaked just to appease a builder. Almost string literals should be addressed identically there.
llvm-svn: 256459
2015-12-27 06:18:57 +00:00
Keno Fischer
1cc70943c8 [Function] Properly remove use when clearing personality
Summary:
We need to actually remove the use of the personality function,
otherwise we can run into trouble if we want to e.g. delete
the personality function because ther's no way to get rid of
its uses. Do this by resetting to ConstantPointerNull value
that the operands are set to when first allocated.

Reviewers: vsk, dexonsmith

Subscribers: llvm-commits

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

llvm-svn: 256345
2015-12-23 18:27:23 +00:00
Nico Weber
afef98ab38 Unbreak LLVM_ENABLE_THREADS=OFF builds.
llvm-svn: 256308
2015-12-23 01:04:53 +00:00
Vedant Kumar
d009174ba9 [unittest] Use Support/thread.h instead of <thread> (second try)
llvm-svn: 256292
2015-12-22 23:12:41 +00:00
Vedant Kumar
382072faf5 [unittest] Use Support/Thread.h instead of <thread> to fix the Windows build
llvm-svn: 256290
2015-12-22 23:09:08 +00:00
Vedant Kumar
4a1d86d7e2 [Support] Allow multiple paired calls to {start,stop}Timer()
Differential Revision: http://reviews.llvm.org/D15619

Reviewed-by: rafael
llvm-svn: 256258
2015-12-22 17:36:17 +00:00
Kostya Serebryany
8270e2df22 fix leak in a test, make the sanitizer bot green
llvm-svn: 256179
2015-12-21 19:09:01 +00:00
Mehdi Amini
a61b37683e ThreadPool unittests: do not hold mutex when calling condition_variable:notify()
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 256111
2015-12-19 22:56:24 +00:00
Xinliang David Li
2255d9f44f Improve InstrProfSymtab test coverage
llvm-svn: 256099
2015-12-19 18:20:09 +00:00
Vedant Kumar
f2199d9e59 [unittests] ThreadPool: Remove redundant loop, NFC
llvm-svn: 256097
2015-12-19 09:54:27 +00:00
Vedant Kumar
1060fa635e [unittests] ThreadPool: Guard updates to MainThreadReady
llvm-svn: 256096
2015-12-19 09:49:09 +00:00
Xinliang David Li
26f18dd6bb [PGO] Add hash to name mapping in InstrProfSymtab
Creator and lookup interfaces are added to this symtab class.
The new interfaces will be used by InstrProf Readers and writer.

A unit test is also added for the new APIs.

llvm-svn: 256092
2015-12-19 07:44:57 +00:00
Mehdi Amini
6c98bbb0ba ThreadPool unittest: reimplement concurrency test, deterministically this time.
Follow-up to r256056.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 256087
2015-12-19 05:12:07 +00:00
Teresa Johnson
1492e65cc6 Remove possibility of failures to due race in ThreadPool unittest
Remove all checks that required main thread to run faster than tasks in
ThreadPool, and yields which are now unnecessary. This should fix some
bot failures.

llvm-svn: 256056
2015-12-18 22:59:35 +00:00
James Y Knight
6a87ac0efb Rewrite the TrailingObjects template to provide two new features:
- Automatic alignment of the base type for the alignment requirements
   of the trailing types.

 - Support for an arbitrary numbers of trailing types, instead of only
   1 or 2, by using a variadic template implementation.

Upcoming commits to clang will take advantage of both of these features.

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

llvm-svn: 256054
2015-12-18 22:54:37 +00:00
Rafael Espindola
4fe057fd6e Drop support for dematerializing.
It was only used on lib/Linker and the use was "dead" since it was used on a
function the IRMover had just moved.

llvm-svn: 256019
2015-12-18 19:57:26 +00:00
Eric Christopher
359dea2a6b Reorganize the C API headers to improve build times.
Type specific declarations have been moved to Type.h and error handling
routines have been moved to ErrorHandling.h. Both are included in Core.h
so nothing should change for projects directly including the headers,
but transitive dependencies may be affected.

llvm-svn: 255965
2015-12-18 01:46:52 +00:00
NAKAMURA Takumi
aa1b085a4c BranchProbabilityTest.cpp: Suppress warnings. [-Wsign-compare]
llvm-svn: 255940
2015-12-18 00:18:18 +00:00
Cong Hou
72c4ebb415 [BranchProbability] Remove the restriction that known and unknown probabilities cannot coexist when being normalized.
The current BranchProbability::normalizeProbabilities() forbids known and
unknown probabilities to coexist in the list. This was once used to help
capture probability exceptions but has caused some reported build
failures (https://llvm.org/bugs/show_bug.cgi?id=25838).

This patch removes this restriction by evenly distributing the complement
of the sum of all known probabilities to unknown ones. We could still
treat this as an abnormal behavior, but it is better to emit warnings in
our future profile validator.


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

llvm-svn: 255934
2015-12-17 22:27:07 +00:00
Rafael Espindola
f7a0054c75 Change linkInModule to take a std::unique_ptr.
Passing in a std::unique_ptr should help find errors when the module
is used after being linked into another module.

llvm-svn: 255842
2015-12-16 23:16:33 +00:00
Nathan Slingerland
648ea4f74f [PGO] Handle and report overflow during profile merge for all types of data
Summary: Surface counter overflow when merging profile data. Merging still occurs on overflow but counts saturate to the maximum representable value. Overflow is reported to the user.

Reviewers: davidxl, dnovillo, silvas

Subscribers: llvm-commits

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

llvm-svn: 255825
2015-12-16 21:45:43 +00:00
Nathan Slingerland
b95c2eec31 [llvm-profdata] Add support for weighted merge of profile data (2nd try)
Summary:
This change adds support for specifying a weight when merging profile data with the llvm-profdata tool.
Weights are specified by using the --weighted-input=<weight>,<filename> option. Input files not specified
with this option (normal positional list after options) are given a default weight of 1.

Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the
input data from multiple training runs.

Both sampled and instrumented profiles are supported.

Reviewers: davidxl, dnovillo, bogner, silvas

Subscribers: silvas, davidxl, llvm-commits

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

llvm-svn: 255659
2015-12-15 17:37:09 +00:00
Mehdi Amini
d6deaf29d7 Mark ThreadPool unittests as unsupported on PowerPC64
Bots are crashing unexpectingly, see: https://llvm.org/bugs/show_bug.cgi?id=25829

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255633
2015-12-15 09:10:28 +00:00
Mehdi Amini
b327be8926 ThreadPool unittest: add a rough mechanism to mark UNSUPPORTED on a given platform
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255632
2015-12-15 09:10:25 +00:00
Cong Hou
011b64311c Replace the unit test of BranchProbability::normalizeEdgeWeights() with BranchProbability::normalizeProbabilities().
BranchProbability::normalizeEdgeWeights() is going to be retired soon.

llvm-svn: 255618
2015-12-15 05:25:27 +00:00
Teresa Johnson
ff38b7b132 Fix template parameter pack handling in ThreadPool
Fixes passing of template parameter pack via std::forward and add
unittest.

llvm-svn: 255617
2015-12-15 04:44:02 +00:00
Mehdi Amini
54fc055738 Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11
thread. It accepts any std::function<void()> for asynchronous
execution. Individual task can be synchronize using the returned
future, or the client can block on the full queue completion.

In case LLVM is configured with Threading disabled, it falls back
to sequential execution using std::async with launch:deferred.

This is intended to support parallelism for ThinLTO processing in
linker plugin, but is generic enough for any other uses.

This is a recommit of r255444 ; trying to workaround a bug in the
MSVC 2013 standard library. I think I was hit by:

 http://connect.microsoft.com/VisualStudio/feedbackdetail/view/791185/std-packaged-task-t-where-t-is-void-or-a-reference-class-are-not-movable

Recommit of r255589, trying to please g++ as well.

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

From: mehdi_amini <mehdi_amini@91177308-0d34-0410-b5e6-96231b3b80d8>
llvm-svn: 255593
2015-12-15 00:59:19 +00:00
Mehdi Amini
5acecbc1ec Revert "Add a C++11 ThreadPool implementation in LLVM"
This reverts commit r255589. Breaks g++

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255591
2015-12-15 00:42:44 +00:00
Mehdi Amini
dbdd929681 Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11
thread. It accepts any std::function<void()> for asynchronous
execution. Individual task can be synchronize using the returned
future, or the client can block on the full queue completion.

In case LLVM is configured with Threading disabled, it falls back
to sequential execution using std::async with launch:deferred.

This is intended to support parallelism for ThinLTO processing in
linker plugin, but is generic enough for any other uses.

This is a recommit of r255444 ; trying to workaround a bug in the
MSVC 2013 standard library. I think I was hit by:

 http://connect.microsoft.com/VisualStudio/feedbackdetail/view/791185/std-packaged-task-t-where-t-is-void-or-a-reference-class-are-not-movable

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255589
2015-12-15 00:38:05 +00:00
Rafael Espindola
5b397256de Use diagnostic handler in the LLVMContext
This patch converts code that has access to a LLVMContext to not take a
diagnostic handler.

This has a few advantages

* It is easier to use a consistent diagnostic handler in a single program.
* Less clutter since we are not passing a handler around.

It does make it a bit awkward to implement some C APIs that return a
diagnostic string. I will propose new versions of these APIs and
deprecate the current ones.

llvm-svn: 255571
2015-12-14 23:17:03 +00:00
Sanjay Patel
14a74b66f7 add fast-math-flags to 'call' instructions (PR21290)
This patch adds optional fast-math-flags (the same that apply to fmul/fadd/fsub/fdiv/frem/fcmp)
to call instructions in IR. Follow-up patches would use these flags in LibCallSimplifier, add 
support to clang, and extend FMF to the DAG for calls.

Motivating example:

%y = fmul fast float %x, %x
%z = tail call float @sqrtf(float %y)

We'd like to be able to optimize sqrt(x*x) into fabs(x). We do this today using a function-wide
attribute for unsafe-math, but we really want to trigger on the instructions themselves:

%z = tail call fast float @sqrtf(float %y)

because in an LTO build it's possible that calls with fast semantics have been inlined into a
function with non-fast semantics.

The code changes and tests are based on the recent commits that added "notail":
http://reviews.llvm.org/rL252368

and added FMF to fcmp:
http://reviews.llvm.org/rL241901

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

llvm-svn: 255555
2015-12-14 21:59:03 +00:00
David Majnemer
d1ffa4dc99 [ConstantFold] Fix bitcast to gep constant folding transform.
Make sure to check that the destination type is sized.
A check was present but was incorrectly checking the source type
instead.

Patch by Amaury SECHET!

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

llvm-svn: 255536
2015-12-14 19:30:32 +00:00
Nico Weber
c244167f92 Revert r255444.
It doesn't build on Windows and broke the Windows LLD and LLDB bots:
http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/27693/steps/build_Lld/logs/stdio
http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc/builds/13468/steps/build/logs/stdio

llvm-svn: 255446
2015-12-13 04:14:39 +00:00
Mehdi Amini
865fad06c6 Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11
thread. It accepts any std::function<void()> for asynchronous
execution. Individual task can be synchronize using the returned
future, or the client can block on the full queue completion.

In case LLVM is configured with Threading disabled, it falls back
to sequential execution using std::async with launch:deferred.

This is intended to support parallelism for ThinLTO processing in
linker plugin, but is generic enough for any other uses.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255444
2015-12-12 22:55:25 +00:00
Nathan Slingerland
5f9f1eadf1 [ProfileData] Add unit test infrastructure for sample profile reader/writer
Summary:
Adds support for in-memory round-trip of sample profile data along with basic
round trip unit tests. This will also make it easier to include unit tests for
future changes to sample profiling.

Reviewers: davidxl, dnovillo, silvas

Subscribers: llvm-commits

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

llvm-svn: 255264
2015-12-10 17:21:42 +00:00
Amjad Aboud
85f2758759 Macro debug info support in LLVM IR
Introduced DIMacro and DIMacroFile debug info metadata in the LLVM IR to support macros.

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

llvm-svn: 255245
2015-12-10 12:56:35 +00:00
Justin Bogner
610820950e IR: Make ConstantDataArray::getFP actually return a ConstantDataArray
The ConstantDataArray::getFP(LLVMContext &, ArrayRef<uint16_t>)
overload has had a typo in it since it was written, where it will
create a Vector instead of an Array. This obviously doesn't work at
all, but it turns out that until r254991 there weren't actually any
callers of this overload. Fix the typo and add some test coverage.

llvm-svn: 255157
2015-12-09 21:21:07 +00:00
Nathan Slingerland
3b35892e68 [Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for returning overflow state
Summary:
Improve SaturatingAdd()/SaturatingMultiply() to use bool * to optionally return overflow result.
This should make it clearer that the value is returned at callsites and reduces the size of the implementation.

Reviewers: davidxl, silvas

Subscribers: llvm-commits

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

llvm-svn: 255128
2015-12-09 17:11:28 +00:00
Rafael Espindola
f20bc23b7c Return a std::unique_ptr from CloneModule. NFC.
llvm-svn: 255078
2015-12-08 23:57:17 +00:00
Justin Bogner
5398821906 IR: Allow vectors of halfs to be ConstantDataVectors
Currently, vectors of halfs end up as ConstantVectors, but there isn't
a good reason they can't be ConstantDataVectors. This should save some
memory.

llvm-svn: 254991
2015-12-08 03:01:16 +00:00
Lang Hames
096bda3427 [Orc] Removing traces of takeOwnershipOfBuffers left after r251560.
Patch by Joshua Gerrard. Thanks Joshua!

llvm-svn: 254919
2015-12-07 17:35:56 +00:00
Teresa Johnson
4789ea589d [ThinLTO] Support cloning of temporary DILocation metadata
This is needed to support linking of module-level metadata as a
postpass after function importing, where we will be leaving temporary
metadata on imported instructions until the postpass metadata import.

Also added unittest. Split from D14838.

llvm-svn: 254914
2015-12-07 15:05:44 +00:00
Lang Hames
dde8f900ec [Orc] Rename IndirectStubsManagerBase to IndirectStubsManager.
No functional change.

llvm-svn: 254885
2015-12-06 19:44:45 +00:00
Lang Hames
c8c41976a3 [Orc] Move some code up into the JITCompileCallbackManager base class. NFC.
llvm-svn: 254778
2015-12-04 22:09:19 +00:00