oota-llvm.git
8 years agoFix a [-Werror,-Winconsistent-missing-override] problem in the
Eric Christopher [Tue, 28 Apr 2015 18:06:27 +0000 (18:06 +0000)]
Fix a [-Werror,-Winconsistent-missing-override] problem in the
NVPTX overrides.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236007 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoR600: Fix up for AsmPrinter's OutStreamer being a unique_ptr
Tom Stellard [Tue, 28 Apr 2015 17:37:03 +0000 (17:37 +0000)]
R600: Fix up for AsmPrinter's OutStreamer being a unique_ptr

Fixes a crash with basically any OpenGL application using the radeonsi
driver.

Patch by: Michel Dänzer

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90176
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236004 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoR600/SI: Add a lower case alias for subtarget feature: +DumpCode
Tom Stellard [Tue, 28 Apr 2015 17:37:00 +0000 (17:37 +0000)]
R600/SI: Add a lower case alias for subtarget feature: +DumpCode

llc converts all feature strings to lower case, while the LLVM C API
does not, so we need a lower case alias in order to test this with llc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236003 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[NVPTX] Handle addrspacecast constant expressions in aggregate initializers
Justin Holewinski [Tue, 28 Apr 2015 17:18:30 +0000 (17:18 +0000)]
[NVPTX] Handle addrspacecast constant expressions in aggregate initializers

We need to track if an AddrSpaceCast expression was seen when
generating an MCExpr for a ConstantExpr.  This change introduces a
custom lowerConstant method to the NVPTX asm printer that will create
NVPTXGenericMCSymbolRefExpr nodes at the appropriate places to encode
the information that a given symbol needs to be casted to a generic
address.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236000 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[opaque pointer type] Encode the allocated type of an alloca rather than its pointer...
David Blaikie [Tue, 28 Apr 2015 16:51:01 +0000 (16:51 +0000)]
[opaque pointer type] Encode the allocated type of an alloca rather than its pointer result type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235998 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agomove IR-level optimization flags into their own struct
Sanjay Patel [Tue, 28 Apr 2015 16:39:12 +0000 (16:39 +0000)]
move IR-level optimization flags into their own struct

This is a preliminary step to using the IR-level floating-point fast-math-flags in the SDAG (D8900).

In this patch, we introduce the optimization flags as their own struct. As noted in the TODO comment,
we should eventually share this data between the IR passes and the backend.

We also switch the existing nsw / nuw / exact bit functionality of the BinaryWithFlagsSDNode class to
use the new struct.

The tradeoff is that instead of using the free but limited space of SDNode's SubclassData, we add a
data member to the subclass. This means we don't have to repeat all of the get/set methods per flag,
but we're potentially adding size to all nodes of this subclassi type.

In practice on 64-bit systems (measured on Linux and MacOS X), there is no size difference between an
SDNode and BinaryWithFlagsSDNode after this change: they're both 80 bytes. This means that we had at
least one free byte to play with due to struct alignment.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235997 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse a std::vector to record the offsets of the sections. NFC.
Rafael Espindola [Tue, 28 Apr 2015 15:26:21 +0000 (15:26 +0000)]
Use a std::vector to record the offsets of the sections. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235995 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAvoid an extra loop for computing the section size. NFC.
Rafael Espindola [Tue, 28 Apr 2015 15:04:09 +0000 (15:04 +0000)]
Avoid an extra loop for computing the section size. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235994 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFixed crash of variable shift inst on AVX2
Elena Demikhovsky [Tue, 28 Apr 2015 14:46:35 +0000 (14:46 +0000)]
Fixed crash of variable shift inst on AVX2

https://llvm.org/bugs/show_bug.cgi?id=22955

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235993 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] [IAS] Do not generate redundant ORi in createLShiftOri.
Toma Tabacu [Tue, 28 Apr 2015 14:06:35 +0000 (14:06 +0000)]
[mips] [IAS] Do not generate redundant ORi in createLShiftOri.

Summary: If the immediate is 0, the ORi is pointless.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235990 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReapply r235977 "[DebugInfo] Add debug locations to constant SD nodes"
Sergey Dmitrouk [Tue, 28 Apr 2015 14:05:47 +0000 (14:05 +0000)]
Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes"

[DebugInfo] Add debug locations to constant SD nodes

This adds debug location to constant nodes of Selection DAG and updates
all places that create constants to pass debug locations
(see PR13269).

Can't guarantee that all locations are correct, but in a lot of cases choice
is obvious, so most of them should be. At least all tests pass.

Tests for these changes do not cover everything, instead just check it for
SDNodes, ARM and AArch64 where it's easy to get incorrect locations on
constants.

This is not complete fix as FastISel contains workaround for wrong debug
locations, which drops locations from instructions on processing constants,
but there isn't currently a way to use debug locations from constants there
as llvm::Constant doesn't cache it (yet). Although this is a bit different
issue, not directly related to these changes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235989 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse CIE version 4 for dwarf4.
Rafael Espindola [Tue, 28 Apr 2015 13:55:31 +0000 (13:55 +0000)]
Use CIE version 4 for dwarf4.

