oota-llvm.git
9 years ago[x86] Teach the vector shuffle lowering to make a more nuanced decision
Chandler Carruth [Thu, 13 Nov 2014 04:06:10 +0000 (04:06 +0000)]
[x86] Teach the vector shuffle lowering to make a more nuanced decision
between splitting a vector into 128-bit lanes and recombining them vs.
decomposing things into single-input shuffles and a final blend.

This handles a large number of cases in AVX1 where the cross-lane
shuffles would be much more expensive to represent even though we end up
with a fast blend at the root. Instead, we can do a better job of
shuffling in a single lane and then inserting it into the other lanes.

This fixes the remaining bits of Halide's regression captured in PR21281
for AVX1. However, the bug persists in AVX2 because I've made this
change reasonably conservative. The cases where it makes sense in AVX2
to split into 128-bit lanes are much more rare because we can often do
full permutations across all elements of the 256-bit vector. However,
the particular test case in PR21281 is an example of one of the rare
cases where it is *always* better to work in a single 128-bit lane. I'm
going to try to teach the logic to detect and form the good code even in
AVX2 next, but it will need to use a separate heuristic.

Finally, there is one pesky regression here where we previously would
craftily use vpermilps in AVX1 to shuffle both high and low halves at
the same time. We no longer pull that off, and not for any really good
reason. Ultimately, I think this is just another missing nuance to the
selection heuristic that I'll try to add in afterward, but this change
already seems strictly worth doing considering the magnitude of the
improvements in common matrix math shuffle patterns.

As always, please let me know if this causes a surprising regression for
you.

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

9 years agollvm-readobj: Print out address table when dumping COFF delay-import table
Rui Ueyama [Thu, 13 Nov 2014 03:22:54 +0000 (03:22 +0000)]
llvm-readobj: Print out address table when dumping COFF delay-import table

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

9 years agoAdd an assert and a test that verify r221709's fix.
Frederic Riss [Thu, 13 Nov 2014 03:20:23 +0000 (03:20 +0000)]
Add an assert and a test that verify r221709's fix.

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

9 years ago[x86] Don't form overly fragmented blends when splitting and
Chandler Carruth [Thu, 13 Nov 2014 02:42:08 +0000 (02:42 +0000)]
[x86] Don't form overly fragmented blends when splitting and
re-combining shuffles because nothing was available in the wider vector
type.

The key observation (which I've put in the comments for future
maintainers) is that at this point, no further combining is really
possible. And so even though these shuffles trivially could be combined,
we need to actually do that as we produce them when producing them this
late in the lowering.

This fixes another (huge) part of the Halide vector shuffle regressions.
As it happens, this was already well covered by the tests, but I hadn't
noticed how bad some of these got. The specific patterns that turn
directly into unpckl/h patterns were occurring *many* times in common
vector processing code.

There are still more problems here sadly, but trying to incrementally
tease them apart and it looks like this is the core of the problem in
the splitting logic.

There is some chance of regression here, you can see it in the test
changes. Specifically, where we stop forming pshufb in some cases, it is
possible that pshufb was in fact faster. Intel "says" that pshufb is
slower than the instruction sequences replacing it.

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

9 years ago[CodeGenPrepare] Handle zero extensions in the TypePromotionHelper.
Quentin Colombet [Thu, 13 Nov 2014 01:44:51 +0000 (01:44 +0000)]
[CodeGenPrepare] Handle zero extensions in the TypePromotionHelper.

Prior to this patch the TypePromotionHelper was promoting only sign extensions.
Supporting zero extensions changes:
- How constants are extended.
- How sign extensions, zero extensions, and truncate are composed together.
- How the type of the extended operation is recorded. Now we need to know the
  kind of the extension as well as its type.

Each change is fairly small, unlike the diff.
Most of the diff are comments/variable renaming to say "extension" instead of
"sign extension".

The performance improvements on the test suite are within the noise.

Related to <rdar://problem/18310086>.

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

