Commit Graph

23622 Commits

Author SHA1 Message Date
Alexey Samsonov
05f725eb67 [DWARF parser] Make DWARF parser more robust against missing compile/type units.
DWARF standard claims that each compilation/type unit header in
.debug_info/.debug_types section must be followed by corresponding
compile/type unit DIE, possibly with its children. Two situations
are possible:

 * compile/type unit DIE is missing because DWARF producer failed to
   emit it.
 * DWARF parser failed to parse unit DIE correctly, for instance if it
   contains some unsupported attributes (see r237721, for instance).

In either of these cases, the library, and the tools that use it
(llvm-dwarfdump, llvm-symbolizer) should not crash. Insert appropriate
checks to protect against this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237733 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:54:32 +00:00
David Blaikie
b9b3fb261e [opaque pointer type] Provide a convenience function for creating direct CallInsts to Functions in IRBuilder
Might need a similar convenience in CallInst's ctor too, but we'll
see/will add it when it becomes useful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237731 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:47:12 +00:00
Alex Lorenz
e5a723675b Revert r237708 (MIR serialization) - incremental buildbots became unstable.
The incremental buildbots entered a pass-fail cycle where during the fail
cycle one of the tests from this commit fails for an unknown reason. I
have reverted this commit and will investigate the cause of this problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:41:28 +00:00
David Blaikie
94a1bbfebc [opaque pointer type] Provide the ability to pass an explicit type when creating a CallInst through IRBuilder
A use for this will be added to Clang shortly. I haven't hit the
specific cases I want to cleanup in LLVM just yet.

A utility that avoids the need for this in direct calls to
llvm::Functions will be added too - since in that case the type can be
retrieved from the llvm::Function directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237728 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:31:18 +00:00
Matthias Braun
dfc41dbcda MachineInstr: Remove unused parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237726 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:22:20 +00:00
Alexey Samsonov
4ca606f22f [DWARF parser] Add basic support for DWZ DWARF multifile extensions.
This change implements basic support for DWARF alternate sections
proposal: http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open

LLVM tools now understand new forms: DW_FORM_GNU_ref_alt and
DW_FORM_GNU_strp_alt, which are used as references to .debug_info and
.debug_str sections respectively, stored in a separate file, and
possibly shared between different executables / shared objects.

llvm-dwarfdump and llvm-symbolizer don't yet know how to access this
alternate debug file (usually pointed by .gnu_debugaltlink section),
but they can at lease properly parse and dump regular files, which
refer to it.

This change should fix crashes of llvm-dwarfdump and llvm-symbolizer on
files produced by running "dwz" tool. Such files are already installed
on some modern Linux distributions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237721 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 20:29:28 +00:00
Sanjoy Das
4d88c3ebad Dereferenceable, dereferenceable_or_null metadata for loads
Summary:
Introduce dereferenceable, dereferenceable_or_null metadata for loads
with the same semantic as corresponding attributes.

This patch depends on http://reviews.llvm.org/D9253

Patch by Artur Pilipenko!

Reviewers: hfinkel, sanjoy, reames

Reviewed By: sanjoy, reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237720 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 20:10:19 +00:00
Pete Cooper
4c8545c815 Remove unused MCExpr.h include from MCELF.h. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237717 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 19:20:02 +00:00
Pete Cooper
61386a4fe3 Remove unused MCRelocationInfo.h include from MCDisassembler.h. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237710 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 18:18:49 +00:00
Filipe Cabecinhas
27ca64f3d3 Change a reachable unreachable to a fatal error.
Summary:
Also tagged a FIXME comment, and added information about why it breaks.

Bug found using AFL fuzz.