According to http://www.dwarfstd.org/doc/DWARF4.pdf appendix F the CIE
version for dwarf 4 is 4.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235988 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[DebugInfo] Add debug locations to constant SD nodes"
Daniel Jasper [Tue, 28 Apr 2015 13:38:35 +0000 (13:38 +0000)]
Revert "[DebugInfo] Add debug locations to constant SD nodes"

This breaks a test:
http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/23870

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235987 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] [IAS] Rename the createShiftOr function to createLShiftOri. NFC.
Toma Tabacu [Tue, 28 Apr 2015 13:16:06 +0000 (13:16 +0000)]
[mips] [IAS] Rename the createShiftOr function to createLShiftOri. NFC.

Summary: The new name is more accurate with regard to the functionality.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235984 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] [IAS] Store the expandLoadImm destination register in a variable. NFC.
Toma Tabacu [Tue, 28 Apr 2015 12:04:53 +0000 (12:04 +0000)]
[mips] [IAS] Store the expandLoadImm destination register in a variable. NFC.

Summary: This removes multiple calls to getReg() and saves us column space in the source file.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235978 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[DebugInfo] Add debug locations to constant SD nodes
Sergey Dmitrouk [Tue, 28 Apr 2015 11:56:37 +0000 (11:56 +0000)]
[DebugInfo] Add debug locations to constant SD nodes

This adds debug location to constant nodes of Selection DAG and updates
all places that create constants to pass debug locations
(see PR13269).

Can't guarantee that all locations are correct, but in a lot of cases choice
is obvious, so most of them should be. At least all tests pass.

Tests for these changes do not cover everything, instead just check it for
SDNodes, ARM and AArch64 where it's easy to get incorrect locations on
constants.

This is not complete fix as FastISel contains workaround for wrong debug
locations, which drops locations from instructions on processing constants,
but there isn't currently a way to use debug locations from constants there
as llvm::Constant doesn't cache it (yet). Although this is a bit different
issue, not directly related to these changes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235977 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAVX-512: Added "pandn" intrinsics set
Elena Demikhovsky [Tue, 28 Apr 2015 08:12:42 +0000 (08:12 +0000)]
AVX-512: Added "pandn" intrinsics set
by Asaf Badouh (asaf.badouh@intel.com)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235971 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMasked gather and scatter: Added code for SelectionDAG.
Elena Demikhovsky [Tue, 28 Apr 2015 07:57:37 +0000 (07:57 +0000)]
Masked gather and scatter: Added code for SelectionDAG.
All other patches, including tests will follow.

http://reviews.llvm.org/D7665

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235970 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[opaque pointer type] Encode the pointee type in the bitcode for 'cmpxchg'
David Blaikie [Tue, 28 Apr 2015 04:30:29 +0000 (04:30 +0000)]
[opaque pointer type] Encode the pointee type in the bitcode for 'cmpxchg'

As a space optimization, this instruction would just encode the pointer
type of the first operand and use the knowledge that the second and
third operands would be of the pointee type of the first. When typed
pointers go away, this assumption will no longer be available - so
encode the type of the second operand explicitly and rely on that for
the third.

Test case added to demonstrate the backwards compatibility concern,
which only comes up when the definition of the second operand comes
after the use (hence the weird basic block sequence) - at which point
the type needs to be explicitly encoded in the bitcode and the record
length changes to accommodate this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235966 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MC] Use LShr for constant evaluation of ">>" on ELF/arm64--darwin.
Ahmed Bougacha [Tue, 28 Apr 2015 01:37:11 +0000 (01:37 +0000)]
[MC] Use LShr for constant evaluation of ">>" on ELF/arm64--darwin.

This matches other assemblers and is less unexpected (e.g. PR23227).
On ELF, I tried binutils gas v2.24 and nasm 2.10.09, and they both
agree on LShr.  On COFF, I couldn't get my hands on an assembler yet,
so don't change the behavior.  For now, don't change it on non-AArch64
Darwin either, as the other assembler is gas v1.38, which does an AShr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235963 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDebugInfo: Support up to 2^16 arguments in a subprogram
Duncan P. N. Exon Smith [Tue, 28 Apr 2015 01:07:33 +0000 (01:07 +0000)]
DebugInfo: Support up to 2^16 arguments in a subprogram

Support up to 2^16 arguments to a function.  If we do hit the limit,
assert out rather than restarting at 0 as we've done historically.

This fixes PR23332.  A clang test will follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235955 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoCleanup, remove unused return value
Matthias Braun [Tue, 28 Apr 2015 00:37:05 +0000 (00:37 +0000)]
Cleanup, remove unused return value

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235952 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MC] Split MCBinaryExpr::Shr into LShr and AShr.
Ahmed Bougacha [Tue, 28 Apr 2015 00:21:32 +0000 (00:21 +0000)]
[MC] Split MCBinaryExpr::Shr into LShr and AShr.