9 years agoCMake: stop setting (well, #undef'ing) HOST_LINK_VERSION; it's used in Clang, not...
Hans Wennborg [Thu, 13 Nov 2014 00:51:12 +0000 (00:51 +0000)]
CMake: stop setting (well, #undef'ing) HOST_LINK_VERSION; it's used in Clang, not LLVM

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

9 years ago[FastISel][AArch64] Optimize select when one of the operands is a 'true' or 'false...
Juergen Ributzka [Thu, 13 Nov 2014 00:36:46 +0000 (00:36 +0000)]
[FastISel][AArch64] Optimize select when one of the operands is a 'true' or 'false' value.

Optimize selects of i1 in the presence of 'true' and 'false' operands to simple
logic operations.

This fixes rdar://problem/18960150.

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

9 years ago[FastISel][AArch64] Fold the cmp into the select when possible.
Juergen Ributzka [Thu, 13 Nov 2014 00:36:43 +0000 (00:36 +0000)]
[FastISel][AArch64] Fold the cmp into the select when possible.

This folds the compare emission into the select emission when possible, so we
can directly use the flags and don't have to emit a separate compare.

Related to rdar://problem/18960150.

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

9 years ago[FastISel][AArch64] Extend 'select' lowering to support also i1 to i16.
Juergen Ributzka [Thu, 13 Nov 2014 00:36:38 +0000 (00:36 +0000)]
[FastISel][AArch64] Extend 'select' lowering to support also i1 to i16.

Related to rdar://problem/18960150.

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

9 years agoDrop a few unneeded ctor calls (missed code review comment).
Paul Robinson [Thu, 13 Nov 2014 00:36:34 +0000 (00:36 +0000)]
Drop a few unneeded ctor calls (missed code review comment).

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

9 years agoRevert "[dwarfdump] Add support for dumping accelerator tables."
Frederic Riss [Thu, 13 Nov 2014 00:15:15 +0000 (00:15 +0000)]
Revert "[dwarfdump] Add support for dumping accelerator tables."

This reverts commit r221836.

The tests are asserting on some buildbots. This also reverts the
test part of r221837 as it relies on dwarfdump dumping the
accelerator tables.

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

9 years agoImprove long path name support on Windows.
Paul Robinson [Thu, 13 Nov 2014 00:12:14 +0000 (00:12 +0000)]
Improve long path name support on Windows.

Windows normally limits the length of an absolute path name to 260
characters; directories can have lower limits.  These limits increase
to about 32K if you use absolute paths with the special '\\?\'
prefix. Teach Support\Windows\Path.inc to use that prefix as needed.

TODO: Other parts of Support could also learn to use this prefix.

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

9 years ago[Bitcode] AtEndOfStream should only check against the size if it's known.
Jordan Rose [Thu, 13 Nov 2014 00:08:41 +0000 (00:08 +0000)]
[Bitcode] AtEndOfStream should only check against the size if it's known.

This avoids an issue where AtEndOfStream mistakenly returns true at the /start/ of
a stream.

(In the rare case that the size is known and actually 0, the slow path will still
handle it correctly.)

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

9 years agoTeach ScalarEvolution to sharpen range information.
Sanjoy Das [Thu, 13 Nov 2014 00:00:58 +0000 (00:00 +0000)]
Teach ScalarEvolution to sharpen range information.

If x is known to have the range [a, b), in a loop predicated by (icmp
ne x, a) its range can be sharpened to [a + 1, b).  Get
ScalarEvolution and hence IndVars to exploit this fact.

This change triggers an optimization to widen-loop-comp.ll, so it had
to be edited to get it to pass.

This change was originally landed in r219834 but had a bug and broke
ASan. It was reverted in r219878, and is now being re-landed after
fixing the original bug.

phabricator: http://reviews.llvm.org/D5639
reviewed by: atrick

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

9 years agoFix emission of Dwarf accelerator table when there are multiple CUs.
Frederic Riss [Wed, 12 Nov 2014 23:48:14 +0000 (23:48 +0000)]
Fix emission of Dwarf accelerator table when there are multiple CUs.

The DIE offset in the accel tables is an offset relative to the start
of the debug_info section, but we were encoding the offset to the
start of the containing CU.

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

9 years ago[dwarfdump] Add support for dumping accelerator tables.
Frederic Riss [Wed, 12 Nov 2014 23:48:10 +0000 (23:48 +0000)]
[dwarfdump] Add support for dumping accelerator tables.

The class used for the dump only allows to dump for the moment, but
it can (and will) be easily extended to support search also.

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

9 years agoAllow DWARFFormValue::extractValue to be called with a null CU.
Frederic Riss [Wed, 12 Nov 2014 23:48:04 +0000 (23:48 +0000)]
Allow DWARFFormValue::extractValue to be called with a null CU.

Currently FormValues are only used for attributes of DIEs and thus
uers always have a CU lying around when calling into the FormValue
API.
Accelerator tables encode their information using the same Forms
as the attributes, thus it is natural to use DWARFFormValue to
extract/dump them. There is no CU in that case though. Allow the
API to be called with a null CU arguemnt by making the RelocMap
lookup conditional on the CU pointer validity. And document this
new behvior in the header. (Test coverage for this use of the API
comes in the DwarfAccelTable support patch)

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

9 years agoRemove unsused variables.
Frederic Riss [Wed, 12 Nov 2014 23:48:01 +0000 (23:48 +0000)]
Remove unsused variables.

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

9 years ago[CodeGenPrepare] Replace other uses of EVT::getEVT with TL::getValueType.
Ahmed Bougacha [Wed, 12 Nov 2014 23:05:03 +0000 (23:05 +0000)]
[CodeGenPrepare] Replace other uses of EVT::getEVT with TL::getValueType.

r221820 fixed a problem (PR21548) where an iPTR was used in TLI legality checks,
which isn't valid and resulted in a failed assertion.
The solution was to lower pointer types into the correct target's VT, by
using TL::getValueType instead of EVT::getEVT.

This commit changes 3 other uses of EVT::getEVT, but without any tests:
- One of these non-lowered EVTs is passed to allowsMisalignedMemoryAccesses,
which goes into target's TL implementation and doesn't cause any problem (yet.)
- Two others are passed to TLI.isOperationLegalOrCustom:
  - one only looks at extensions, so doesn't concern pointers.
  - one only looks at binary operators, so also isn't a problem.

The latter might some day be exposed to pointers and cause the same assert as
the original PR, because there's a comment hinting at also supporting cast ops.

For consistency, update all of them and be done with it.

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

9 years ago[CodeGenPrepare][AArch64] Fix a TLI legality check on iPTR to use a lowered instead.
Ahmed Bougacha [Wed, 12 Nov 2014 22:16:55 +0000 (22:16 +0000)]
[CodeGenPrepare][AArch64] Fix a TLI legality check on iPTR to use a lowered instead.

Fixes PR21548.  Related to PR20474.

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

9 years agoExpose the number of Newton-Raphson iterations applied to the hardware's reciprocal...
Sanjay Patel [Wed, 12 Nov 2014 21:39:01 +0000 (21:39 +0000)]
Expose the number of Newton-Raphson iterations applied to the hardware's reciprocal estimate as a parameter (x86).

This is a follow-on to r221706 and r221731 and discussed in more detail in PR21385.

This patch also loosens the testcase checking for btver2. We know that the "1.0" will be loaded, but
we can't tell exactly when, so replace the CHECK-NEXT specifiers with plain CHECKs. The CHECK-NEXT
sequence relied on a quirk of post-RA-scheduling that may change independently of anything in these tests.

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

9 years agoAdd fortified (__*_chk) library functions to TLI (NFC)
Ahmed Bougacha [Wed, 12 Nov 2014 21:23:34 +0000 (21:23 +0000)]
Add fortified (__*_chk) library functions to TLI (NFC)

One of them (__memcpy_chk) was already there, the others were checked
by comparing function names.
Note that the fortified libfuncs are now part of TLI, but are always
available, because they aren't generated, only optimized into the
non-checking versions.

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

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

9 years agoTemporary fix for PR21528 - use mangled C++ function names in COFF debug info to...
Timur Iskhodzhanov [Wed, 12 Nov 2014 20:21:20 +0000 (20:21 +0000)]
Temporary fix for PR21528 - use mangled C++ function names in COFF debug info to un-break ASan on Windows

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

9 years ago[COFF] Make it clearer that the symbols subsection holds function display name rather...
Timur Iskhodzhanov [Wed, 12 Nov 2014 20:10:09 +0000 (20:10 +0000)]
[COFF] Make it clearer that the symbols subsection holds function display name rather than just name

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

9 years ago[AVX512] Add integer shift by immediate intrinsics.
Cameron McInally [Wed, 12 Nov 2014 19:58:54 +0000 (19:58 +0000)]
[AVX512] Add integer shift by immediate intrinsics.

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

9 years agoChanging a StringRef::begin() call into StringRef::data(); NFC.
Aaron Ballman [Wed, 12 Nov 2014 19:43:13 +0000 (19:43 +0000)]
Changing a StringRef::begin() call into StringRef::data(); NFC.

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

9 years agoUse the return of readBytes to find out if we are at the end of the stream.
Rafael Espindola [Wed, 12 Nov 2014 18:37:00 +0000 (18:37 +0000)]
Use the return of readBytes to find out if we are at the end of the stream.

This allows the removal of isObjectEnd and opens the way for reading 64 bits
at a time.

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

9 years agoCGSCC should not treat intrinsic calls like function calls (PR21403)
Sanjay Patel [Wed, 12 Nov 2014 18:25:47 +0000 (18:25 +0000)]
CGSCC should not treat intrinsic calls like function calls (PR21403)

Make the handling of calls to intrinsics in CGSCC consistent:
they are not treated like regular function calls because they
are never lowered to function calls.

Without this patch, we can get dangling pointer asserts from
the subsequent loop that processes callsites because it already
ignores intrinsics.

See http://llvm.org/bugs/show_bug.cgi?id=21403 for more details / discussion.

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

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

9 years agoFix broken doxygen annotations, NFC
Jingyue Wu [Wed, 12 Nov 2014 18:25:06 +0000 (18:25 +0000)]
Fix broken doxygen annotations, NFC

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

9 years agoDisable indvar widening if arithmetics on the wider type are more expensive
Jingyue Wu [Wed, 12 Nov 2014 18:09:15 +0000 (18:09 +0000)]
Disable indvar widening if arithmetics on the wider type are more expensive

Summary:
Reapply r221772. The old patch breaks the bot because the @indvar_32_bit test
was run whether NVPTX was enabled or not.

IndVarSimplify should not widen an indvar if arithmetics on the wider
indvar are more expensive than those on the narrower indvar. For
instance, although NVPTX64 treats i64 as a legal type, an ADD on i64 is
twice as expensive as that on i32, because the hardware needs to
simulate a 64-bit integer using two 32-bit integers.

Split from D6188, and based on D6195 which adds NVPTXTargetTransformInfo.

Fixes PR21148.

Test Plan:
Added @indvar_32_bit that verifies we do not widen an indvar if the arithmetics
on the wider type are more expensive. This test is run only when NVPTX is
enabled.

Reviewers: jholewinski, eliben, meheff, atrick

Reviewed By: atrick

Subscribers: jholewinski, llvm-commits

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

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

9 years agoremove function names from comments; NFC
Sanjay Patel [Wed, 12 Nov 2014 18:07:42 +0000 (18:07 +0000)]
remove function names from comments; NFC

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

9 years agoReturn the number of read bytes in MemoryObject::readBytes.
Rafael Espindola [Wed, 12 Nov 2014 17:11:16 +0000 (17:11 +0000)]
Return the number of read bytes in MemoryObject::readBytes.

Returning more information will allow BitstreamReader to be simplified a bit
and changed to read 64 bits at a time.

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

9 years agoRevert part of the PIC tests (TLS part)
Justin Hibbits [Wed, 12 Nov 2014 16:50:15 +0000 (16:50 +0000)]
Revert part of the PIC tests (TLS part)

This change actually wasn't warranted for -O0, and the new changes prove it and
break the build.

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

9 years agoFix thet tests.
Justin Hibbits [Wed, 12 Nov 2014 16:40:00 +0000 (16:40 +0000)]
Fix thet tests.

I seem to have missed the update I made for changing 'flag_pic' to "PIC Level".
Mea culpa.

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

9 years agoAdd support for small-model PIC for PowerPC.
Justin Hibbits [Wed, 12 Nov 2014 15:16:30 +0000 (15:16 +0000)]
Add support for small-model PIC for PowerPC.

Summary:
Large-model was added first.  With the addition of support for multiple PIC
models in LLVM, now add small-model PIC for 32-bit PowerPC, SysV4 ABI.  This
generates more optimal code, for shared libraries with less than about 16380
data objects.

Test Plan: Test cases added or updated

Reviewers: joerg, hfinkel

Reviewed By: hfinkel

Subscribers: jholewinski, mcrosier, emaste, llvm-commits

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

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

9 years agoReduce code duplication a bit. NFC.
Rafael Espindola [Wed, 12 Nov 2014 14:48:38 +0000 (14:48 +0000)]
Reduce code duplication a bit. NFC.

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

9 years agoFix the test.
Rafael Espindola [Wed, 12 Nov 2014 14:23:04 +0000 (14:23 +0000)]
Fix the test.

It was broken since r221708.

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

9 years agoFixing more -Wcast-qual warnings; NFC.
Aaron Ballman [Wed, 12 Nov 2014 14:01:17 +0000 (14:01 +0000)]
Fixing more -Wcast-qual warnings; NFC.

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

9 years agoFixing a -Wcast-qual warning; NFC.
Aaron Ballman [Wed, 12 Nov 2014 13:55:27 +0000 (13:55 +0000)]
Fixing a -Wcast-qual warning; NFC.

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

9 years ago[mips][micromips] Add predicate 'InMicroMips' at CodeGen patterns for microMIPS instr...
Zoran Jovanovic [Wed, 12 Nov 2014 13:30:10 +0000 (13:30 +0000)]
[mips][micromips] Add predicate 'InMicroMips' at CodeGen patterns for microMIPS instructions
Differential Revision: http://reviews.llvm.org/D6198

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

9 years ago[x86] Start improving the matching of unpck instructions based on test
Chandler Carruth [Wed, 12 Nov 2014 10:05:18 +0000 (10:05 +0000)]
[x86] Start improving the matching of unpck instructions based on test
cases from Halide folks. This initial step was extracted from
a prototype change by Clay Wood to try and address regressions found
with Halide and the new vector shuffle lowering.

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

9 years ago[x86] Clean up a bunch of vector shuffle tests with my script. Notably,
Chandler Carruth [Wed, 12 Nov 2014 09:17:15 +0000 (09:17 +0000)]
[x86] Clean up a bunch of vector shuffle tests with my script. Notably,
removes windows line endings and other noise. This is in prelude to
making substantive changes to these tests.

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

9 years agoMCDisassembler::getInstruction():: Prune also "\param Region", since it was removed...
NAKAMURA Takumi [Wed, 12 Nov 2014 07:42:26 +0000 (07:42 +0000)]
MCDisassembler::getInstruction():: Prune also "\param Region", since it was removed in r221751. [-Wdocumentation]

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

9 years agoAVX-512: Intrinsics for ERI
Elena Demikhovsky [Wed, 12 Nov 2014 07:31:03 +0000 (07:31 +0000)]
AVX-512: Intrinsics for ERI
3 instructions: vrcp28, vrsqrt28, vexp2, only vector forms.
Intrinsics include SAE (Suppres All Exceptions) parameter.

http://reviews.llvm.org/D6214

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

9 years agoReverts r221772 which fails tests
Jingyue Wu [Wed, 12 Nov 2014 07:19:25 +0000 (07:19 +0000)]
Reverts r221772 which fails tests

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

9 years agoDisable indvar widening if arithmetics on the wider type are more expensive
Jingyue Wu [Wed, 12 Nov 2014 06:58:45 +0000 (06:58 +0000)]
Disable indvar widening if arithmetics on the wider type are more expensive

Summary:
IndVarSimplify should not widen an indvar if arithmetics on the wider
indvar are more expensive than those on the narrower indvar. For
instance, although NVPTX64 treats i64 as a legal type, an ADD on i64 is
twice as expensive as that on i32, because the hardware needs to
simulate a 64-bit integer using two 32-bit integers.

Split from D6188, and based on D6195 which adds NVPTXTargetTransformInfo.

Fixes PR21148.

Test Plan:
Added @indvar_32_bit that verifies we do not widen an indvar if the arithmetics
on the wider type are more expensive.

Reviewers: jholewinski, eliben, meheff, atrick

Reviewed By: atrick

Subscribers: jholewinski, llvm-commits

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

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

9 years agoDelete dead code. NFC.
Rafael Espindola [Wed, 12 Nov 2014 04:31:19 +0000 (04:31 +0000)]
Delete dead code. NFC.

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

9 years ago[PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
Bill Schmidt [Wed, 12 Nov 2014 04:19:40 +0000 (04:19 +0000)]
[PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics

This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New LLVM intrinsics are provided to represent these four instructions
in IntrinsicsPowerPC.td.  These are patterned after the similar
intrinsics for lvx and stvx (Altivec).  In PPCInstrVSX.td, these
intrinsics are tied to the code gen patterns, with additional patterns
to allow plain vanilla loads and stores to still generate these
instructions.

At -O1 and higher the intrinsics are immediately converted to loads
and stores in InstCombineCalls.cpp.  This will open up more
optimization opportunities while still allowing the correct
instructions to be generated.  (Similar code exists for aligned
Altivec loads and stores.)

The new intrinsics are added to the code that checks for consecutive
loads and stores in PPCISelLowering.cpp, as well as to
PPCTargetLowering::getTgtMemIntrinsic().

There's a new test to verify the correct instructions are generated.
The loads and stores tend to be reordered, so the test just counts
their number.  It runs at -O2, as it's not very effective to test this
at -O0, when many unnecessary loads and stores are generated.

I ended up having to modify vsx-fma-m.ll.  It turns out this test case
is slightly unreliable, but I don't know a good way to prevent
problems with it.  The xvmaddmdp instructions read and write the same
register, which is one of the multiplicands.  Commutativity allows
either to be chosen.  If the FMAs are reordered differently than
expected by the test, the register assignment can be different as a
result.  Hopefully this doesn't change often.

There is a companion patch for Clang.

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

9 years agoMerge StreamableMemoryObject into MemoryObject.
Rafael Espindola [Wed, 12 Nov 2014 03:55:46 +0000 (03:55 +0000)]
Merge StreamableMemoryObject into MemoryObject.

Every MemoryObject is a StreamableMemoryObject since the removal of
StringRefMemoryObject, so just merge the two.

I will clean up the MemoryObject interface in the upcoming commits.

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

9 years agoFix non-variadic function_ref cases to match r221753
David Blaikie [Wed, 12 Nov 2014 03:28:57 +0000 (03:28 +0000)]
Fix non-variadic function_ref cases to match r221753

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

9 years agoDon't duplicate name in comments. NFC.
Rafael Espindola [Wed, 12 Nov 2014 03:25:45 +0000 (03:25 +0000)]
Don't duplicate name in comments. NFC.

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

9 years agoRevert "Use a function_ref now that it works (r221753)."
Rafael Espindola [Wed, 12 Nov 2014 03:17:33 +0000 (03:17 +0000)]
Revert "Use a function_ref now that it works (r221753)."

This reverts commit r221756.

David Blaikie pointed out it was unsafe.

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

9 years agoRemove unused method. NFC.
Rafael Espindola [Wed, 12 Nov 2014 02:35:31 +0000 (02:35 +0000)]
Remove unused method. NFC.

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

9 years agoMake readBytes pure virtual. Every real implementation has it.
Rafael Espindola [Wed, 12 Nov 2014 02:30:38 +0000 (02:30 +0000)]
Make readBytes pure virtual. Every real implementation has it.

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

9 years agoRemove unused method. NFC.
Rafael Espindola [Wed, 12 Nov 2014 02:27:40 +0000 (02:27 +0000)]
Remove unused method. NFC.

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

9 years agoUse a function_ref now that it works (r221753).
Rafael Espindola [Wed, 12 Nov 2014 02:23:37 +0000 (02:23 +0000)]
Use a function_ref now that it works (r221753).

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

9 years agoRemove the now unused StringRefMemoryObject.h.
Rafael Espindola [Wed, 12 Nov 2014 02:13:27 +0000 (02:13 +0000)]
Remove the now unused StringRefMemoryObject.h.

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

9 years agoEnsure function_refs are copyable even from non-const references
David Blaikie [Wed, 12 Nov 2014 02:06:08 +0000 (02:06 +0000)]
Ensure function_refs are copyable even from non-const references

A subtle bug was found where attempting to copy a non-const function_ref
lvalue would actually invoke the generic forwarding constructor (as it
was a closer match - being T& rather than the const T& of the implicit
copy constructor). In the particular case this lead to a dangling
function_ref member (since it had referenced the function_ref passed by
value to its ctor, rather than the outer function_ref that was still
alive)

SFINAE the converting constructor to not be considered if the copy
constructor is available and demonstrate that this causes the copy to
refer to the original functor, not to the function_ref it was copied
from. (without the code change, the test would fail as Y would be
referencing X and Y() would see the result of the mutation to X, ie: 2)

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

9 years agoPass an ArrayRef to MCDisassembler::getInstruction.
Rafael Espindola [Wed, 12 Nov 2014 02:04:27 +0000 (02:04 +0000)]
Pass an ArrayRef to MCDisassembler::getInstruction.

With this patch MCDisassembler::getInstruction takes an ArrayRef<uint8_t>
instead of a MemoryObject.

Even on X86 there is a maximum size an instruction can have. Given
that, it seems way simpler and more efficient to just pass an ArrayRef
to the disassembler instead of a MemoryObject and have it do a virtual
call every time it wants some extra bytes.

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

9 years agoObject, support both mach-o archive t.o.c file names
Nick Kledzik [Wed, 12 Nov 2014 01:37:45 +0000 (01:37 +0000)]
Object, support both mach-o archive t.o.c file names

For historical reasons archives on mach-o have two possible names for the
file containing the table of contents for the archive: "__.SYMDEF SORTED"
and "__.SYMDEF".  But the libObject archive reader only supported the former.

This patch fixes llvm::object::Archive to support both names.

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

9 years agoRemove a bit of dead code.
Rafael Espindola [Wed, 12 Nov 2014 01:27:22 +0000 (01:27 +0000)]
Remove a bit of dead code.

Every "real" object file implements this an ptx doesn't use it.

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

9 years agoExtend intrinsic name mangling to support arrays, named structs, and function types.
Philip Reames [Wed, 12 Nov 2014 00:21:51 +0000 (00:21 +0000)]
Extend intrinsic name mangling to support arrays, named structs, and function types.

Currently, we have a type parameter mechanism for intrinsics. Rather than having to specify a separate intrinsic for each combination of argument and return types, we can specify a single intrinsic with one or more type parameters. These type parameters are passed explicitly to Intrinsic::getDeclaration or can be specified implicitly in the naming of the intrinsic function in an LL file.

Today, the types are limited to integer, floating point, and pointer types. With a goal of supporting symbolic targets for patchpoints and statepoints, this change adds support for function types.  The change also includes support for first class aggregate types (named structures and arrays) since these appear in function types we've encountered.

Reviewed by: atrick, ributzka
Differential Revision: http://reviews.llvm.org/D4608

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

9 years agoMake TreePattern::error use Twine
Matt Arsenault [Tue, 11 Nov 2014 23:48:11 +0000 (23:48 +0000)]
Make TreePattern::error use Twine

The underlying error function already uses a Twine,
and most of the uses build up strings.

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

9 years ago[Reassociate] Canonicalize negative constants out of expressions.
Chad Rosier [Tue, 11 Nov 2014 23:36:42 +0000 (23:36 +0000)]
[Reassociate] Canonicalize negative constants out of expressions.

Add support for FDiv, which was regressed by the previous commit.

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

9 years agoCanonicalize an assume(load != null) into !nonnull metadata
Philip Reames [Tue, 11 Nov 2014 23:33:19 +0000 (23:33 +0000)]
Canonicalize an assume(load != null) into !nonnull metadata

We currently have two ways of informing the optimizer that the result of a load is never null: metadata and assume. This change converts the second in to the former. This avoids a need to implement optimizations using both forms.

We should probably extend this basic idea to metadata of other forms; in particular, range metadata. We view is that assumes should be considered a "last resort" for when there isn't a more canonical way to represent something.

Reviewed by: Hal
Differential Revision: http://reviews.llvm.org/D5951

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

9 years agolibLTO: Allow linker to choose context of modules and codegen
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 23:19:23 +0000 (23:19 +0000)]
libLTO: Allow linker to choose context of modules and codegen

Add API for specifying which `LLVMContext` each `lto_module_t` and
`lto_code_gen_t` is in.

In particular, this enables the following flow:

    for (auto &File : Files) {
      lto_module_t M = lto_module_create_in_local_context(File...);
      querySymbols(M);
      lto_module_dispose(M);
    }

    lto_code_gen_t CG = lto_codegen_create_in_local_context();
    for (auto &File : FilesToLink) {
      lto_module_t M = lto_module_create_in_codegen_context(File..., CG);
      lto_codegen_add_module(CG, M);
      lto_module_dispose(M);
    }
    lto_codegen_compile(CG);
    lto_codegen_write_merged_modules(CG, ...);
    lto_codegen_dispose(CG);

This flow has a few benefits.

  - Only one module (two if you count the combined module in the code
    generator) is in memory at a time.

  - Metadata (and constants) from files that are parsed to query symbols
    but not linked into the code generator don't pollute the global
    context.

  - The first for loop can be parallelized, since each module is in its
    own context.

  - When the code generator is disposed, the memory from LTO gets freed.

rdar://problem/18767512

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

9 years agoInitialize new subtarget feature variable for generating reciprocal estimate instruct...
Sanjay Patel [Tue, 11 Nov 2014 23:13:15 +0000 (23:13 +0000)]
Initialize new subtarget feature variable for generating reciprocal estimate instructions.

This was missed in r221706.

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

9 years agolibLTO: Assert if LTOCodeGenerator and LTOModule are from different contexts
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 23:13:10 +0000 (23:13 +0000)]
libLTO: Assert if LTOCodeGenerator and LTOModule are from different contexts

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

9 years ago[FastISel][AArch64] Add support for fabs intrinsic.
Juergen Ributzka [Tue, 11 Nov 2014 23:10:44 +0000 (23:10 +0000)]
[FastISel][AArch64] Add support for fabs intrinsic.

Lower the llvm.fabs intrinsic to the 'fabs' MI instruction.

This fixes rdar://problem/18946552.

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

9 years agolibLTO: Allow LTOModule to own a context
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 23:08:05 +0000 (23:08 +0000)]
libLTO: Allow LTOModule to own a context

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

9 years agolibLTO: Allow LTOCodeGenerator to own a context
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 23:03:29 +0000 (23:03 +0000)]
libLTO: Allow LTOCodeGenerator to own a context

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