Reviewers: rafael, craig.topper

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237709 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 18:18:10 +00:00
Alex Lorenz
328f462f3c MIR Serialization: print and parse LLVM IR using MIR format.
This commit is the initial commit for the MIR serialization project.
It creates a new library under CodeGen called 'MIR'. This new
library adds a new machine function pass that prints out the LLVM IR 
using the MIR format. This pass is then added as a last pass when a 
'stop-after' option is used in llc. The new library adds the initial 
functionality for parsing of MIR files as well. This commit also 
extends the llc tool so that it can recognize and parse MIR input files.

Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237708 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 18:17:39 +00:00
Pete Cooper
98fe1d290c Remove unused MachineLocation.h include from MCAsmInfo.h. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237707 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 17:59:09 +00:00
Pawel Bylica
ef3ec7c783 Revert "Avoid size_t -> unsigned conversion in MathExtras.h header. NFC".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237680 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 10:51:24 +00:00
Pawel Bylica
8fae893373 Avoid size_t -> unsigned conversion in MathExtras.h header. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237678 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 10:35:32 +00:00
Pawel Bylica
4a9771567e Fix getSwappedBytes for double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237673 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 08:44:15 +00:00
Tobias Grosser
d70b3aca8e Drop unnecessary ';' after namespace
The ';' was introduced in 237642. With it in place, we get a large number of
warnings in -pedantic mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237667 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 06:25:19 +00:00
Matthias Braun
42cff157db SelectionDAG: Cleanup and simplify FoldConstantArithmetic
This cleans up the FoldConstantArithmetic code by factoring out the case
of two ConstantSDNodes into an own function. This avoids unnecessary
complexity for many callers who already have ConstantSDNode arguments.

This also avoids an intermeidate SmallVector datastructure and a loop
over that datastructure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237651 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 01:40:21 +00:00
Pete Cooper
a641a4a89e Store intrinsic ID by value in Function instead of a string lookup. NFC.
On 64-bit targets, Function has 4-bytes of padding in its struct layout.

This uses the space for the intrinsic ID. It is set and recalculated whenever the function name is set.  This is similar to the current behavior which clears the function from the intrinsic ID cache when its renamed.

The intrinsic cache itself is removed as the only purpose was to speedup calls to getIntrinsicID() which now just reading the new field in the struct.

Reviewed by Duncan.  http://reviews.llvm.org/D9836

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237642 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 00:24:26 +00:00
Pete Cooper
d42228154f Move Function::lookupIntrinsicID to a static method. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 00:02:25 +00:00
David Blaikie
ff4ab44626 Revert "[opaque pointer type] Provide a convenience for IRBuilder::CreateCall that accepts a Function without needing to take an explicit callee Type"
Creates ambiguity in Clang callers. Reverting while I figure it out.

This reverts commit r237627.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237629 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:40:13 +00:00
David Blaikie
4d632b44e2 [opaque pointer type] Provide a convenience for IRBuilder::CreateCall that accepts a Function without needing to take an explicit callee Type
The common case is a direct call, so don't make all those users have to
explicitly pass the result of llvm::Function::getFunctionType.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237627 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:25:14 +00:00
David Blaikie
042dd34f9c Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237624 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:13:54 +00:00
Eric Christopher
300c594636 80-col fixup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237623 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:12:43 +00:00
Eric Christopher
847a488261 Fix grammar in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237622 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:12:41 +00:00
Filipe Cabecinhas
70a2c7260a Extract the load/store type verification to a separate function.
Summary:
Added isLoadableOrStorableType to PointerType.

We were doing some checks in some places, occasionally assert()ing instead
of telling the caller. With this patch, I'm putting all type checking in
the same place for load/store type instructions, and verifying the same
thing every time.

I also added a check for load/store of a function type.

Applied extracted check to Load, Store, and Cmpxcg.

I don't have exhaustive tests for all of these, but all Error() calls in
TypeCheckLoadStoreInst are being tested (in invalid.test).