Defaulting to AShr without consulting the target MCAsmInfo isn't OK.
Add a flag to fix that.  Keep it off for now: target migrations will
follow in separate commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235951 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MC] Move getBinOpPrecedence into AsmParser. NFC.
Ahmed Bougacha [Tue, 28 Apr 2015 00:17:39 +0000 (00:17 +0000)]
[MC] Move getBinOpPrecedence into AsmParser. NFC.

In preparation for a future patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235950 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSwitch lowering: use uint32_t for weights everywhere
Hans Wennborg [Mon, 27 Apr 2015 23:52:19 +0000 (23:52 +0000)]
Switch lowering: use uint32_t for weights everywhere

I previously thought switch clusters would need to use uint64_t in case
the weights of multiple cases overflowed a 32-bit int. It turns
out that the weights on a terminator instruction are capped to allow for
being added together, so using a uint32_t should be safe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235945 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLTO: Add API to choose whether to embed uselists
Duncan P. N. Exon Smith [Mon, 27 Apr 2015 23:38:54 +0000 (23:38 +0000)]
LTO: Add API to choose whether to embed uselists

Reverse libLTO's default behaviour for preserving use-list order in
bitcode, and add API for controlling it.  The default setting is now
`false` (don't preserve them), which is consistent with `clang`'s
default behaviour.

Users of libLTO should call `lto_codegen_should_embed_uselists(CG,true)`
prior to calling `lto_codegen_write_merged_modules()` whenever the
output file isn't part of the production workflow in order to reproduce
results with subsequent calls to `llc`.

(I haven't added tests since `llvm-lto` (the test tool for LTO) doesn't
support bitcode output, and even if it did: there isn't actually a good
way to test whether a tool has passed the flag.  If the order is already
"natural" (if the order will already round-trip) then no use-list
directives are emitted at all.  At some point I'll circle back to add
tests to `llvm-as` (etc.) that they actually respect the flag, at which
point I can somehow add a test here as well.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235943 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSwitch lowering: Take branch weight into account when ordering for fall-through
Hans Wennborg [Mon, 27 Apr 2015 23:35:22 +0000 (23:35 +0000)]
Switch lowering: Take branch weight into account when ordering for fall-through

Previously, the code would try to put a fall-through case last,
even if that meant moving a case with much higher branch weight
further down the chain.

Ordering by branch weight is most important, putting a fall-through
block last is secondary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235942 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLTO: Simplify code generator initialization
Duncan P. N. Exon Smith [Mon, 27 Apr 2015 23:19:26 +0000 (23:19 +0000)]
LTO: Simplify code generator initialization

Simplify `LTOCodeGenerator` initialization by initializing simple fields
at their definition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235939 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[docs] Fix the link to SanitizerCoverage docs.
Alexey Samsonov [Mon, 27 Apr 2015 22:50:06 +0000 (22:50 +0000)]
[docs] Fix the link to SanitizerCoverage docs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235934 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoremove obsolete pattern matches for scalar SSE ops
Sanjay Patel [Mon, 27 Apr 2015 22:23:17 +0000 (22:23 +0000)]
remove obsolete pattern matches for scalar SSE ops

The blendi pattern should always replace the insertps pattern after:
http://reviews.llvm.org/rL232850
http://reviews.llvm.org/rL235124

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235930 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLTO: Correct some doxygen comments about API availability
Duncan P. N. Exon Smith [Mon, 27 Apr 2015 22:08:01 +0000 (22:08 +0000)]
LTO: Correct some doxygen comments about API availability

These look like copy/paste errors, and shouldn't have the "prior to"
qualifier.  Each API was introduced at the given values of
`LTO_API_VERSION`.  The "prior to" in other doxygen comments is because
I couldn't easily differentiate between versions 1 and 2 when I added
these comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235925 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse CIE version 1 for .eh_frame.
Rafael Espindola [Mon, 27 Apr 2015 22:04:24 +0000 (22:04 +0000)]
Use CIE version 1 for .eh_frame.

According to

http://www.linuxbase.org/betaspecs/lsb/LSB-Core-generic/LSB-Core-generic/ehframechpt.html

we should always use 1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235923 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64] Also combine vector selects fed by non-i1 SETCCs.
Ahmed Bougacha [Mon, 27 Apr 2015 21:43:12 +0000 (21:43 +0000)]
[AArch64] Also combine vector selects fed by non-i1 SETCCs.

After legalization, scalar SETCC has an i32 result type on AArch64.
The i1 requirement seems too conservative, replace it with an assert.

This also means that we now can run after legalization. That should also
be fine, since the ops legalizer runs again after each combine, and
all types created all have the same sizes as the (legal) inputs.

Exposed by r235917; while there, robustize its tests (bsl also uses the
register it defines).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235922 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd missing library dependency in libPDB.
Pete Cooper [Mon, 27 Apr 2015 21:23:12 +0000 (21:23 +0000)]
Add missing library dependency in libPDB.

PDB uses COFFObjectFile::getPE32Header which lives in libObject.

Make sure that LLVMBuild.txt reflects this dependency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235920 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAllow building the gold plugin even if the gold binary is not found.
Rafael Espindola [Mon, 27 Apr 2015 21:08:47 +0000 (21:08 +0000)]
Allow building the gold plugin even if the gold binary is not found.

The gold binary is not required to build the plugin. All that is
needed is for LLVM_BINUTILS_INCDIR to point to the directory
containing plugin-api.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235918 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64] Don't assert when combining (v3f32 select (setcc f64)).
Ahmed Bougacha [Mon, 27 Apr 2015 21:01:20 +0000 (21:01 +0000)]
[AArch64] Don't assert when combining (v3f32 select (setcc f64)).