9 years ago[asan] adding ShadowOffset64 for mips64, patch by Kumar Sukhani
Kostya Serebryany [Tue, 11 Nov 2014 23:02:57 +0000 (23:02 +0000)]
[asan] adding ShadowOffset64 for mips64, patch by Kumar Sukhani

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

9 years ago[Reassociate] Canonicalize negative constants out of expressions.
Chad Rosier [Tue, 11 Nov 2014 22:58:35 +0000 (22:58 +0000)]
[Reassociate] Canonicalize negative constants out of expressions.

This is a reapplication of r221171, but we only perform the transformation
on expressions which include a multiplication.  We do not transform rem/div
operations as this doesn't appear to be safe in all cases.

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

9 years agoMove asan-coverage into a separate phase.
Kostya Serebryany [Tue, 11 Nov 2014 22:14:37 +0000 (22:14 +0000)]
Move asan-coverage into a separate phase.

Summary:
This change moves asan-coverage instrumentation
into a separate Module pass.
The other part of the change in clang introduces a new flag
-fsanitize-coverage=N.
Another small patch will update tests in compiler-rt.

With this patch no functionality change is expected except for the flag name.
The following changes will make the coverage instrumentation work with tsan/msan

Test Plan: Run regression tests, chromium.

Reviewers: nlewycky, samsonov