Reviewers: dblaikie, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237619 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 21:48:55 +00:00
Benjamin Kramer
825a528bbe [YAML] Plug a memory leak
The destructor of BlockScalarNode is never called. Store the contained
string in BumpPtrAllocated memory instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237614 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 21:11:27 +00:00
Matthias Braun
e4603f0daf MachineInstr: Change return value of getOpcode() to unsigned.
This was previously returning int. However there are no negative opcode
numbers and more importantly this was needlessly different from
MCInstrDesc::getOpcode() (which even is the value returned here) and
SDValue::getOpcode()/SDNode::getOpcode().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 20:27:55 +00:00
Jim Grosbach
7b81f734ee MC: clang-format MCContext. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237595 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 18:43:23 +00:00
Jim Grosbach
19696daa21 MC: Clean up method names in MCContext.
The naming was a mish-mash of old and new style. Update to be consistent
with the new. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237594 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 18:43:14 +00:00
Sanjoy Das
0799eb1140 Exploit dereferenceable_or_null attribute in LICM pass
Summary:
Allow hoisting of loads from values marked with dereferenceable_or_null
attribute. For values marked with the attribute perform
context-sensitive analysis to determine whether it's known-non-null or
not.

Patch by Artur Pilipenko!

Reviewers: hfinkel, sanjoy, reames

Reviewed By: reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 18:07:00 +00:00
Jingyue Wu
2703007b7b [ScalarEvolution] refactor: extract interface getGEPExpr
Summary:
This allows other passes (such as SLSR) to compute the SCEV expression for an
imaginary GEP.

Test Plan: no regression

Reviewers: atrick, sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237589 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 17:03:25 +00:00
Hans Wennborg
febe7813c8 Fix llvm::BumpPtrAllocatorImpl::Reset()
BumpPtrAllocator's Reset wouldn't clear CustomSizedSlabs if Slabs.size() == 0.

Patch by Kal <b17c0de@gmail.com>!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237588 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:54:17 +00:00
Hal Finkel
292c78ba68 Preserve the order of READ_REGISTER and WRITE_REGISTER
At the present time, we don't have a way to represent general dependency
relationships, so everything is represented using memory dependency. In order
to preserve the data dependency of a READ_REGISTER on WRITE_REGISTER, we need
to model WRITE_REGISTER as writing (which we had been doing) and model
READ_REGISTER as reading (which we had not been doing). Fix this, and also the
way that the chain operands were generated at the SDAG level.

Patch by Nicholas Paul Johnson, thanks! Test case by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:42:10 +00:00
Adam Nemet
a4c8c9292b [LoopAccesses] If shouldRetryWithRuntimeCheck, reset InterestingDependences
When dependence analysis encounters a non-constant distance between
memory accesses it aborts the analysis and falls back to run-time checks
only.  In this case we weren't resetting the array of dependences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237574 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 15:37:03 +00:00
Elena Demikhovsky
1c21f2ef8c AVX-512: Added intrinsics for ADDSS/D, MULSS/D, SUBSS/D, DIVSS/D
instructions. These intrinsics are comming with rounding mode.
Added intrinsics for MAXSS/D, MINSS/D - with and without  sae.

By Asaf Badouh (asaf.badouh@intel.com)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237560 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 07:24:19 +00:00
Benjamin Kramer
11ba91f321 [WinEH] Push unique_ptr through the Action interface.
This was the source of many leaks in the past, this should fix them once and
for all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 15:40:03 +00:00
Benjamin Kramer
a0b851cb9c DenseMap: Remove poisoning of unused memory.
DenseMap has great support for catching invalidated iterators now so we can get
rid of this crude hack. Use after frees are covered by asan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237523 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 14:19:54 +00:00
Benjamin Kramer
8ef9968822 MC: Lower the default alignment of MCContext's operator new to 8
This is more than sufficient for all MC types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237522 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 13:54:08 +00:00
Daniel Sanders
f01f1c413a [x86] Distinguish the 'o', 'v', 'X', and 'i' inline assembly memory constraints.
Summary:
But still handle them the same way since I don't know how they differ on
this target.

Of these, 'o' and 'v' are not tested but were already implemented.

I'm not sure why 'i' is required for X86 since it's supposed to be an
immediate constraint rather than a memory constraint. A test asserts
without it so I've included it for now.

No functional change intended.

Reviewers: nadav