When the setcc has f64 operands, we can't build a vector setcc mask
to feed a vselect, because f64 doesn't divide v3f32 evenly.
Just bail out when that happens.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235917 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFixes a hang that can occur if a signal comes in during malloc calls.
Chris Bieneman [Mon, 27 Apr 2015 20:45:35 +0000 (20:45 +0000)]
Fixes a hang that can occur if a signal comes in during malloc calls.

We need to dereference the signals mutex during handler registration so that we force its construction. This is to prevent the first use being during handling an actual signal because you can't safely allocate memory in a signal handler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235914 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSilence unused variable errors for no-asserts builds
Bill Schmidt [Mon, 27 Apr 2015 20:22:35 +0000 (20:22 +0000)]
Silence unused variable errors for no-asserts builds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235913 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSwitch lowering: order bit tests by branch weight.
Hans Wennborg [Mon, 27 Apr 2015 20:21:17 +0000 (20:21 +0000)]
Switch lowering: order bit tests by branch weight.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235912 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[opaque pointer type] encode the pointee type of global variables
David Blaikie [Mon, 27 Apr 2015 19:58:56 +0000 (19:58 +0000)]
[opaque pointer type] encode the pointee type of global variables

Use a few extra bits in the const field (after widening it from a fixed
single bit) to stash the address space which is no longer provided by
the type (and an extra bit in there to specify that we're using that new
encoding).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235911 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PPC64LE] Remove unnecessary swaps from lane-insensitive vector computations
Bill Schmidt [Mon, 27 Apr 2015 19:57:34 +0000 (19:57 +0000)]
[PPC64LE] Remove unnecessary swaps from lane-insensitive vector computations

This patch adds a new SSA MI pass that runs on little-endian PPC64
code with VSX enabled. Loads and stores of 4x32 and 2x64 vectors
without alignment constraints are accomplished for little-endian using
lxvd2x/xxswapd and xxswapd/stxvd2x. The existence of the additional
xxswapd instructions hurts performance in comparison with big-endian
code, but they are necessary in the general case to support correct
semantics.

However, the general case does not apply to most vector code. Many
vector instructions are lane-insensitive; they do not "care" which
lanes the parallel computations are performed within, provided that
the resulting data is stored into the correct locations. Thus this
pass looks for computations that perform only lane-insensitive
operations, and remove the unnecessary swaps from loads and stores in
such computations.

Future improvements will allow computations using certain
lane-sensitive operations to also be optimized in this manner, by
modifying the lane-sensitive operations to account for the permuted
order of the lanes. However, this patch only adds the infrastructure
to permit this; no lane-sensitive operations are optimized at this
time.

This code is heavily exercised by the various vectorizing applications
in the projects/test-suite tree. For the time being, I have only added
one simple test case to demonstrate what the pass is doing. Although
it is quite simple, it provides coverage for much of the code,
including the special case handling of copies and subreg-to-reg
operations feeding the swaps. I plan to add additional tests in the
future as I fill in more of the "special handling" code.

Two existing tests were affected, because they expected the swaps to
be present, but they are now removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235910 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[llvm-symbolizer] Link DebugInfoPDB for the autoconf build
Zachary Turner [Mon, 27 Apr 2015 19:41:40 +0000 (19:41 +0000)]
[llvm-symbolizer] Link DebugInfoPDB for the autoconf build

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235909 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agofix 80-cols; NFC
Sanjay Patel [Mon, 27 Apr 2015 17:45:44 +0000 (17:45 +0000)]
fix 80-cols; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235902 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix build broken by incorrect class name.
Zachary Turner [Mon, 27 Apr 2015 17:22:30 +0000 (17:22 +0000)]
Fix build broken by incorrect class name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235901 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake llvm-symbolizer work on Windows.
Zachary Turner [Mon, 27 Apr 2015 17:19:51 +0000 (17:19 +0000)]
Make llvm-symbolizer work on Windows.

Differential Revision: http://reviews.llvm.org/D9234
Reviewed By: Alexey Samsonov

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235900 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake an RAII com initializer.
Zachary Turner [Mon, 27 Apr 2015 17:19:26 +0000 (17:19 +0000)]
Make an RAII com initializer.