Reviewed By: nlewycky, samsonov

Subscribers: llvm-commits

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

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

9 years agoRevert "IR: MDNode => Value"
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 21:30:22 +0000 (21:30 +0000)]
Revert "IR: MDNode => Value"

Instead, we're going to separate metadata from the Value hierarchy.  See
PR21532.

This reverts commit r221375.
This reverts commit r221373.
This reverts commit r221359.
This reverts commit r221167.
This reverts commit r221027.
This reverts commit r221024.
This reverts commit r221023.
This reverts commit r220995.
This reverts commit r220994.

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

9 years agoFix build break: remove unused variable in FCFI.
Tom Roeder [Tue, 11 Nov 2014 21:26:33 +0000 (21:26 +0000)]
Fix build break: remove unused variable in FCFI.

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

9 years agoTotally forget deallocated SDNodes in SDDbgInfo.
Frederic Riss [Tue, 11 Nov 2014 21:21:08 +0000 (21:21 +0000)]
Totally forget deallocated SDNodes in SDDbgInfo.

What would happen before that commit is that the SDDbgValues associated with
a deallocated SDNode would be marked Invalidated, but SDDbgInfo would keep
a map entry keyed by the SDNode pointer pointing to this list of invalidated
SDDbgNodes. As the memory gets reused, the list might get wrongly associated
with another new SDNode. As the SDDbgValues are cloned when they are transfered,
this can lead to an exponential number of SDDbgValues being produced during
DAGCombine like in http://llvm.org/bugs/show_bug.cgi?id=20893

