Zachary Turner [Tue, 9 Dec 2014 19:13:50 +0000 (19:13 +0000)]
Create a valid stop info for all non-breakpoint exceptions.
llvm-svn: 223812
David Majnemer [Tue, 9 Dec 2014 19:10:03 +0000 (19:10 +0000)]
AsmParser: Don't crash on short hex constants for fp128 types
If we see 0xL01, treat it like 0xL00000000000000000000000000000001
instead of crashing.
llvm-svn: 223811
Duncan P. N. Exon Smith [Tue, 9 Dec 2014 18:59:09 +0000 (18:59 +0000)]
Fix another GCC build failure from r223802
llvm-svn: 223810
Frederic Riss [Tue, 9 Dec 2014 18:57:39 +0000 (18:57 +0000)]
Remove unneeded curly braces.
llvm-svn: 223809
Frederic Riss [Tue, 9 Dec 2014 18:57:34 +0000 (18:57 +0000)]
Reorder the code to avoid inserting at the beginning of a vector.
As per dblaikie suggestion, thanks\!
llvm-svn: 223808
Juergen Ributzka [Tue, 9 Dec 2014 18:56:35 +0000 (18:56 +0000)]
Cleanup PatternMatch. NFC.
Tidy up the code a little by using 'auto' when the type is obvious, doxify the
comments, and clang-format the file.
llvm-svn: 223807
Duncan P. N. Exon Smith [Tue, 9 Dec 2014 18:52:38 +0000 (18:52 +0000)]
Fix a GCC build failure from r223802
llvm-svn: 223806
Chris Bieneman [Tue, 9 Dec 2014 18:49:55 +0000 (18:49 +0000)]
Adding a new option to CMake to disable C++ atexit on llvm-shlib.
Summary:
This is desirable for WebKit and other clients of the llvm-shlib because C++ exit time destructors have a tendency to crash when invoked from multi-threaded applications.
Ideally this option will be temporary, because the ideal fix is to just not have exit time destructors.
Reviewers: chapuni, ributzka
Reviewed By: ributzka
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D6572
llvm-svn: 223805
Robert Khasanov [Tue, 9 Dec 2014 18:45:30 +0000 (18:45 +0000)]
[AVX512] Added lowering for VBROADCASTSS/SD instructions.
Lowering patterns were written through avx512_broadcast_pat multiclass as pattern generates VBROADCAST and COPY_TO_REGCLASS nodes.
Added lowering tests.
llvm-svn: 223804
Duncan P. N. Exon Smith [Tue, 9 Dec 2014 18:39:32 +0000 (18:39 +0000)]
IR: Update clang for Metadata/Value split in r223802
Match LLVM API changes from r223802.
llvm-svn: 223803
Duncan P. N. Exon Smith [Tue, 9 Dec 2014 18:38:53 +0000 (18:38 +0000)]
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of
PR21532. Assembly and bitcode changes are in the wings, but this is the
bulk of the change for the IR C++ API.
I have a follow-up patch prepared for `clang`. If this breaks other
sub-projects, I apologize in advance :(. Help me compile it on Darwin
I'll try to fix it. FWIW, the errors should be easy to fix, so it may
be simpler to just fix it yourself.
This breaks the build for all metadata-related code that's out-of-tree.
Rest assured the transition is mechanical and the compiler should catch
almost all of the problems.
Here's a quick guide for updating your code:
- `Metadata` is the root of a class hierarchy with three main classes:
`MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from
the `Value` class hierarchy. It is typeless -- i.e., instances do
*not* have a `Type`.
- `MDNode`'s operands are all `Metadata *` (instead of `Value *`).
- `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be
replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively.
If you're referring solely to resolved `MDNode`s -- post graph
construction -- just use `MDNode*`.
- `MDNode` (and the rest of `Metadata`) have only limited support for
`replaceAllUsesWith()`.
As long as an `MDNode` is pointing at a forward declaration -- the
result of `MDNode::getTemporary()` -- it maintains a side map of its
uses and can RAUW itself. Once the forward declarations are fully
resolved RAUW support is dropped on the ground. This means that
uniquing collisions on changing operands cause nodes to become
"distinct". (This already happened fairly commonly, whenever an
operand went to null.)
If you're constructing complex (non self-reference) `MDNode` cycles,
you need to call `MDNode::resolveCycles()` on each node (or on a
top-level node that somehow references all of the nodes). Also,
don't do that. Metadata cycles (and the RAUW machinery needed to
construct them) are expensive.
- An `MDNode` can only refer to a `Constant` through a bridge called
`ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`).
As a side effect, accessing an operand of an `MDNode` that is known
to be, e.g., `ConstantInt`, takes three steps: first, cast from
`Metadata` to `ConstantAsMetadata`; second, extract the `Constant`;
third, cast down to `ConstantInt`.
The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have
metadata schema owners transition away from using `Constant`s when
the type isn't important (and they don't care about referring to
`GlobalValue`s).
In the meantime, I've added transitional API to the `mdconst`
namespace that matches semantics with the old code, in order to
avoid adding the error-prone three-step equivalent to every call
site. If your old code was:
MDNode *N = foo();
bar(isa <ConstantInt>(N->getOperand(0)));
baz(cast <ConstantInt>(N->getOperand(1)));
bak(cast_or_null <ConstantInt>(N->getOperand(2)));
bat(dyn_cast <ConstantInt>(N->getOperand(3)));
bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4)));
you can trivially match its semantics with:
MDNode *N = foo();
bar(mdconst::hasa <ConstantInt>(N->getOperand(0)));
baz(mdconst::extract <ConstantInt>(N->getOperand(1)));
bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2)));
bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3)));
bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4)));
and when you transition your metadata schema to `MDInt`:
MDNode *N = foo();
bar(isa <MDInt>(N->getOperand(0)));
baz(cast <MDInt>(N->getOperand(1)));
bak(cast_or_null <MDInt>(N->getOperand(2)));
bat(dyn_cast <MDInt>(N->getOperand(3)));
bay(dyn_cast_or_null<MDInt>(N->getOperand(4)));
- A `CallInst` -- specifically, intrinsic instructions -- can refer to
metadata through a bridge called `MetadataAsValue`. This is a
subclass of `Value` where `getType()->isMetadataTy()`.
`MetadataAsValue` is the *only* class that can legally refer to a
`LocalAsMetadata`, which is a bridged form of non-`Constant` values
like `Argument` and `Instruction`. It can also refer to any other
`Metadata` subclass.
(I'll break all your testcases in a follow-up commit, when I propagate
this change to assembly.)
llvm-svn: 223802
David Majnemer [Tue, 9 Dec 2014 18:33:57 +0000 (18:33 +0000)]
AsmParser: Don't crash on malformed attribute groups
This fixes PR21785.
llvm-svn: 223801
Colin LeMahieu [Tue, 9 Dec 2014 18:16:49 +0000 (18:16 +0000)]
[Hexagon] Updating predicate register transfers and adding tstbit to allow select selection. Updating ll tests with predicate transfers that previously had nop encodings.
llvm-svn: 223800
Frederic Riss [Tue, 9 Dec 2014 17:55:48 +0000 (17:55 +0000)]
Correctly handle complex locations expressions in replaceDbgDeclareForAlloca()
replaceDbgDeclareForAlloca() replaces an alloca by a value storing the
address of what was the alloca. If there is a dbg.declare corresponding
to that alloca, we need to lower it to a dbg.value describing the additional
dereference operation to be performed to get to the underlying variable.
This is done by adding a DW_OP_deref to the complex location part of the
location description. This deref was added to the end of the operation list,
which is wrong. The expression applies to what is described by the
dbg.{declare,value}, and as we are changing this, we need to apply the
DW_OP_deref as the first operation in the list.
Part of the fix for rdar://
19162268.
llvm-svn: 223799
Frederic Riss [Tue, 9 Dec 2014 17:50:27 +0000 (17:50 +0000)]
Deleting empty directories left over from r223794.
llvm-svn: 223798
Juergen Ributzka [Tue, 9 Dec 2014 17:50:10 +0000 (17:50 +0000)]
[CGP] Rewrite pattern match for splitBranchCondition to work with Values instead.
Rewrite the pattern match code to work also with Values instead with
Instructions only. Also remove the no longer need matcher (m_Instruction).
llvm-svn: 223797
Hans Wennborg [Tue, 9 Dec 2014 17:46:06 +0000 (17:46 +0000)]
Fix the MSVC build
llvm-svn: 223796
Juergen Ributzka [Tue, 9 Dec 2014 17:32:12 +0000 (17:32 +0000)]
Revert "Move function to obtain branch weights into the BranchInst class. NFC."
This reverts commit r223784 and copies the 'ExtractBranchMetadata' to CodeGenPrepare.
llvm-svn: 223795
Frederic Riss [Tue, 9 Dec 2014 17:21:50 +0000 (17:21 +0000)]
Revert "Initial dsymutil tool commit."
This reverts commit r223793. The review thread wasn't concluded.
llvm-svn: 223794
Frederic Riss [Tue, 9 Dec 2014 17:03:30 +0000 (17:03 +0000)]
Initial dsymutil tool commit.
The goal of this tool is to replicate Darwin's dsymutil functionality
based on LLVM. dsymutil is a DWARF linker. Darwin's linker (ld64) does
not link the debug information, it leaves it in the object files in
relocatable form, but embbeds a `debug map` into the executable that
describes where to find the debug information and how to relocate it.
When releasing/archiving a binary, dsymutil is called to link all the DWARF
information into a `dsym bundle` that can distributed/stored along with
the binary.
With this commit, the LLVM based dsymutil is just able to parse the STABS
debug maps embedded by ld64 in linked binaries (and not all of them, for
example archives aren't supported yet).
Note that the tool directory is called dsymutil, but the executable is
currently called llvm-dsymutil. This discrepancy will disappear once the
tool will be feature complete. At this point the executable will be renamed
to dsymutil, but until then you do not want it to override the system one.
Differential Revision: http://reviews.llvm.org/D6242
llvm-svn: 223793
Bill Schmidt [Tue, 9 Dec 2014 16:59:57 +0000 (16:59 +0000)]
[PowerPC 4/4] Enable little-endian support for VSX.
With the foregoing three patches, VSX instructions can be used for
little endian. This patch removes the restriction that prevented
this, and re-enables the test cases from the first three patches.
llvm-svn: 223792
Bill Schmidt [Tue, 9 Dec 2014 16:52:29 +0000 (16:52 +0000)]
[PowerPC 3/4] Little-endian adjustments for VSX vector shuffle
When performing instruction selection for ISD::VECTOR_SHUFFLE, there
is special code for handling v2f64 and v2i64 using VSX instructions.
This code must be adjusted for little-endian. Because the two inputs
are treated as a double-wide register, we must swap their order for
little endian. To get the appropriate mask elements to use with the
big-endian biased XXPERMDI instruction, we must reverse their order
and invert the bits.
A new test is added to test the 16 possible values of the shuffle
mask. It is initially disabled for reasons specified in the test. It
is re-enabled by patch 4/4.
llvm-svn: 223791
Rafael Espindola [Tue, 9 Dec 2014 16:50:57 +0000 (16:50 +0000)]
Remember the unmangled name in the plugin.
This allows it to work with non trivial manglings like the one in COFF.
Amusingly, this can be tested with gold, as emit-llvm causes the plugin to
exit before any COFF is generated.
llvm-svn: 223790
Bill Schmidt [Tue, 9 Dec 2014 16:44:58 +0000 (16:44 +0000)]
Add test cases that were inadvertently omitted from r223783 and r223788
llvm-svn: 223789
Bill Schmidt [Tue, 9 Dec 2014 16:43:32 +0000 (16:43 +0000)]
[PowerPC 2/4] Little-endian adjustments for VSX insert/extract operations
For little endian, we need to make some straightforward adjustments in
the code expansions for scalar_to_vector and vector_extract of v2f64.
First, scalar_to_vector must place the scalar into vector element
zero. However, our implementation of SUBREG_TO_REG will place it into
big-element vector element zero (high-order bits), and for little
endian we need it in the low-order bits. The LE implementation splats
the high-order doubleword into the low-order doubleword.
Second, the meaning of (vector_extract x, 0) and (vector_extract x, 1)
must be reversed for similar reasons.
A new test is added that tests code generation for insertelement and
extractelement for both element 0 and element 1. It is disabled in
this patch but enabled in patch 4/4, for reasons stated in the test.
llvm-svn: 223788
Robert Khasanov [Tue, 9 Dec 2014 16:38:41 +0000 (16:38 +0000)]
[AVX512] Added VPBROADCAST{BWDQ} (Load with Broadcast Integer Data from General Purpose Register) encodings for AVX512-BW/VL subsets
Added encoding tests.
llvm-svn: 223787
Juergen Ributzka [Tue, 9 Dec 2014 16:36:13 +0000 (16:36 +0000)]
[CodeGenPrepare] Split branch conditions into multiple conditional branches.
This optimization transforms code like:
bb1:
%0 = icmp ne i32 %a, 0
%1 = icmp ne i32 %b, 0
%or.cond = or i1 %0, %1
br i1 %or.cond, label %TrueBB, label %FalseBB
into a multiple branch instructions like:
bb1:
%0 = icmp ne i32 %a, 0
br i1 %0, label %TrueBB, label %bb2
bb2:
%1 = icmp ne i32 %b, 0
br i1 %1, label %TrueBB, label %FalseBB
This optimization is already performed by SelectionDAG, but not by FastISel.
FastISel cannot perform this optimization, because it cannot generate new
MachineBasicBlocks.
Performing this optimization at CodeGenPrepare time makes it available to both -
SelectionDAG and FastISel - and the implementation in SelectiuonDAG could be
removed. There are currenty a few differences in codegen for X86 and PPC, so
this commmit only enables it for FastISel.
Reviewed by Jim Grosbach
This fixes rdar://problem/
19034919.
llvm-svn: 223786
Juergen Ributzka [Tue, 9 Dec 2014 16:36:10 +0000 (16:36 +0000)]
Add more pattern matchers for compares, instructions, and BinaryOperators. NFC.
Add a few more matchers to make the code in the next commit more compact.
llvm-svn: 223785
Juergen Ributzka [Tue, 9 Dec 2014 16:36:06 +0000 (16:36 +0000)]
Move function to obtain branch weights into the BranchInst class. NFC.
Make this function available to other parts of LLVM.
llvm-svn: 223784
Bill Schmidt [Tue, 9 Dec 2014 16:35:51 +0000 (16:35 +0000)]
[PowerPC 1/4] Little-endian adjustments for VSX loads/stores
This patch addresses the inherent big-endian bias in the lxvd2x,
lxvw4x, stxvd2x, and stxvw4x instructions. These instructions load
vector elements into registers left-to-right (with the first element
loaded into the high-order bits of the register), regardless of the
endian setting of the processor. However, these are the only
vector memory instructions that permit unaligned storage accesses, so
we want to use them for little-endian.
To make this work, a lxvd2x or lxvw4x is replaced with an lxvd2x
followed by an xxswapd, which swaps the doublewords. This works for
lxvw4x as well as lxvd2x, because for lxvw4x on an LE system the
vector elements are in LE order (right-to-left) within each
doubleword. (Thus after lxvw2x of a <4 x float> the elements will
appear as 1, 0, 3, 2. Following the swap, they will appear as 3, 2,
0, 1, as desired.) For stores, an stxvd2x or stxvw4x is replaced
with an stxvd2x preceded by an xxswapd.
Introduction of extra swap instructions provides correctness, but
obviously is not ideal from a performance perspective. Future patches
will address this with optimizations to remove most of the introduced
swaps, which have proven effective in other implementations.
The introduction of the swaps is performed during lowering of LOAD,
STORE, INTRINSIC_W_CHAIN, and INTRINSIC_VOID operations. The latter
are used to translate intrinsics that specify the VSX loads and stores
directly into equivalent sequences for little endian. Thus code that
uses vec_vsx_ld and vec_vsx_st does not have to be modified to be
ported from BE to LE.
We introduce new PPCISD opcodes for LXVD2X, STXVD2X, and XXSWAPD for
use during this lowering step. In PPCInstrVSX.td, we add new SDType
and SDNode definitions for these (PPClxvd2x, PPCstxvd2x, PPCxxswapd).
These are recognized during instruction selection and mapped to the
correct instructions.
Several tests that were written to use -mcpu=pwr7 or pwr8 are modified
to disable VSX on LE variants because code generation changes with
this and subsequent patches in this set. I chose to include all of
these in the first patch than try to rigorously sort out which tests
were broken by one or another of the patches. Sorry about that.
The new test vsx-ldst-builtin-le.ll, and the changes to vsx-ldst.ll,
are disabled until LE support is enabled because of breakages that
occur as noted in those tests. They are re-enabled in patch 4/4.
llvm-svn: 223783
Will Newton [Tue, 9 Dec 2014 16:29:39 +0000 (16:29 +0000)]
ELF: Add a standard method for unknown relocation errors
At present each TargetRelocationHandler generates a pretty similar error
string and calls llvm_unreachable() when encountering an unknown
relocation. This is not ideal for two reasons:
1. llvm_unreachable disappears in release builds but we still want to
know if we encountered a relocation we couldn't handle in release
builds.
2. Duplication is bad - there is no need to have a per-architecture error
message.
This change adds a test for AArch64 to test whether or not the error
message actually works. The other architectures have not been tested
but they compile and check-lld passes.
llvm-svn: 223782
Rafael Espindola [Tue, 9 Dec 2014 16:18:11 +0000 (16:18 +0000)]
Move method out of line to make buildbot happy.
llvm-svn: 223781
Rafael Espindola [Tue, 9 Dec 2014 16:13:59 +0000 (16:13 +0000)]
Don't lookup an object symbol name in the module.
Instead, walk the obj symbol list in parallel to find the GV. This shouldn't
change anything on ELF where global symbols are not mangled, but it is a step
toward supporting other object formats.
Gold itself is ELF only, but bfd ld supports COFF and the logic in the gold
plugin could be reused on lld.
llvm-svn: 223780
Chandler Carruth [Tue, 9 Dec 2014 15:52:55 +0000 (15:52 +0000)]
Don't actually generate code for testing the frontend's target cpu flag,
just verify. This should fix the bots where the x86 backend isn't built
into Clang. Sorry for the breakage.
llvm-svn: 223779
Marshall Clow [Tue, 9 Dec 2014 15:07:42 +0000 (15:07 +0000)]
Move the optional tests into test/experimental. They were put into test/utilities because optional was going to be part of C++14, and then was pulled and put into the Library Fundamentals TS instead. No funcitonality change here; just moving files around.
llvm-svn: 223778
Alexander Kornienko [Tue, 9 Dec 2014 15:02:17 +0000 (15:02 +0000)]
[clang-tidy] Fix a typo.
llvm-svn: 223777
Chandler Carruth [Tue, 9 Dec 2014 14:50:25 +0000 (14:50 +0000)]
Re-work the Clang system for classifying Intel x86 CPUs to use their
basic microarchitecture names, and add support (with tests) for parsing
all of the masic microarchitecture names for CPUs documented to be
accepted by GCC with -march. I didn't go back through the 32-bit-only
old microarchitectures, but this at least brings the recent architecture
names up to speed. This is essentially the follow-up to the LLVM commit
r223769 which did similar cleanups for the LLVM CPUs.
One particular benefit is that you can now use -march=westmere in Clang
and get the LLVM westmere processor which is a different ISA variant (!)
and so quite significant.
Much like with r223769, I would appreciate the Intel folks carefully
thinking about the macros defined, names used, etc for the atom chips
and newest primary x86 chips. The current patterns seem quite strange to
me, especially here in Clang.
Note that I haven't replicated the per-microarchitecture macro defines
provided by GCC. I'm really opposed to source code using these rather
than using ISA feature macros.
llvm-svn: 223776
Marshall Clow [Tue, 9 Dec 2014 14:49:17 +0000 (14:49 +0000)]
Add all the relational operators to std::experimental::optional. Also update bad_optional_access to match the Library Fundamentals draft standard. This is not all of the upcoming changes to optional, though.
llvm-svn: 223775
Chandler Carruth [Tue, 9 Dec 2014 14:25:55 +0000 (14:25 +0000)]
[x86] Fix the test to actually test things for the CPU names, add the
missing barcelona CPU which that test uncovered, and remove the 32-bit
x86 CPUs which I really wasn't prepared to audit and test thoroughly.
If anyone wants to clean up the 32-bit only x86 CPUs, go for it.
Also, if anyone else wants to try to de-duplicate the AMD CPUs, that'd
be cool, but from the looks of it wouldn't save as much as it did for
the Intel CPUs.
llvm-svn: 223774
Aaron Ballman [Tue, 9 Dec 2014 13:20:11 +0000 (13:20 +0000)]
Removing an unused variable to silence a -Wunused-but-set-variable warning. NFC.
llvm-svn: 223773
Asiri Rathnayake [Tue, 9 Dec 2014 13:14:58 +0000 (13:14 +0000)]
Fix modified immediate bug reported by MC Hammer.
Instructions of the form [ADD Rd, pc, #imm] are manually aliased
in processInstruction() to use ADR. To accomodate this, mod_imm handling
had to be tweaked a bit. Turns out it was the manual aliasing that must
be tweaked to accommodate mod_imms instead. More information about the
parsed instruction is available at the point where processInstruction()
is invoked, which makes it easier to detect a mod_imm at that point rather
than trying to detect a potential alias when a mod_imm is being prepped.
Added a test case and fixed some white spaces as well.
llvm-svn: 223772
Alexander Kornienko [Tue, 9 Dec 2014 12:43:09 +0000 (12:43 +0000)]
[clang-tidy] Extended the example check, added a fix-it, etc.
llvm-svn: 223771
Chandler Carruth [Tue, 9 Dec 2014 11:19:57 +0000 (11:19 +0000)]
[x86] Add a test for the CPU names that should have been in r223769.
llvm-svn: 223770
Chandler Carruth [Tue, 9 Dec 2014 10:58:36 +0000 (10:58 +0000)]
[x86] Bring some sanity to the x86 CPU processor definitions.
Notably, this adds simple micro-architecture names for the Intel CPU
variants, and defines the old 'core'-based names as aliases. GCC has
started to simplify their documented interface to use these names as
well, so it seems like we can start to converge on a consistent pattern.
I'd appreciate Intel double checking the entries that aren't yet
documented widely, especially Atom (Bonnell and Silvermont), Knights
Landing, and Skylake. But this change shouldn't break any existing
users.
Also, ran clang-format to re-format this code and it actually worked
(modulo a tiny bug) so hopefully we can start to stop thinking about
formatting this stuff.
llvm-svn: 223769
Sonam Kumari [Tue, 9 Dec 2014 10:46:38 +0000 (10:46 +0000)]
Removal Of Duplicate Test Cases and Addition Of Missing Check Statements
llvm-svn: 223768
Ankur Garg [Tue, 9 Dec 2014 10:35:19 +0000 (10:35 +0000)]
[test/Transforms/InstCombine/shift.ll] Removed duplicate test cases. NFC.
Removed some duplicate test cases from the file /test/Transforms/InstCombine/shift.ll.
test54 and test57 were duplicates of each other.
test55 and test58 were duplicates of each other.
(Removed test57 and test58)
llvm-svn: 223767
Daniel Jasper [Tue, 9 Dec 2014 10:02:51 +0000 (10:02 +0000)]
clang-tidy: Add a basic python script to generate checks.
There are still a vast range of improvements that can be done to this,
but it seems like an ok initial version. Suggestions or patches are
highly welcome.
llvm-svn: 223766
Will Newton [Tue, 9 Dec 2014 08:58:31 +0000 (08:58 +0000)]
Improve emacs coding style
Remove setting of default style, this way is not recommended and
means that all the settings have to be duplicated to demonstrate the
c-add-style method which is a much better way of doing it.
Remove the modified date as it is better stored in SVN.
Tweak a few style parameters to make them conform to the actual LLVM
style.
llvm-svn: 223765
Chandler Carruth [Tue, 9 Dec 2014 08:55:32 +0000 (08:55 +0000)]
Teach instcombine to canonicalize "element extraction" from a load of an
integer and "element insertion" into a store of an integer into actual
element extraction, element insertion, and vector loads and stores.
Previously various parts of LLVM (including instcombine itself) would
introduce integer loads and stores into the code as a way of opaquely
loading and storing "bits". In some cases (such as a memcpy of
std::complex<float> object) we will eventually end up using those bits
in non-integer types. In order for SROA to effectively promote the
allocas involved, it splits these "store a bag of bits" integer loads
and stores up into the constituent parts. However, for non-alloca loads
and tsores which remain, it uses integer math to recombine the values
into a large integer to load or store.
All of this would be "fine", except that it forces LLVM to go through
integer math to combine and split up values. While this makes perfect
sense for integers (and in fact is critical for bitfields to end up
lowering efficiently) it is *terrible* for non-integer types, especially
floating point types. We have a much more canonical way of representing
the act of concatenating the bits of two SSA values in LLVM: a vector
and insertelement. This patch teaching InstCombine to use this
representation.
With this patch applied, LLVM will no longer introduce integer math into
the critical path of every loop over std::complex<float> operations such
as those that make up the hot path of ... oh, most HPC code, Eigen, and
any other heavy linear algebra library.
For the record, I looked *extensively* at fixing this in other parts of
the compiler, but it just doesn't work:
- We really do want to canonicalize memcpy and other bit-motion to
integer loads and stores. SSA values are tremendously more powerful
than "copy" intrinsics. Not doing this regresses massive amounts of
LLVM's scalar optimizer.
- We really do need to split up integer loads and stores of this form in
SROA or every memcpy of a trivially copyable struct will prevent SSA
formation of the members of that struct. It essentially turns off
SROA.
- The closest alternative is to actually split the loads and stores when
partitioning with SROA, but this has all of the downsides historically
discussed of splitting up loads and stores -- the wide-store
information is fundamentally lost. We would also see performance
regressions for bitfield-heavy code and other places where the
integers aren't really intended to be split without seemingly
arbitrary logic to treat integers totally differently.
- We *can* effectively fix this in instcombine, so it isn't that hard of
a choice to make IMO.
Differential Revision: http://reviews.llvm.org/D6548
llvm-svn: 223764
Michael Ilseman [Tue, 9 Dec 2014 08:20:06 +0000 (08:20 +0000)]
Skip declarations in the case of functions.
This is a revert of r223521 in spirit, if not in content. I am not
sure why declarations ended up in LazilyLinkGlobalValues in the first
place; that will take some more investigation.
llvm-svn: 223763
Craig Topper [Tue, 9 Dec 2014 08:05:51 +0000 (08:05 +0000)]
Use range-based for loops. NFC.
llvm-svn: 223762
Elena Demikhovsky [Tue, 9 Dec 2014 07:06:32 +0000 (07:06 +0000)]
AVX-512: Added some comments to ERI scalar intrinsics.
No functional change.
llvm-svn: 223761
Owen Anderson [Tue, 9 Dec 2014 06:50:39 +0000 (06:50 +0000)]
Fix a few instances found in SelectionDAG where we were not handling F16 at parity with F32 and F64.
llvm-svn: 223760
Duncan P. N. Exon Smith [Tue, 9 Dec 2014 06:35:37 +0000 (06:35 +0000)]
Revert "[modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1."
This reverts commit r223753. It broke the Green Dragon build for a few
hours:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/consoleFull#
43901905849ba4694-19c4-4d7e-bec5-
911270d8a58c
I suspect `clang-tools-extra` just needs a follow-up for an API change,
but I'm not the right one to look into it.
llvm-svn: 223759
Mohit K. Bhakkad [Tue, 9 Dec 2014 06:31:07 +0000 (06:31 +0000)]
test commit (spelling correction)
llvm-svn: 223758
Michael Kuperstein [Tue, 9 Dec 2014 06:10:44 +0000 (06:10 +0000)]
[X86] Convert esp-relative movs of function arguments into pushes, step 1
This handles the simplest case for mov -> push conversion:
1. x86-32 calling convention, everything is passed through the stack.
2. There is no reserved call frame.
3. Only registers or immediates are pushed, no attempt to combine a mem-reg-mem sequence into a single PUSHmm.
Differential Revision: http://reviews.llvm.org/D6503
llvm-svn: 223757
David Majnemer [Tue, 9 Dec 2014 05:56:09 +0000 (05:56 +0000)]
Reland r223754
The commit is identical except a reference to `GV' should have been to
`GVal'.
llvm-svn: 223756
David Majnemer [Tue, 9 Dec 2014 05:50:11 +0000 (05:50 +0000)]
Revert "AsmParser: Reject invalid mismatch between forward ref and def"
This reverts commit r223754. I've upset the buildbots.
llvm-svn: 223755
David Majnemer [Tue, 9 Dec 2014 05:43:56 +0000 (05:43 +0000)]
AsmParser: Reject invalid mismatch between forward ref and def
Don't assume that the forward referenced entity was of the same
global-kind as the new entity.
This fixes PR21779.
llvm-svn: 223754
Richard Smith [Tue, 9 Dec 2014 03:20:04 +0000 (03:20 +0000)]
[modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1.
For files named by -fmodule-map-file=, and files found by 'extern module'
directives, this flag specifies that we should resolve filenames relative to
the current working directory rather than relative to the directory in which
the module map file resides. This is aimed at fixing path handling, in
particular for relative -I paths, when building modules that represent
components of the current project (rather than libraries installed on the
current system, which the current project has as dependencies, where we'd
typically expect the module map files to be looked up implicitly).
llvm-svn: 223753
Stephane Sezer [Tue, 9 Dec 2014 03:18:09 +0000 (03:18 +0000)]
Implement remote process listing in Linux platform.
Summary:
Test Plan: Connect to a remote implementing the platform protocol (ds2 in this case), run `platform process list` and see processes being displayed.
Reviewers: vharron, tfiala, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D6571
llvm-svn: 223752
Bill Schmidt [Tue, 9 Dec 2014 03:02:48 +0000 (03:02 +0000)]
Restore r223709 as it was meant to be, and enable FeatureP8Vector for P8
llvm-svn: 223751
Nikola Smiljanic [Tue, 9 Dec 2014 02:57:56 +0000 (02:57 +0000)]
Handle newlines on Windows correctly.
llvm-svn: 223750
Oleksiy Vyalov [Tue, 9 Dec 2014 02:13:05 +0000 (02:13 +0000)]
Add Linux support for HostInfo::GetOSBuildString and HostInfo::GetOSKernelDescription.
llvm-svn: 223737
David Majnemer [Tue, 9 Dec 2014 01:36:45 +0000 (01:36 +0000)]
MS ABI: Add another test for PR20017
llvm-svn: 223733
Kostya Serebryany [Tue, 9 Dec 2014 01:31:14 +0000 (01:31 +0000)]
[tsan] remove TSAN_GO in favor of SANITIZER_GO
llvm-svn: 223732
Jim Ingham [Tue, 9 Dec 2014 01:28:22 +0000 (01:28 +0000)]
Simple test for file & line dummy breakpoints.
llvm-svn: 223731
Kostya Serebryany [Tue, 9 Dec 2014 01:22:59 +0000 (01:22 +0000)]
[asan] move GetRSS from tsan to sanitizer_common
llvm-svn: 223730
NAKAMURA Takumi [Tue, 9 Dec 2014 01:03:27 +0000 (01:03 +0000)]
Revert r223709, "[PowerPC]Activate FeatureVSX for the Power target", to unbreak bots.
CodeGen/PowerPC/vsx-p8.ll was failing.
'+power8-vector' is not a recognized feature for this target (ignoring feature)
llvm/test/CodeGen/PowerPC/vsx-p8.ll:33:14: error: expected string not found in input
; CHECK-REG: lxvw4x 34, 0, 3
^
<stdin>:50:2: note: scanning from here
.align 3
^
<stdin>:61:2: note: possible intended match here
lvx 3, 0, 3
^
llvm-svn: 223729
Peter Collingbourne [Tue, 9 Dec 2014 01:02:12 +0000 (01:02 +0000)]
Optimize comparisons to empty string.
Geo-mean performance improvement of 0.2% (-0.3% - 0.9% @ 95% CI).
Differential Revision: http://reviews.llvm.org/D6569
llvm-svn: 223728
Hal Finkel [Tue, 9 Dec 2014 01:00:59 +0000 (01:00 +0000)]
Handle early-clobber registers in the aggressive anti-dep breaker
The aggressive anti-dep breaker, used by the PowerPC backend during post-RA
scheduling (but is available to all targets), did not handle early-clobber MI
operands (at all). When constructing the list of available registers for the
replacement of some def operand, check the using instructions, and remove
registers assigned to early-clobbered defs from the set.
Fixes PR21452.
llvm-svn: 223727
David Blaikie [Tue, 9 Dec 2014 00:32:22 +0000 (00:32 +0000)]
DebugInfo: Correctly identify the location of C++ member initializer list elements
This particularly helps the fidelity of ASan reports (which can occur
even in these examples - if, for example, one uses placement new over a
buffer of insufficient size - now ASan will correctly identify which
member's initialization went over the end of the buffer).
This doesn't cover all types of members - more coming.
llvm-svn: 223726
Eric Christopher [Tue, 9 Dec 2014 00:28:24 +0000 (00:28 +0000)]
Add argument variable support to the debug info tutorial
and rearrange the prologue source location hack to immediately
after it.
llvm-svn: 223725
Richard Smith [Tue, 9 Dec 2014 00:14:36 +0000 (00:14 +0000)]
[modules] If the same .pcm file is imported via two different paths, don't
complain that the contained modules are defined twice.
llvm-svn: 223724
David Majnemer [Tue, 9 Dec 2014 00:12:30 +0000 (00:12 +0000)]
Revert "Driver: Objective-C should respect -fno-exceptions"
This reverts commit r223455. It's been succesfully argued that
-fexceptions (at the driver level) is a misnomer and has little to do
with -fobjc-exceptions.
llvm-svn: 223723
Tom Stellard [Tue, 9 Dec 2014 00:03:54 +0000 (00:03 +0000)]
R600/SI: Set MayStore = 0 on MUBUF loads
llvm-svn: 223722
Tom Stellard [Tue, 9 Dec 2014 00:03:51 +0000 (00:03 +0000)]
R600/SI: Move setting of the lds bit to the base MUBUF class
llvm-svn: 223721
Colin LeMahieu [Mon, 8 Dec 2014 23:55:43 +0000 (23:55 +0000)]
[Hexagon] Removing old def versions and replacing usages with versions that have encodings.
llvm-svn: 223720
Tom Stellard [Mon, 8 Dec 2014 23:36:48 +0000 (23:36 +0000)]
MISched: Fix moving stores across barriers
This fixes an issue with ScheduleDAGInstrs::buildSchedGraph
where stores without an underlying object would not be added
as a predecessor to the current BarrierChain.
llvm-svn: 223717
Alexey Samsonov [Mon, 8 Dec 2014 23:28:07 +0000 (23:28 +0000)]
Update bogus file permissions.
Suggested in http://reviews.llvm.org/D6547.
llvm-svn: 223715
Nico Weber [Mon, 8 Dec 2014 23:25:55 +0000 (23:25 +0000)]
Add a test for MS-ABI this adjustment for virtual calls to member operators.
They too were fixed by r223185, despite the commit message saying otherwise.
Add a test that makes sure they don't regress.
llvm-svn: 223714
Enrico Granata [Mon, 8 Dec 2014 23:13:56 +0000 (23:13 +0000)]
Add the ability for an SBValue to create a persisted version of itself.
Such a persisted version is equivalent to evaluating the value via the expression evaluator, and holding on to the $n result of the expression, except this API can be used on SBValues that do not obviously come from an expression (e.g. are the result of a memory lookup)
Expose this via SBValue::Persist() in our public API layer, and ValueObject::Persist() in the lldb_private layer
Includes testcase
Fixes rdar://
19136664
llvm-svn: 223711
Colin LeMahieu [Mon, 8 Dec 2014 23:07:59 +0000 (23:07 +0000)]
[Hexagon] Adding any8, all8, and/or/xor/andn/orn/not predicate register forms, mask, and vitpack instructions and patterns.
llvm-svn: 223710
Bill Seurer [Mon, 8 Dec 2014 23:07:12 +0000 (23:07 +0000)]
[PowerPC]Activate FeatureVSX for the Power target
This change activates FeatureVSX for Power 7 and Power 8 in PPC.td.
http://reviews.llvm.org/D6570
llvm-svn: 223709
Hal Finkel [Mon, 8 Dec 2014 22:54:22 +0000 (22:54 +0000)]
[PowerPC] Don't use a non-allocatable register to implement the 'cc' alias
GCC accepts 'cc' as an alias for 'cr0', and we need to do the same when
processing inline asm constraints. This had previously been implemented using a
non-allocatable register, named 'cc', that was listed as an alias of 'cr0', but
the infrastructure does not seem to support this properly (neither the register
allocator nor the scheduler properly accounts for the alias). Instead, we can
just process this as a naming alias inside of the inline asm
constraint-processing code, so we'll do that instead.
There are two regression tests, one where the post-RA scheduler did the wrong
thing with the non-allocatable alias, and one where the register allocator did
the wrong thing. Fixes PR21742.
llvm-svn: 223708
Kaelyn Takata [Mon, 8 Dec 2014 22:41:42 +0000 (22:41 +0000)]
Handle possible TypoExprs in member initializers.
Includes a new test case since none of the existing tests were hitting
this code path.
llvm-svn: 223705
Colin LeMahieu [Mon, 8 Dec 2014 22:29:06 +0000 (22:29 +0000)]
[Hexagon] Fixing broken test.
llvm-svn: 223704
Colin LeMahieu [Mon, 8 Dec 2014 22:19:14 +0000 (22:19 +0000)]
[Hexagon] Adding xtype doubleword add, sub, and, or, xor and patterns.
llvm-svn: 223702
Colin LeMahieu [Mon, 8 Dec 2014 21:56:47 +0000 (21:56 +0000)]
[Hexagon] Adding xtype doubleword comparisons. Removing unused multiclass.
llvm-svn: 223701
Zachary Turner [Mon, 8 Dec 2014 21:50:05 +0000 (21:50 +0000)]
Fix platform shell test to run "dir c:\" instead of "ls /" on Windows.
llvm-svn: 223700
David Blaikie [Mon, 8 Dec 2014 21:48:57 +0000 (21:48 +0000)]
DebugInfo: Ensure the store for an assignment is attributed to the beginning of the assignment expression
llvm-svn: 223699
Zachary Turner [Mon, 8 Dec 2014 21:36:42 +0000 (21:36 +0000)]
Fix some posix assumptions related to running shell commands.
This is a resubmit of r223548, which was reverted due to breaking
tests on Linux and Mac.
This resubmit fixes the reason for the revert by adding back some
accidentally removed code which appends -c to the command line
when running /bin/sh.
This resubmit also differs from the original patch in that it sets
the architecture on the ProcessLaunchInfo. A follow-up patch will
refactor this to separate the logic for different platforms.
Differential Revision: http://reviews.llvm.org/D6553
Reviewed By: Greg Clayton
llvm-svn: 223695
Daniel Jasper [Mon, 8 Dec 2014 21:28:31 +0000 (21:28 +0000)]
clang-format: Indent correctly in conditional expressions after return.
This only applies when not aligning after the return itself (which is
commonly done for C++.
Before:
return
aaaaaaaaaa
?
bbbbbbbbbb(
bbbbbb) // This is indented relative to
aaaaaaaaaa.
: b;
After:
return
aaaaaaaaaa
?
bbbbbbbbbb(
bbbbbb)
: b;
llvm-svn: 223694
Colin LeMahieu [Mon, 8 Dec 2014 21:19:18 +0000 (21:19 +0000)]
[Hexagon] Adding xtype parity, min, minu, max, maxu instructions.
llvm-svn: 223693
Colin LeMahieu [Mon, 8 Dec 2014 20:33:01 +0000 (20:33 +0000)]
[Hexagon] Adding xtype halfword add/sub ll/hl/lh/hh/sat/<<16 instructions.
llvm-svn: 223692
Peter Collingbourne [Mon, 8 Dec 2014 20:30:39 +0000 (20:30 +0000)]
Make myself the code owner for llgo.
llvm-svn: 223691
Samuel Benzaquen [Mon, 8 Dec 2014 20:17:58 +0000 (20:17 +0000)]
Fix isInstantiated and isInTemplateInstantiation to not recreate the matchers on each call.
Summary:
Store the result matcher after the first call and reuse it later on.
Recreating the matchers just to use them once incurs in a lot of
unnecessary temporary memory allocations.
This change speeds up our clang-tidy benchmarks by ~2%.
Reviewers: klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D6564
llvm-svn: 223690
Peter Collingbourne [Mon, 8 Dec 2014 20:12:22 +0000 (20:12 +0000)]
Add .arcconfig file.
llvm-svn: 223689
Daniel Jasper [Mon, 8 Dec 2014 20:08:04 +0000 (20:08 +0000)]
clang-format: [Java] Always break after annotations of multiline decls.
Before:
@Mock DataLoader loooooooooooooooooooooooader =
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
After:
@Mock
DataLoader loooooooooooooooooooooooader =
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
llvm-svn: 223688
Zachary Turner [Mon, 8 Dec 2014 20:00:33 +0000 (20:00 +0000)]
Remove use of GCC-style intrinsics, as they are non-portable.
Differential Revision: http://reviews.llvm.org/D6567
llvm-svn: 223687