Differential Revision: http://reviews.llvm.org/D9267
Reviewed By: Aaron Ballman, David Majnemer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235898 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agofix typos; NFC
Sanjay Patel [Mon, 27 Apr 2015 17:03:31 +0000 (17:03 +0000)]
fix typos; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235896 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] Correct bytes to bits in 2 comments. NFC.
Toma Tabacu [Mon, 27 Apr 2015 15:21:38 +0000 (15:21 +0000)]
[mips] Correct bytes to bits in 2 comments. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235891 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAVX-512: added calling conventions for i1 vectors.
Elena Demikhovsky [Mon, 27 Apr 2015 15:11:19 +0000 (15:11 +0000)]
AVX-512: added calling conventions for i1 vectors.

Fixed bug: https://llvm.org/bugs/show_bug.cgi?id=20724

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235889 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Use constant extenders to fix up hardware loops
Brendon Cahoon [Mon, 27 Apr 2015 14:16:43 +0000 (14:16 +0000)]
[Hexagon] Use constant extenders to fix up hardware loops

Use a loop instruction with a constant extender for a hardware
loop instruction that is too far away from the start of the loop.
This is cheaper than changing the SA register value.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235882 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] [IAS] Improve warning for using AT with .set noat.
Toma Tabacu [Mon, 27 Apr 2015 14:05:04 +0000 (14:05 +0000)]
[mips] [IAS] Improve warning for using AT with .set noat.

Summary:
Changed the warning message to show the current value of $at, similar to what clang does for typedef's, and renamed warnIfAssemblerTemporary to a more descriptive name.

I also changed the type of variables which store registers from int to unsigned, updated the relevant test and tried to make the related comments clearer.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235881 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReapply "[mips][FastISel] Implement shift ops for Mips fast-isel.""
Vasileios Kalintiris [Mon, 27 Apr 2015 13:28:05 +0000 (13:28 +0000)]
Reapply "[mips][FastISel] Implement shift ops for Mips fast-isel.""

This reapplies r235194, which was reverted in r235495 because it was causing a
failure in our out-of-tree buildbots for MIPS. With the sign-extension patch
in r235718, this patch doesn't cause any problem any more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235878 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] [IAS] Rename getATRegNum and setATReg to {g,s}etATRegIndex. NFC.
Toma Tabacu [Mon, 27 Apr 2015 13:12:59 +0000 (13:12 +0000)]
[mips] [IAS] Rename getATRegNum and setATReg to {g,s}etATRegIndex. NFC.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235877 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAVX-512: Extend/Truncate operations for SKX,
Elena Demikhovsky [Mon, 27 Apr 2015 12:57:59 +0000 (12:57 +0000)]
AVX-512: Extend/Truncate operations for SKX,
SETCC for bit-vectors

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235875 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove unused variable, found with gcc-5.1 -Wunused-variable.
Patrik Hagglund [Mon, 27 Apr 2015 11:03:53 +0000 (11:03 +0000)]
Remove unused variable, found with gcc-5.1 -Wunused-variable.

The variable, MachOSectionTypes, seems to have been unused since its
introduction in r178679.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235863 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MC] [IAS] Add support for the \@ .macro pseudo-variable.
Toma Tabacu [Mon, 27 Apr 2015 10:50:29 +0000 (10:50 +0000)]
[MC] [IAS] Add support for the \@ .macro pseudo-variable.

Summary:
When used, it is substituted with the number of .macro instantiations we've done up to that point in time.
So if this is the 1st time we've instantiated a .macro (any .macro, regardless of name), \@ will instantiate to 0, if it's the 2nd .macro instantiation, it will instantiate to 1 etc.

It can only be used inside a .macro definition, an .irp definition or an .irpc definition (those last 2 uses are undocumented).

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: dsanders, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235862 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoConstfold insertelement to undef when index is out-of-bounds
Pawel Bylica [Mon, 27 Apr 2015 09:30:49 +0000 (09:30 +0000)]
Constfold insertelement to undef when index is out-of-bounds

Summary:
This patch adds constant folding of insertelement instruction to undef value when index operand is constant and is not less than vector size or is undef.

InstCombine does not support this case, but I'm happy to add it there also if this change is accepted.

Test Plan: Unittests and regression tests for ConstProp pass.

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235854 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86][SSE] Add v16i8/v32i8 multiplication support
Simon Pilgrim [Mon, 27 Apr 2015 07:55:46 +0000 (07:55 +0000)]
[X86][SSE] Add v16i8/v32i8 multiplication support

Patch to allow int8 vectors to be multiplied on the SSE unit instead of being scalarized.