Note that the previous behavior wasn't really buggy as the invalidation made
sure that the SDDbgValues won't be used. This commit can be considered a
memory optimization and as such is really hard to validate in a unit-test.

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

9 years agoAdd Forward Control-Flow Integrity.
Tom Roeder [Tue, 11 Nov 2014 21:08:02 +0000 (21:08 +0000)]
Add Forward Control-Flow Integrity.

This commit adds a new pass that can inject checks before indirect calls to
make sure that these calls target known locations. It supports three types of
checks and, at compile time, it can take the name of a custom function to call
when an indirect call check fails. The default failure function ignores the
error and continues.

This pass incidentally moves the function JumpInstrTables::transformType from
private to public and makes it static (with a new argument that specifies the
table type to use); this is so that the CFI code can transform function types
at call sites to determine which jump-instruction table to use for the check at
that site.

Also, this removes support for jumptables in ARM, pending further performance
analysis and discussion.

Review: http://reviews.llvm.org/D4167

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

9 years ago[llvm-mc] Fixing case where if a file ended with non-newline whitespace or a comma...
Colin LeMahieu [Tue, 11 Nov 2014 21:03:09 +0000 (21:03 +0000)]
[llvm-mc] Fixing case where if a file ended with non-newline whitespace or a comma it would access invalid memory.
Cleaned up parse loop.

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