Subscribers: llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237517 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 12:09:54 +00:00
Duncan P. N. Exon Smith
57e32d40b7 MC: Use MCSymbol in RelAndSymbol, NFC
Switch from `MCSymbolData` to `MCSymbol`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237502 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 01:14:19 +00:00
Bill Schmidt
24f0469865 [PPC64] Add vector pack/unpack support from ISA 2.07
This patch adds support for the following new instructions in the
Power ISA 2.07:

  vpksdss
  vpksdus
  vpkudus
  vpkudum
  vupkhsw
  vupklsw

These instructions are available through the vec_packs, vec_packsu,
vec_unpackh, and vec_unpackl built-in interfaces.  These are
lane-sensitive instructions, so the built-ins have different
implementations for big- and little-endian, and the instructions must
be marked as killing the vector swap optimization for now.

The first three instructions perform saturating pack operations.  The
fourth performs a modulo pack operation, which means it can be
represented with a vector shuffle, and conversely the appropriate
vector shuffles may cause this instruction to be generated.  The other
instructions are only generated via built-in support for now.

Appropriate tests have been added.

There is a companion patch to clang for the rest of this support.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237499 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 01:02:12 +00:00
Duncan P. N. Exon Smith
9e6378de57 MC: Use MCSymbol in MCObject::IsSymbolRefDifferenceFullyResolvedImpl()
Transition one API from `MCSymbolData` to `MCSymbol`.  The function
needs both, and the backpointer from `MCSymbolData` to `MCSymbol` is
going away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237498 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 01:01:55 +00:00
Duncan P. N. Exon Smith
5f7c1f8415 MC: Change MCFragment::Atom to an MCSymbol, NFC
Change `MCFragment::Atom` from an `MCSymbolData` to an `MCSymbol`,
moving in the direction of removing the back-pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237497 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 00:48:58 +00:00
Duncan P. N. Exon Smith
a5bb842d95 MC: Change MCAssembler::Symbols to store MCSymbol, NFC
Instead of storing a list of the `MCSymbolData` in use, store the
`MCSymbol`s.  Churning in the direction of removing the back pointer
from `MCSymbolData`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237496 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 00:35:24 +00:00
Duncan P. N. Exon Smith
c5f2ba0401 MC: Merge MCSymbol and MCSymbolData
Turn `MCSymbolData` into a field inside of `MCSymbol`.  Keep all the old
API alive for now, so that consumers can be updated in a later commit.
This means we still temporarily need the back pointer from
`MCSymbolData` to `MCSymbol`, but I'll remove it in a follow-up.

This optimizes for object emission over assembly emission.  By removing
the `DenseMap` in `MCAssembler`, llc memory usage drops from around 1040
MB to 1001 MB (3.8%).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237490 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 00:03:06 +00:00
Duncan P. N. Exon Smith
b42b9f8563 MC: Move MCSymbolData to MCSymbol.h, NFC
Prepare for always including symbol data in MCSymbol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 00:03:00 +00:00
Duncan P. N. Exon Smith
6c16124807 MC: Change MCAssembler::Symbols to a vector
Instead of an intrusive double-linked linked list, use a
`std::vector<>`.  This saves a pointer per symbol and simplifies
`MCSymbolData`.  Otherwise, no functionality change here.

While I measured a memory drop from around 1047MB to 1040MB (0.6%) --
and this is a decent cleanup in its own right -- it's primarily a
preparation patch for merging `MCSymbol` and `MCSymbolData`.  I'll post
an updated patch for that to the list in a moment.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237487 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 22:56:01 +00:00
Duncan P. N. Exon Smith
eaf14f30c8 MC: Reduce MCAssembler::Symbols API exposure, NFC
Stop exposing the storage for `MCAssembler::Symbols`, and have
`MCAssembler` add symbols directly to its list instead of using a hook
in `MCSymbolData`.  This opens up room for a follow-up commit to switch
from a linked list to a vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237486 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 22:33:34 +00:00
Pete Cooper
fc9bfcd184 Remove MCAssembler.h include from MCStreamer.h and fix users of MCStreamer.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 22:19:42 +00:00
Pete Cooper
39aa893201 Remove 3 includes from MCInstrDesc.h and explicitly include them where needed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 21:58:42 +00:00