The patch sign extends the i8 lanes to i16, uses the SSE2 pmullw multiplication instruction, then packs the lower byte from each result.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235837 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PerformanceTips] Italics are *word*, not _word_
Philip Reames [Sun, 26 Apr 2015 22:25:29 +0000 (22:25 +0000)]
[PerformanceTips] Italics are *word*, not _word_

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235827 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PerformanceTips] Provide context on the impact of assume(x)
Philip Reames [Sun, 26 Apr 2015 22:23:12 +0000 (22:23 +0000)]
[PerformanceTips] Provide context on the impact of assume(x)

Sean Silva suggested I add something here a while back.  Sorry it's taken so long to get back to this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235826 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd two new items to PerformanceTips
Philip Reames [Sun, 26 Apr 2015 22:15:18 +0000 (22:15 +0000)]
Add two new items to PerformanceTips

1) Turns out we're not great at recognizing redundant checks when one is a != and the other is an ==.  This is a bug, but it's one that matters to frontend authors.

2) Frontends shouldn't use intrinsics unless strictly neccessary.  This has been pretty widely proven by this point and is good to document.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235825 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake the message associated with a fatal error slightly more helpful
Philip Reames [Sun, 26 Apr 2015 22:00:34 +0000 (22:00 +0000)]
Make the message associated with a fatal error slightly more helpful

Looking into 23095, my best guess is that the CodeGen library itself isn't getting linked and initialized properly.  To make this slightly more obvious to consumers of LLVM, emit a different error message if we can tell that the registry is empty vs you've simply happened to name a collector which hasn't been registered.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235824 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RewriteStatepointsForGC] Exclude constant values from being considered live at a...
Philip Reames [Sun, 26 Apr 2015 19:48:03 +0000 (19:48 +0000)]
[RewriteStatepointsForGC] Exclude constant values from being considered live at a safepoint

There can be various constant pointers in the IR which do not get relocated at a safepoint. One example is the address of a global variable. Another example is a pointer created via inttoptr. Note that the optimizer itself likes to create such inttoptrs when locally propagating constants through dynamically dead code.

To deal with this, we need to exclude uses of constants from contributing to the liveness of a safepoint which might reach that use. At some later date, it might be worth exploring what could be done to support the relocation of various special types of "constants", but that's future work.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235821 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDon't Place Entry Safepoints Before the llvm.frameescape() Intrinsic
Philip Reames [Sun, 26 Apr 2015 19:41:23 +0000 (19:41 +0000)]
Don't Place Entry Safepoints Before the llvm.frameescape() Intrinsic

llvm.frameescape() intrinsic is not a real call. The intrinsic can only exist in the entry block. Inserting a gc.statepoint() before llvm.frameescape() may split the entry block, and push the intrinsic out of the entry block.

Patch by: Swaroop.Sridhar@microsoft.com
Differential Revision: http://reviews.llvm.org/D8910

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235820 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[bpf] fix build and remove a compiler warning in Release mode
Alexei Starovoitov [Sun, 26 Apr 2015 01:58:08 +0000 (01:58 +0000)]
[bpf] fix build and remove a compiler warning in Release mode

Patch by Brenden Blanco.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235814 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoR600: Remove / merge redundant testcases
Matt Arsenault [Sun, 26 Apr 2015 00:53:33 +0000 (00:53 +0000)]
R600: Remove / merge redundant testcases

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235813 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[x86] instcombine more cases of insertps into a shufflevector
Sanjay Patel [Sat, 25 Apr 2015 20:55:25 +0000 (20:55 +0000)]
[x86] instcombine more cases of insertps into a shufflevector

This is a follow-on to D8833 (insertps optimization when the zero mask is not used).

In this patch, we check for the case where the zmask is used, but both input vectors
to the insertps intrinsic are the same operand or the zmask overrides the destination
lane. This lets us replace the 2nd shuffle input operand with the zero vector.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235810 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoadd SSE run to check non-AVX codegen
Sanjay Patel [Sat, 25 Apr 2015 20:41:51 +0000 (20:41 +0000)]
add SSE run to check non-AVX codegen

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235809 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ARM] Simplify code. NFC.
Benjamin Kramer [Sat, 25 Apr 2015 17:25:13 +0000 (17:25 +0000)]
[ARM] Simplify code. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235803 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[hexagon] Use range-based for loops. No functionality change intended.
Benjamin Kramer [Sat, 25 Apr 2015 14:46:53 +0000 (14:46 +0000)]
[hexagon] Use range-based for loops. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235802 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[hexagon] Remove setHexLibcallName, it leaks memory.
Benjamin Kramer [Sat, 25 Apr 2015 14:46:46 +0000 (14:46 +0000)]
[hexagon] Remove setHexLibcallName, it leaks memory.

Just spell out the full names, it's not that much more code.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235801 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoline endings fix
Simon Pilgrim [Sat, 25 Apr 2015 12:12:43 +0000 (12:12 +0000)]
line endings fix

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235800 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agobuild: make libunwind a proper project
Saleem Abdulrasool [Sat, 25 Apr 2015 01:47:39 +0000 (01:47 +0000)]
build: make libunwind a proper project