9 years agoUse rcpss/rcpps (X86) to speed up reciprocal calcs (PR21385).
Sanjay Patel [Tue, 11 Nov 2014 20:51:00 +0000 (20:51 +0000)]
Use rcpss/rcpps (X86) to speed up reciprocal calcs (PR21385).

This is a first step for generating SSE rcp instructions for reciprocal
calcs when fast-math allows it. This is very similar to the rsqrt optimization
enabled in D5658 ( http://reviews.llvm.org/rL220570 ).

For now, be conservative and only enable this for AMD btver2 where performance
improves significantly both in terms of latency and throughput.

We may never enable this codegen for Intel Core* chips because the divider circuits
are just too fast. On SandyBridge, divss can be as fast as 10 cycles versus the 21
cycle critical path for the rcp + mul + sub + mul + add estimate.

Follow-on patches may allow configuration of the number of Newton-Raphson refinement
steps, add AVX512 support, and enable the optimization for more chips.

More background here: http://llvm.org/bugs/show_bug.cgi?id=21385

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

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

9 years agoSimplify testcase. NFC.
Rafael Espindola [Tue, 11 Nov 2014 20:49:16 +0000 (20:49 +0000)]
Simplify testcase. NFC.

Thanks to Filipe Cabecinhas for the tip.

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

9 years ago[PowerPC] Replace foul hackery with real calls to __tls_get_addr
Bill Schmidt [Tue, 11 Nov 2014 20:44:09 +0000 (20:44 +0000)]
[PowerPC] Replace foul hackery with real calls to __tls_get_addr

My original support for the general dynamic and local dynamic TLS
models contained some fairly obtuse hacks to generate calls to
__tls_get_addr when lowering a TargetGlobalAddress.  Rather than
generating real calls, special GET_TLS_ADDR nodes were used to wrap
the calls and only reveal them at assembly time.  I attempted to
provide correct parameter and return values by chaining CopyToReg and
CopyFromReg nodes onto the GET_TLS_ADDR nodes, but this was also not
fully correct.  Problems were seen with two back-to-back stores to TLS
variables, where the call sequences ended up overlapping with unhappy
results.  Additionally, since these weren't real calls, the proper
register side effects of a call were not recorded, so clobbered values
were kept live across the calls.

The proper thing to do is to lower these into calls in the first
place.  This is relatively straightforward; see the changes to
PPCTargetLowering::LowerGlobalTLSAddress() in PPCISelLowering.cpp.
The changes here are standard call lowering, except that we need to
track the fact that these calls will require a relocation.  This is
done by adding a machine operand flag of MO_TLSLD or MO_TLSGD to the
TargetGlobalAddress operand that appears earlier in the sequence.

The calls to LowerCallTo() eventually find their way to
LowerCall_64SVR4() or LowerCall_32SVR4(), which call FinishCall(),
which calls PrepareCall().  In PrepareCall(), we detect the calls to
__tls_get_addr and immediately snag the TargetGlobalTLSAddress with
the annotated relocation information.  This becomes an extra operand
on the call following the callee, which is expected for nodes of type
tlscall.  We change the call opcode to CALL_TLS for this case.  Back
in FinishCall(), we change it again to CALL_NOP_TLS for 64-bit only,
since we require a TOC-restore nop following the call for the 64-bit
ABIs.

During selection, patterns in PPCInstrInfo.td and PPCInstr64Bit.td
convert the CALL_TLS nodes into BL_TLS nodes, and convert the
CALL_NOP_TLS nodes into BL8_NOP_TLS nodes.  This replaces the code
removed from PPCAsmPrinter.cpp, as the BL_TLS or BL8_NOP_TLS
nodes can now be emitted normally using their patterns and the
associated printTLSCall print method.

Finally, as a result of these changes, all references to get-tls-addr
in its various guises are no longer used, so they have been removed.

There are existing TLS tests to verify the changes haven't messed
anything up).  I've added one new test that verifies that the problem
with the original code has been fixed.

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

