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

1938 Commits

Author SHA1 Message Date
Derek Schuff
499fede2fc Fix memory leak in unit test of Bitcode/BitReaderTest.cpp
Fixes obvious memory leak in test
TestForEofAfterReadFailureOnDataStreamer.  Also removes constexpr use
from same test.

Patch by Karl Schimpf.

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

llvm-svn: 243904
2015-08-03 21:23:51 +00:00
Lang Hames
f6229dbc63 [MCJIT] Fix a cast warning in the unit-test introduced in r243589.
Thanks to Aaron Ballman for spotting this.

llvm-svn: 243891
2015-08-03 18:03:40 +00:00
Derek Schuff
6203009638 Fix testing for end of stream in bitstream reader.
This fixes a bug found while working on the bitcode reader. In
particular, the method BitstreamReader::AtEndOfStream doesn't always
behave correctly when processing a data streamer. The method
fillCurWord doesn't properly set CurWord/BitsInCurWord if the data
streamer was already at eof, but GetBytes had not yet set the
ObjectSize field of the streaming memory object.

This patch fixes this problem, and provides a test to show that
this problem has been fixed.

Patch by Karl Schimpf.

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

llvm-svn: 243890
2015-08-03 18:01:50 +00:00
Duncan P. N. Exon Smith
87c77233df DI: Disallow uniquable DICompileUnits
Since r241097, `DIBuilder` has only created distinct `DICompileUnit`s.
The backend is liable to start relying on that (if it hasn't already),
so make uniquable `DICompileUnit`s illegal and automatically upgrade old
bitcode.  This is a nice cleanup, since we can remove an unnecessary
`DenseSet` (and the associated uniquing info) from `LLVMContextImpl`.

Almost all the testcases were updated with this script:

    git grep -e '= !DICompileUnit' -l -- test |
    grep -v test/Bitcode |
    xargs sed -i '' -e 's,= !DICompileUnit,= distinct !DICompileUnit,'

I imagine something similar should work for out-of-tree testcases.

llvm-svn: 243885
2015-08-03 17:26:41 +00:00
Duncan P. N. Exon Smith
a6c2e1e60b Linker: Move distinct MDNodes instead of cloning
Instead of cloning distinct `MDNode`s when linking in a module, just
move them over.  The module linker destroys the source module, so the
old node would otherwise just be leaked on the context.  Create the new
node in place.  This also reduces the number of cloned uniqued nodes
(since it's less likely their operands have changed).

This mapping strategy is only correct when we're discarding the source,
so the linker turns it on via a ValueMapper flag, `RF_MoveDistinctMDs`.

There's nothing observable in terms of `llvm-link` output here: the
linked module should be semantically identical.

I'll be adding more 'distinct' nodes to the debug info metadata graph in
order to break uniquing cycles, so the benefits of this will partly come
in future commits.  However, we should get some gains immediately, since
we have a fair number of 'distinct' `DILocation`s being linked in.

llvm-svn: 243883
2015-08-03 17:09:38 +00:00
Duncan P. N. Exon Smith
08a36a35c8 DI: Remove DW_TAG_arg_variable and DW_TAG_auto_variable
Remove the fake `DW_TAG_auto_variable` and `DW_TAG_arg_variable` tags,
using `DW_TAG_variable` in their place Stop exposing the `tag:` field at
all in the assembly format for `DILocalVariable`.

Most of the testcase updates were generated by the following sed script:

    find test/ -name "*.ll" -o -name "*.mir" |
    xargs grep -l 'DILocalVariable' |
    xargs sed -i '' \
      -e 's/tag: DW_TAG_arg_variable, //' \
      -e 's/tag: DW_TAG_auto_variable, //'

There were only a handful of tests in `test/Assembly` that I needed to
update by hand.

(Note: a follow-up could change `DILocalVariable::DILocalVariable()` to
set the tag to `DW_TAG_formal_parameter` instead of `DW_TAG_variable`
(as appropriate), instead of having that logic magically in the backend
in `DbgVariable`.  I've added a FIXME to that effect.)

llvm-svn: 243774
2015-07-31 18:58:39 +00:00
Duncan P. N. Exon Smith
80ade4fb4d DI: Rewrite the DIBuilder local variable API
Replace the general `createLocalVariable()` with two more specific
functions: `createParameterVariable()` and `createAutoVariable()`, and
rewrite the documentation.

Besides cleaning up the API, this avoids exposing the fake DWARF tags
`DW_TAG_arg_variable` and `DW_TAG_auto_variable` to frontends, and is
preparation for removing them completely.

llvm-svn: 243764
2015-07-31 17:55:53 +00:00
NAKAMURA Takumi
8d3f0a8c24 MCJITTests/MCJITCAPITest.cpp: Try to appease i686-win32.
llvm-svn: 243639
2015-07-30 13:06:53 +00:00
Matt Arsenault
591931d078 Add amdopencl environment to triple
This is used by the AMD x86 OpenCL implementation
to change some ABI details on Windows and Linux.

llvm-svn: 243627
2015-07-30 08:16:51 +00:00
Lang Hames
1dbdf92b9c [MCJIT] Fix a memory leak in a unit test that was introduced in r243589.
llvm-svn: 243609
2015-07-30 02:05:37 +00:00
Lang Hames
ccd56c36bb [MCJIT] Fix PR20656 by teaching MCJIT to honor ExecutionEngine's global mapping.
This is important for users of the C API who can't supply custom symbol
resolvers yet.

llvm-svn: 243589
2015-07-29 23:12:33 +00:00
Pete Cooper
37a409c394 Reapply "Add reverse(ContainerTy) range adapter."
This reverts commit r243567, which ultimately reapplies r243563.

The fix here was to use std::enable_if for overload resolution.  Thanks to David
Blaikie for lots of help on this, and for the extra tests!

Original commit message follows:

For cases where we needed a foreach loop in reverse over a container,
we had to do something like

 for (const GlobalValue *GV : make_range(TypeInfos.rbegin(),
                                         TypeInfos.rend())) {

This provides a convenience method which shortens this to

 for (const GlobalValue *GV : reverse(TypeInfos)) {

There are 2 versions of this, with a preference to the rbegin() version.

The first uses rbegin() and rend() to construct an iterator_range.

The second constructs an iterator_range from the begin() and end() methods
wrapped in std::reverse_iterator's.

Reviewed by David Blaikie.

llvm-svn: 243581
2015-07-29 22:19:09 +00:00
Pete Cooper
a0dfca2294 Revert "Add reverse(ContainerTy) range adapter."
This reverts commit r243563.

The GCC buildbots were extremely unhappy about this.  Reverting while
we discuss a better way of doing overload resolution.

llvm-svn: 243567
2015-07-29 20:29:10 +00:00
Pete Cooper
c43d5555e2 Add reverse(ContainerTy) range adapter.
For cases where we needed a foreach loop in reverse over a container,
we had to do something like

  for (const GlobalValue *GV : make_range(TypeInfos.rbegin(),
                                          TypeInfos.rend())) {

This provides a convenience method which shortens this to

  for (const GlobalValue *GV : reverse(TypeInfos)) {

There are 2 versions of this, with a preference to the rbegin() version.

The first uses rbegin() and rend() to construct an iterator_range.

The second constructs an iterator_range from the begin() and end() methods
wrapped in std::reverse_iterator's.

Reviewed by David Blaikie.

llvm-svn: 243563
2015-07-29 20:00:39 +00:00
Alex Lorenz
348b4a7c12 IR: Expose the method 'getLocalSlot' in the module slot tracker.
This commit publicly exposes the method 'getLocalSlot' in the
'ModuleSlotTracker' class.

This change is useful for MIR serialization, to serialize the unnamed basic
block and unnamed alloca references.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 243336
2015-07-27 22:31:04 +00:00
Duncan P. N. Exon Smith
44c2fb6ae2 DI: Fix unit tests after r243160
These always empty fields are gone, so don't test that they're empty.

llvm-svn: 243162
2015-07-24 21:11:06 +00:00
Chandler Carruth
2e896f4f08 [PM/AA] Extract the ModRef enums from the AliasAnalysis class in
preparation for de-coupling the AA implementations.

In order to do this, they had to become fake-scoped using the
traditional LLVM pattern of a leading initialism. These can't be actual
scoped enumerations because they're bitfields and thus inherently we use
them as integers.

I've also renamed the behavior enums that are specific to reasoning
about the mod/ref behavior of functions when called. This makes it more
clear that they have a very narrow domain of applicability.

I think there is a significantly cleaner API for all of this, but
I don't want to try to do really substantive changes for now, I just
want to refactor the things away from analysis groups so I'm preserving
the exact original design and just cleaning up the names, style, and
lifting out of the class.

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

llvm-svn: 242963
2015-07-22 23:15:57 +00:00
Daniel Berlin
e3f88c58ad Miscellaneous Fixes for SparseBitVector
Summary:

1. Fix return value in `SparseBitVector::operator&=`.
2. Add checks if SBV is being assigned is invoking SBV.

Reviewers: dberlin

Subscribers: llvm-commits

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

Committed on behalf of sl@

llvm-svn: 242693
2015-07-20 18:26:23 +00:00
Alex Lorenz
ef15081996 AsmParser: Add a function to parse a standalone constant value.
This commit extends the interface provided by the AsmParser library by adding a
function that allows the user to parse a standalone contant value.

This change is useful for MIR serialization, as it will allow the MIR Parser to
parse the constant values in a machine constant pool.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 242579
2015-07-17 22:07:03 +00:00
Lang Hames
27456ab028 [ExecutionEngine] Re-apply r241962 with fixes for ARM.
Patch by Pierre-Andre Saulais. Thanks Pierre-Andre!

llvm-svn: 242213
2015-07-14 22:11:10 +00:00
Renato Golin
ec04c2efbd Revert "[ExecutionEngine] Use std::function rather than a function pointer for the LazyFunctionCreator."
This reverts commit r241962, as it was breaking all ARM buildbots.

It also reverts the two subsequent related commits:

r241974: "[ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a warning."

r241973: "[ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for r241962."
llvm-svn: 241983
2015-07-11 13:42:48 +00:00
Lang Hames
ed1282388e [ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a
warning.

llvm-svn: 241974
2015-07-11 02:07:28 +00:00
Lang Hames
f7254a68ab [ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for
r241962.

llvm-svn: 241973
2015-07-11 01:59:04 +00:00
Lang Hames
e4a548dd26 [ExecutionEngine] Use std::function rather than a function pointer for the
LazyFunctionCreator.

Patch by Pierre-Andre Saulais. Thanks Pierre!

llvm-svn: 241962
2015-07-10 22:56:47 +00:00
James Molloy
4008b8e3dc Add support for fast-math flags to the FCmp instruction.
FCmp behaves a lot like a floating-point binary operator in many ways,
and can benefit from fast-math information. Flags such as nsz and nnan
can affect if this fcmp (in combination with a select) can be treated
as a fminnum/fmaxnum operation.

This adds backwards-compatible bitcode support, IR parsing and writing,
LangRef changes and IRBuilder changes. I'll need to audit InstSimplify
and InstCombine in a followup to find places where flags should be
copied.

llvm-svn: 241901
2015-07-10 12:52:00 +00:00
Benjamin Kramer
4475ed2091 [Triple] Add a helper to switch between big/little endian variants
This will be used from clang's driver.

llvm-svn: 241527
2015-07-06 23:58:14 +00:00
Pawel Bylica
87cf433a3d Change APInt comparison with uint64_t.
Summary:
This patch changes the way APInt is compared with a value of type uint64_t.
Before the uint64_t value was truncated to the size of APInt before comparison.
Now the comparison takes into account full 64-bit precision.

Test Plan: Unit tests added. No regressions. Self-hosted check-all done as well.

Reviewers: chandlerc, dexonsmith

Subscribers: llvm-commits

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

llvm-svn: 241204
2015-07-01 22:56:43 +00:00
Alexey Samsonov
8f755821c9 Fix memory leak in unittest added in r241101.
llvm-svn: 241123
2015-06-30 22:17:29 +00:00
David Majnemer
cd7100d557 [Cloning] Teach CloneModule about personality functions
CloneModule didn't take into account that it needed to remap the value
using values in the module.

This fixes PR23992.

llvm-svn: 241122
2015-06-30 22:14:01 +00:00
Alexey Samsonov
9ebbdedf37 [DebugInfo] Let IRBuilder::SetInsertPoint(BB::iterator) update current debug location.
IRBuilder::SetInsertPoint(BB, BB::iterator) is an older version of
IRBuilder::SetInsertPoint(Instruction). However, the latter updates
the current debug location of emitted instruction, while the former
doesn't, which is confusing.

Unify the behavior of these methods: now they both set current debug
location to the debug location of instruction at insertion point.

The callers of IRBuilder::SetInsertPoint(BB, BB::iterator) doesn't
seem to depend on the old behavior (keeping the original debug info
location). On the contrary, sometimes they (e.g. SCEV) *should* be
updating debug info location, but don't. I'll look at gdb bots after
the commit to check that we don't regress on debug info somewhere.

This change may make line table more fine-grained, thus increasing
debug info size. I haven't observed significant increase, though:
it varies from negligible to 0.3% on several binaries and self-hosted
Clang.

This is yet another change targeted at resolving PR23837.

llvm-svn: 241101
2015-06-30 19:07:20 +00:00
Dan Gohman
dfd1e4003d Drop the OS from the WebAssembly target triple for now.
This unbreaks TripleTest.Normalization. We'll have to come up with a new
plan for the OS component of the target triple for WebAssembly.

llvm-svn: 241041
2015-06-30 03:52:25 +00:00
Dan Gohman
e04339a4ce [WebAssembly] Initial WebAssembly backend
This WebAssembly backend is just a skeleton at this time and is not yet
functional.

llvm-svn: 241022
2015-06-29 23:51:55 +00:00
Adrian Prantl
cb1b7b7b80 Add a DIModule metadata node to the IR.
It is meant to be used to record modules @imported by the current
compile unit, so a debugger an import the same modules to replicate this
environment before dropping into the expression evaluator.

DIModule is a sibling to DINamespace and behaves quite similarly.
In addition to the name of the module it also records the module
configuration details that are necessary to uniquely identify the module.
This includes the configuration macros (e.g., -DNDEBUG), the include path
where the module.map file is to be found, and the isysroot.

The idea is that the backend will turn this into a DW_TAG_module.

http://reviews.llvm.org/D9614
rdar://problem/20965932

llvm-svn: 241017
2015-06-29 23:03:47 +00:00
Duncan P. N. Exon Smith
887179f82e IR: Expose ModuleSlotTracker in Value::print()
Allow callers of `Value::print()` and `Metadata::print()` to pass in a
`ModuleSlotTracker`.  This allows them to pay only once for calculating
module-level slots (such as Metadata).

This is related to PR23865, where there was a huge cost for
`MachineFunction::print()`.  Although I don't have a *particular* user
in mind for this new code, I have hit big slowdowns before when running
`opt -debug`, and I think this will be useful.  Going forward, if
someone hits a big slowdown with `print()` statements, they can create a
`ModuleSlotTracker` and send it through.  Similarly, adding support to
`Value::dump()` and `Metadata::dump()` should be trivial.

I added unit tests to be sure the `print()` functions actually behave
the same way with and without the slot tracker.

llvm-svn: 240867
2015-06-27 00:38:26 +00:00
Duncan P. N. Exon Smith
b8e0101e11 AsmPrinter: Use an intrusively linked list for DIE::Children
Replace the `std::vector<>` for `DIE::Children` with an intrusively
linked list.  This is a strict memory improvement: it requires no
auxiliary storage, and reduces `sizeof(DIE)` by one pointer.  It also
factors out the DIE-related malloc traffic.

This drops llc memory usage from 735 MB down to 718 MB, or ~2.3%.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

llvm-svn: 240736
2015-06-25 23:52:10 +00:00
Duncan P. N. Exon Smith
249d680189 AsmPrinter: Convert DIE::Values to a linked list
Change `DIE::Values` to a singly linked list, where each node is
allocated on a `BumpPtrAllocator`.  In order to support `push_back()`,
the list is circular, and points at the tail element instead of the
head.  I abstracted the core list logic out to `IntrusiveBackList` so
that it can be reused for `DIE::Children`, which also cares about
`push_back()`.

This drops llc memory usage from 799 MB down to 735 MB, about 8%.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

llvm-svn: 240733
2015-06-25 23:46:41 +00:00
Benjamin Kramer
c5f28c35c8 Don't use std::make_unique.
We still have to support C++11 standard libraries, make_unique is a C++14
feature.

llvm-svn: 240642
2015-06-25 13:47:36 +00:00
Joseph Tremoulet
8fc5afb15f [ORC] Add ObjectTransformLayer
Summary:
This is a utility for clients that want to insert a layer that modifies
each ObjectFile and then passes it along to the next layer.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

llvm-svn: 240640
2015-06-25 13:35:22 +00:00
Pawel Bylica
8b05f5ba5d Add missing <array> include.
llvm-svn: 240629
2015-06-25 10:47:08 +00:00
Pawel Bylica
91ca53a942 Express APInt::{s,u}{l,g}e(uint64_t) in terms of APInt::{s,u}{l,g}t(uint64_t). NFC.
This is preparation for http://reviews.llvm.org/D10655: Change APInt comparison with uint64_t.
Some unit tests added also.

llvm-svn: 240626
2015-06-25 10:23:52 +00:00
Alex Lorenz
1b3d959d3c ADTTests: merge #ifdef checks from r240436.
This commit merges the #ifdef and #ifndef checks into one #if, as
suggested by Duncan P. N. Exon Smith.

llvm-svn: 240553
2015-06-24 17:05:04 +00:00
Chandler Carruth
f46ea62013 [ADT] Teach DenseMap to support StringRef keys.
While often you want to use something specialized like StringMap, when
the strings already have persistent storage a normal densemap over them
can be more efficient.

This can't go into StringRef.h because of really obnoxious header chains
from the hashing code to the endian detection code to CPU feature
detection code to StringMap.

llvm-svn: 240528
2015-06-24 10:06:29 +00:00
Alex Lorenz
80dea2fad8 ADT: Add a string APSInt constructor.
This commit moves the APSInt initialization code that's used by
the LLLexer class into a new APSInt constructor that constructs
APSInts from strings.

This change is useful for MIR Serialization, as it would allow
the MILexer class to use the same APSInt initialization as 
LLexer when parsing immediate machine operands.

llvm-svn: 240436
2015-06-23 18:22:10 +00:00
Alex Lorenz
8eaa591b52 AsmParser: Extend the API to make the global value and metadata node slot mappings publicly accessible.
This commit creates a new structure called 'SlotMapping' in the AsmParser library.
This structure can be passed into the public parsing APIs from the AsmParser library
in order to extract the data structures that map from slot numbers to unnamed global
values and metadata nodes.

This change is useful for MIR Serialization, as the MIR Parser has to lookup the
unnamed global values and metadata nodes by their slot numbers.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 240427
2015-06-23 17:10:10 +00:00
Justin Bogner
03672666c5 InstrProf: Add a test for multiple copies of the same with different hashes
This functionality wasn't being tested.

Patch by Betul Buyukkurt.

llvm-svn: 240359
2015-06-22 23:56:53 +00:00
David Blaikie
5b0406bb13 Modify ParseArgs to return the InputArgList by value - there's no need for dynamic allocation/ownership here
The one caller that does anything other than keep this variable on the
stack is the single use of DerivedArgList in Clang, which is a bit more
interesting but can probably be cleaned up/simplified a bit further
(have DerivedArgList take ownership of the InputArgList rather than
needing to reference its Args indirectly) which I'll try to after this.

llvm-svn: 240345
2015-06-22 22:06:37 +00:00
David Blaikie
e3a1c91588 ArrayRef-ify ParseArgs
llvm-svn: 240233
2015-06-21 06:31:53 +00:00
Keno Fischer
dc411f550e [MCJIT] Add a FindGlobalVariableNamed utility
Summary: This adds FindGlobalVariableNamed to ExecutionEngine
(plus implementation in MCJIT), which is an analog of
FindFunctionNamed for GlobalVariables.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

llvm-svn: 240202
2015-06-20 00:55:58 +00:00
Tobias Grosser
56f89f8882 IRBuilder: Add unit tests for construction of globals with address space
This was forgotten in r240113. Thanks Eric for paying attention.

llvm-svn: 240124
2015-06-19 07:19:17 +00:00
Eric Christopher
0b2dfae3ba Fix "the the" in comments.
llvm-svn: 240112
2015-06-19 01:53:21 +00:00