This allows the build infrastructure to properly detect and build libunwind.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235796 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix build error from accidental change
Andrew Kaylor [Fri, 24 Apr 2015 23:34:46 +0000 (23:34 +0000)]
Fix build error from accidental change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235792 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] Find correct cloned entry block for outlined handler functions.
Andrew Kaylor [Fri, 24 Apr 2015 23:27:32 +0000 (23:27 +0000)]
[WinEH] Find correct cloned entry block for outlined handler functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235791 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] Find correct cloned entry block for outlined handler functions.
Andrew Kaylor [Fri, 24 Apr 2015 23:10:38 +0000 (23:10 +0000)]
[WinEH] Find correct cloned entry block for outlined handler functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235789 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAssert that Process::FindInEnvPath() is passed a relative path.
Nico Weber [Fri, 24 Apr 2015 22:18:46 +0000 (22:18 +0000)]
Assert that Process::FindInEnvPath() is passed a relative path.

It misbehaves with absolute paths. (So does path::append().)
Goes with clang r235787.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235788 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLinker: Copy over function metadata attachments
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 22:07:31 +0000 (22:07 +0000)]
Linker: Copy over function metadata attachments

Update `lib/Linker` to handle `Function` metadata attachments.  The
attachments stick with the function body.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235786 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIR: Add assembly/bitcode support for function metadata attachments
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 22:04:41 +0000 (22:04 +0000)]
IR: Add assembly/bitcode support for function metadata attachments

Add serialization support for function metadata attachments (added in
r235783).  The syntax is:

    define @foo() !attach !0 {

Metadata attachments are only allowed on functions with bodies.  Since
they come before the `{`, they're not really part of the body; since
they require a body, they're not really part of the header.  In
`LLParser` I gave them a separate function called from `ParseDefine()`,
`ParseOptionalFunctionMetadata()`.

In bitcode, I'm using the same `METADATA_ATTACHMENT` record used by
instructions.  Instruction metadata attachments are included in a
special "attachment" block at the end of a `Function`.  The attachment
records are laid out like this:

    InstID (KindID MetadataID)+

Note that these records always have an odd number of fields.  The new
code takes advantage of this to recognize function attachments (which
don't need an instruction ID):

    (KindID MetadataID)+

This means we can use the same attachment block already used for
instructions.

This is part of PR23340.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235785 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoVerifier: Function metadata attachments require a body
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:53:27 +0000 (21:53 +0000)]
Verifier: Function metadata attachments require a body

Add a verifier check that only functions with bodies have metadata
attachments.  This should help catch bugs in frontends and
transformation passes.  Part of PR23340.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235784 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIR: Add Function metadata attachments
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:51:02 +0000 (21:51 +0000)]
IR: Add Function metadata attachments

Add IR support for `Metadata` attachments.  Assembly and bitcode support
will follow shortly, but for now we just have unit tests.  This is part
of PR23340.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235783 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLLParser: Simplify ParseInstructionMetadata(), NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:29:36 +0000 (21:29 +0000)]
LLParser: Simplify ParseInstructionMetadata(), NFC

Remove unused `PFS` variable and take the `Instruction` by reference.
(Not really related to PR23340, but might as well clean this up while
I'm here.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235782 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[DAGCombiner] Fix the type used in canFoldInAddressingMode to account for the
Quentin Colombet [Fri, 24 Apr 2015 21:28:00 +0000 (21:28 +0000)]
[DAGCombiner] Fix the type used in canFoldInAddressingMode to account for the
right scaling.

In the function canFoldInAddressingMode, VT is computed as the type of the
destination/source of a LOAD/STORE operations, instead of the memory type of the
operation.
On targets with a scaling factor on the offset of the LOAD/STORE operations, the
function may return false for actually valid cases. This may then prevent the
selection of profitable pre or post indexed load/store operations, and instead
select pre or post indexed load/store for unprofitable cases.

Patch by Francois de Ferriere <francois.de-ferriere@st.com>!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235780 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLLParser: Split out ParseMetadataAttachment(), NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:21:57 +0000 (21:21 +0000)]
LLParser: Split out ParseMetadataAttachment(), NFC

Make the code reusable for `Function` metadata attachments (PR23340).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235778 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[opaque pointer type] Verifier/AutoUpgrade: Remove a few uses of PointerType::getElem...
David Blaikie [Fri, 24 Apr 2015 21:16:07 +0000 (21:16 +0000)]
[opaque pointer type] Verifier/AutoUpgrade: Remove a few uses of PointerType::getElementType

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235777 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAsmWriter: Parameterize the syntactic separator for attachments
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:06:21 +0000 (21:06 +0000)]
AsmWriter: Parameterize the syntactic separator for attachments

Parameterize the separator for attachments, since `Function` metadata
attachments (PR23340) aren't going to use a `,` (comma).  No real
functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235775 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAsmWriter: Only collect attachment names once per module
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:03:05 +0000 (21:03 +0000)]
AsmWriter: Only collect attachment names once per module