9 years agoUse a 8 bit immediate when possible.
Rafael Espindola [Tue, 11 Nov 2014 19:46:36 +0000 (19:46 +0000)]
Use a 8 bit immediate when possible.

This fixes pr21529.

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

9 years agoFix a warning about ‘r_type’ may be used uninitialized.
Kevin Enderby [Tue, 11 Nov 2014 19:16:45 +0000 (19:16 +0000)]
Fix a warning about ‘r_type’ may be used uninitialized.

Thanks to Aaron Ballman for noticing this!

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

9 years ago[X86][ELF] Fix PR20243 - leaf frame pointer bug with TLS access
Dario Domizioli [Tue, 11 Nov 2014 18:44:49 +0000 (18:44 +0000)]
[X86][ELF] Fix PR20243 - leaf frame pointer bug with TLS access

The ISel lowering for global TLS access in PIC mode was creating a pseudo
instruction that is later expanded to a call, but the code was not
setting the hasCalls flag in the MachineFrameInfo alongside the adjustsStack
flag. This caused some functions to be mistakenly recognized as leaf functions,
and this in turn affected the decision to eliminate the frame pointer.

With the fix, hasCalls is properly set and the leaf frame pointer is correctly
preserved.

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

9 years agoLLVM incorrectly folds xor into select
Oliver Stannard [Tue, 11 Nov 2014 17:36:01 +0000 (17:36 +0000)]
LLVM incorrectly folds xor into select