Collect metadata names once per `AssemblyWriter` instead of every time
we need to print some attachments.  Just a drive-by; this caught my eye
while I was refactoring the code in r235772.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235774 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove an unused variable to prevent -Werror build failures.
Kaelyn Takata [Fri, 24 Apr 2015 21:02:18 +0000 (21:02 +0000)]
Remove an unused variable to prevent -Werror build failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235773 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAsmWriter: Split out code for printing Metadata attachments, NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:59:52 +0000 (20:59 +0000)]
AsmWriter: Split out code for printing Metadata attachments, NFC

Refactor the code for printing `Instruction` metadata attachments so it
can be reused for `Function`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235772 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSimplifyCFG: Correctly handle switch lookup tables which fully cover the input type...
Hans Wennborg [Fri, 24 Apr 2015 20:57:56 +0000 (20:57 +0000)]
SimplifyCFG: Correctly handle switch lookup tables which fully cover the input type and use bit tests to check for holes

When using bit tests for hole checks, we call AddPredecessorToBlock to give the
phi node a value from the bit test block. This would break if we've
previously called removePredecessor on the default destination because the
switch is fully covered.

Test case by Mark Lacey.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235771 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIR: Use a bitmask to access GlobalObject subclass data
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:47:23 +0000 (20:47 +0000)]
IR: Use a bitmask to access GlobalObject subclass data

Make room for more than just `Function::isMaterializable()` in the
`GlobalObject` subclass data bitfield.  Since we're treating it like a
bitfield, change `Function::Function()` to zero-out the whole thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235770 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIR: Extract set logic from Instruction attachments, NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:36:25 +0000 (20:36 +0000)]
IR: Extract set logic from Instruction attachments, NFC

Extract the set logic for metadata attachments from `Instruction` so it
can be reused for `Function` (PR23340).

This data structure makes a `SmallVector<>` look (a little) like a map,
just doing the bare minimum to support the `Instruction` (and soon,
`Function`) metadata API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235769 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SEH] Implement GetExceptionCode in __except blocks
Reid Kleckner [Fri, 24 Apr 2015 20:25:05 +0000 (20:25 +0000)]
[SEH] Implement GetExceptionCode in __except blocks

This introduces an intrinsic called llvm.eh.exceptioncode. It is lowered
by copying the EAX value live into whatever basic block it is called
from. Obviously, this only works if you insert it late during codegen,
because otherwise mid-level passes might reschedule it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235768 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIR: Use remove_if for Instruction::dropUnknownMetadata()
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:23:44 +0000 (20:23 +0000)]
IR: Use remove_if for Instruction::dropUnknownMetadata()

Technically the operations are different -- the old logic moved items
from the back into the opened-up slots, instead of the usual
`remove_if()` logic of a slow and a fast iterator -- but unless a
profile tells us otherwise I prefer the simpler logic here.  Regardless,
there shouldn't be an observable function change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235767 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIR: Remove MDMapTy and MDPairTy typedefs, NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:19:13 +0000 (20:19 +0000)]
IR: Remove MDMapTy and MDPairTy typedefs, NFC

Remove some typedefs in preparation for factoring out attachment logic
from `Instruction`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235764 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIR: Rename LLVMContextImpl::MetadataStore to InstructionMetadata
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:16:42 +0000 (20:16 +0000)]
IR: Rename LLVMContextImpl::MetadataStore to InstructionMetadata

Rename `MetadataStore` to the more explicit `InstructionMetadata`.  This
will make room for `FunctionMetadata` (start of PR23340).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235763 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[opaque pointer type] Add textual IR support for explicit type parameter to the invok...
David Blaikie [Fri, 24 Apr 2015 19:32:54 +0000 (19:32 +0000)]
[opaque pointer type] Add textual IR support for explicit type parameter to the invoke instruction

Same as r235145 for the call instruction - the justification, tradeoffs,
etc are all the same. The conversion script worked the same without any
false negatives (after replacing 'call' with 'invoke').

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235755 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PATCH] [Hexagon] Adding a test case for calling convention.
Sundeep Kushwaha [Fri, 24 Apr 2015 19:22:02 +0000 (19:22 +0000)]
[PATCH] [Hexagon] Adding a test case for calling convention.

http://reviews.llvm.org/D9241

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235754 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AsmPrinter] Make AsmPrinter's OutStreamer member a unique_ptr.
Lang Hames [Fri, 24 Apr 2015 19:11:51 +0000 (19:11 +0000)]
[AsmPrinter] Make AsmPrinter's OutStreamer member a unique_ptr.

AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a
reference for this is crufty.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235752 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert changes to LTO test case since llvm-lto can't handle textual IR inputs
David Blaikie [Fri, 24 Apr 2015 18:13:27 +0000 (18:13 +0000)]
Revert changes to LTO test case since llvm-lto can't handle textual IR inputs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235738 91177308-0d34-0410-b5e6-96231b3b80d8