LLVM replaces the SelectionDAG pattern (xor (set_cc cc x y) 1) with
(set_cc !cc x y), which is only correct when the xor has type i1.
Instead, we should check that the constant operand to the xor is all
ones.

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

9 years ago[mips] Add preliminary support for the MIPS II target.
Vasileios Kalintiris [Tue, 11 Nov 2014 11:43:55 +0000 (11:43 +0000)]
[mips] Add preliminary support for the MIPS II target.

Summary:
This patch enables code generation for the MIPS II target. Pre-Mips32
targets don't have the MUL instruction, so we add the correspondent
pattern that uses the MULT/MFLO combination in order to retrieve the
product.

This is WIP as we don't support code generation for select nodes due to
the lack of conditional-move instructions.

Reviewers: dsanders

Subscribers: llvm-commits

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

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

9 years ago[mips] Add hardware register name "hwr_ulr" ($29)
Vasileios Kalintiris [Tue, 11 Nov 2014 11:22:39 +0000 (11:22 +0000)]
[mips] Add hardware register name "hwr_ulr" ($29)

The canonical name when printing assembly is still $29. The reason is that
GAS does not accept "$hwr_ulr" at the moment.

This addresses the comments from r221307, which reverted the original
commit r221299.

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

9 years ago[X86] Add missing check for 'isINSERTPSMask' in method 'isShuffleMaskLegal'.
Andrea Di Biagio [Tue, 11 Nov 2014 11:20:31 +0000 (11:20 +0000)]
[X86] Add missing check for 'isINSERTPSMask' in method 'isShuffleMaskLegal'.

This helps the DAGCombiner to identify more opportunities to fold shuffles.

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

9 years agoRecommit "[mips] Add names and tests for the hardware registers"
Vasileios Kalintiris [Tue, 11 Nov 2014 10:31:31 +0000 (10:31 +0000)]
Recommit "[mips] Add names and tests for the hardware registers"

The original commit r221299 was reverted in r221307.  I removed the name
"hrw_ulr" ($29) from the original commit because two tests were failing.

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

9 years agollvm-objdump: Skip empty sections when dumping contents
David Majnemer [Tue, 11 Nov 2014 09:58:25 +0000 (09:58 +0000)]
llvm-objdump: Skip empty sections when dumping contents

Empty sections are just noise when using objdump.
This is similar to what binutils does.

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

9 years agoWas convinced in commit comments that requiring a specific python version is the...
Manuel Klimek [Tue, 11 Nov 2014 08:53:18 +0000 (08:53 +0000)]
Was convinced in commit comments that requiring a specific python version is the wrong approach; reverting.

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

9 years agoMC, COFF: Use relocations for function references inside the section
David Majnemer [Tue, 11 Nov 2014 08:43:57 +0000 (08:43 +0000)]
MC, COFF: Use relocations for function references inside the section

Referencing one symbol from another in the same section does not
generally require a relocation.  However, the MS linker has a feature
called /INCREMENTAL which enables incremental links.  It achieves this
by creating thunks to the actual function and redirecting all
relocations to point to the thunk.

This breaks down with the old scheme if you have a function which
references, say, itself.  On x86_64, we would use %rip relative
addressing to reference the start of the function from out current
position.  This would lead to miscompiles because other references might
reference the thunk instead, breaking function pointer equality.

This fixes PR21520.

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

9 years ago[CMake] llvm-shlib: Prune redundant components, AsmPrinter, MC, and SelectionDAG.
NAKAMURA Takumi [Tue, 11 Nov 2014 07:57:25 +0000 (07:57 +0000)]
[CMake] llvm-shlib: Prune redundant components, AsmPrinter, MC, and SelectionDAG.

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

9 years agoAddition to r216371 (SLP and Loop Vectorization) and r218607 where
Suyog Sarda [Tue, 11 Nov 2014 07:39:27 +0000 (07:39 +0000)]
Addition to r216371 (SLP and Loop Vectorization) and r218607 where
cost model for signed division by power of 2 was improved for AArch64.
The revision r218607 missed test case for Loop Vectorization.
Adding it in this revision.

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

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

9 years agoUse uint64_t as the type for the X86 TSFlag format enum. Allows removal of the VEXShi...
Craig Topper [Tue, 11 Nov 2014 07:32:32 +0000 (07:32 +0000)]
Use uint64_t as the type for the X86 TSFlag format enum. Allows removal of the VEXShift hack that was used to access the higher bits of TSFlags.

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

9 years ago[X86] Fix pattern match for 32-to-64-bit zext in the presence of AssertSext
Michael Kuperstein [Tue, 11 Nov 2014 07:07:40 +0000 (07:07 +0000)]
[X86] Fix pattern match for 32-to-64-bit zext in the presence of AssertSext

This fixes an issue with matching trunc -> assertsext -> zext on x86-64, which would not zero the high 32-bits. See PR20494 for details.
Recommitting - This time, with a hopefully working test.

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

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

9 years agoOnly run the gold plugin tests if gold supports the targets we test with.
Rafael Espindola [Tue, 11 Nov 2014 05:27:12 +0000 (05:27 +0000)]
Only run the gold plugin tests if gold supports the targets we test with.

This fixes pr21345.

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

9 years ago[NVPTX] Remove dead code in NVPTXTargetTransformInfo (NFC)
Jingyue Wu [Tue, 11 Nov 2014 05:24:04 +0000 (05:24 +0000)]
[NVPTX] Remove dead code in NVPTXTargetTransformInfo (NFC)

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

9 years agoMCAsmParserExtension has a copy of the MCAsmParser. Use it.
Rafael Espindola [Tue, 11 Nov 2014 05:18:41 +0000 (05:18 +0000)]
MCAsmParserExtension has a copy of the MCAsmParser. Use it.

Base classes were storing a second copy.

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