oota-llvm.git
9 years ago[PowerPC] Fix calls to non-function objects
Hal Finkel [Mon, 12 Jan 2015 04:34:47 +0000 (04:34 +0000)]
[PowerPC] Fix calls to non-function objects

Looking at r225438 inspired me to see how the PowerPC backend handled the
situation (calling a bitcasted TLS global), and it turns out we also produced
an error (cannot select ...). What it means to "call" something that is not a
function is implementation and platform specific, but in the name of doing
something (besides crashing), this makes sure we do what GCC does (treat all
such calls as calls through a function pointer -- meaning that the pointer is
assumed, as is the convention on PPC, to point to a function descriptor
structure holding the actual code address along with the function's TOC pointer
and environment pointer). As GCC does, we now do the same for calling regular
(non-TLS) non-function globals too.

I'm not sure whether this is the most useful way to define the behavior, but at
least we won't be alone.

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

9 years ago[X86][SSE] Minor fix to VPBLENDW AVX2 commutation.
Simon Pilgrim [Sun, 11 Jan 2015 22:08:01 +0000 (22:08 +0000)]
[X86][SSE] Minor fix to VPBLENDW AVX2 commutation.

D6015 / rL221313 enabled commutation for SSE immediate blend instructions, but due to a typo the AVX2 VPBLENDW ymm instructions weren't flagged as commutative along with the others in the tables, but were still being commuted in code and tested for.

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

9 years agoFix silly mistake in release notes for Mips.
Daniel Sanders [Sun, 11 Jan 2015 10:48:20 +0000 (10:48 +0000)]
Fix silly mistake in release notes for Mips.

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

9 years agoAdded release notes for the Mips target.
Daniel Sanders [Sun, 11 Jan 2015 10:34:52 +0000 (10:34 +0000)]
Added release notes for the Mips target.

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

9 years agoRevert most of r225597
David Majnemer [Sun, 11 Jan 2015 07:29:51 +0000 (07:29 +0000)]
Revert most of r225597

We can't rely on a DataLayout enlightened constant folder.

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

9 years agoX86: Properly decode shuffle masks when the constant pool type is weird
David Majnemer [Sun, 11 Jan 2015 05:08:57 +0000 (05:08 +0000)]
X86: Properly decode shuffle masks when the constant pool type is weird

It's possible for the constant pool entry for the shuffle mask to come
from a completely different operation.  This occurs when Constants have
the same bit pattern but have different types.

Make DecodePSHUFBMask tolerant of types which, after a bitcast, are
appropriately sized vector types.

This fixes PR22188.

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

9 years agoX86: teach X86TargetLowering about L,M,O constraints
Saleem Abdulrasool [Sun, 11 Jan 2015 04:39:24 +0000 (04:39 +0000)]
X86: teach X86TargetLowering about L,M,O constraints

Teach the ISelLowering for X86 about the L,M,O target specific constraints.
Although, for the moment, clang performs constraint validation and prevents
passing along inline asm which may have immediate constant constraints violated,
the backend should be able to cope with the invalid inline asm a bit better.

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

9 years agoARM: add support for segment base relocations (SBREL)
Saleem Abdulrasool [Sun, 11 Jan 2015 04:39:18 +0000 (04:39 +0000)]
ARM: add support for segment base relocations (SBREL)

This adds support for parsing and emitting the SBREL relocation variant for the
ARM target.  Handling this relocation variant is necessary for supporting the
full ARM ELF specification.  Addresses PR22128.

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

9 years ago[x86] Remove some windows line endings that snuck into the tests here.
Chandler Carruth [Sun, 11 Jan 2015 01:36:20 +0000 (01:36 +0000)]
[x86] Remove some windows line endings that snuck into the tests here.

Folks on Windows, remember to set up your subversion to strip these when
submitting...

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

9 years ago[ADT] Remove the unused default constructor for iterator_range.
Chandler Carruth [Sun, 11 Jan 2015 01:16:26 +0000 (01:16 +0000)]
[ADT] Remove the unused default constructor for iterator_range.

This default constructor is a bit weird. It left the range in an invalid
state. That might be reasonable so that you can construct a local
iterator range and assign to it based on some logic to compute the range
you want. If folks would like to support that use case, I can add it
back, but in 238-odd usages none have actually wanted to do this. ;]

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

9 years agoFix PR22179.
Sanjoy Das [Sat, 10 Jan 2015 23:41:24 +0000 (23:41 +0000)]
Fix PR22179.

We were incorrectly inferring nsw for certain SCEVs. We can be more
aggressive here (see Richard Smith's comment on
http://llvm.org/bugs/show_bug.cgi?id=22179) but this change just
focuses on correctness.

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

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

9 years agoRevert r225500, it leads to infinite loops.
Joerg Sonnenberger [Sat, 10 Jan 2015 21:49:36 +0000 (21:49 +0000)]
Revert r225500, it leads to infinite loops.

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

9 years ago[X86][SSE] Improved (v)insertps shuffle matching
Simon Pilgrim [Sat, 10 Jan 2015 19:45:33 +0000 (19:45 +0000)]
[X86][SSE] Improved (v)insertps shuffle matching

In the current code we only attempt to match against insertps if we have exactly one element from the second input vector, irrespective of how much of the shuffle result is zeroable.

This patch checks to see if there is a single non-zeroable element from either input that requires insertion. It also supports matching of cases where only one of the inputs need to be referenced.

We also split insertps shuffle matching off into a new lowerVectorShuffleAsInsertPS function.

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

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

9 years ago.gitignore: add some rules for tagging programs
Ramkumar Ramachandra [Sat, 10 Jan 2015 19:11:29 +0000 (19:11 +0000)]
.gitignore: add some rules for tagging programs

Often, we miss committing new files, and 'arc diff' is supposed to warn
us about this. Unfortunately, because of the spurious output of the
command (due to unignored untracked files), we tend to ignore it and
lose information.

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

9 years ago[PowerPC] Mark zext of a small scalar load as free
Hal Finkel [Sat, 10 Jan 2015 08:21:59 +0000 (08:21 +0000)]
[PowerPC] Mark zext of a small scalar load as free

This initial implementation of PPCTargetLowering::isZExtFree marks as free
zexts of small scalar loads (that are not sign-extending). This callback is
used by SelectionDAGBuilder's RegsForValue::getCopyToRegs, and thus to
determine whether a zext or an anyext is used to lower illegally-typed PHIs.
Because later truncates of zero-extended values are nops, this allows for the
elimination of later unnecessary truncations.

Fixes the initial complaint associated with PR22120.

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

9 years agoRemove some whitespace.
Justin Hibbits [Sat, 10 Jan 2015 07:50:31 +0000 (07:50 +0000)]
Remove some whitespace.

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

9 years agoConvertUTFTest: fix misleading empty line
Dmitri Gribenko [Sat, 10 Jan 2015 05:03:29 +0000 (05:03 +0000)]
ConvertUTFTest: fix misleading empty line

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

9 years agotests: fix previous commit
Saleem Abdulrasool [Sat, 10 Jan 2015 02:53:25 +0000 (02:53 +0000)]
tests: fix previous commit

The previous commit accidentally missed changes to the test output checking,
resulting in an errant failure.

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

9 years agotest: merge ARM relocations test
Saleem Abdulrasool [Sat, 10 Jan 2015 02:48:29 +0000 (02:48 +0000)]
test: merge ARM relocations test

There is a fair number of relocations that are part of the AAELF specification.
Simply merge the tests into a single test file, otherwise, we will end up with
far too many test files to test each relocation type.  NFC.

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

9 years agotests: convert a couple of ARM relocation tests to readobj
Saleem Abdulrasool [Sat, 10 Jan 2015 02:48:25 +0000 (02:48 +0000)]
tests: convert a couple of ARM relocation tests to readobj

These tests are checking the relocation generation.  Use the readobj output as
it is much easier to follow when glancing over the tests.

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

9 years agoFully fix Bug #22115.
Justin Hibbits [Sat, 10 Jan 2015 01:57:21 +0000 (01:57 +0000)]
Fully fix Bug #22115.

Summary:
In the previous commit, the register was saved, but space was not allocated.
This resulted in the parameter save area potentially clobbering r30, leading to
nasty results.

Test Plan: Tests updated

Reviewers: hfinkel

Subscribers: llvm-commits

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

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

9 years agoFix undefined behavior (shift of negative value) in RuntimeDyldMachOAArch64::encodeAd...
Alexey Samsonov [Sat, 10 Jan 2015 00:46:38 +0000 (00:46 +0000)]
Fix undefined behavior (shift of negative value) in RuntimeDyldMachOAArch64::encodeAddend.

Test Plan: regression test suite with/without UBSan.

Reviewers: lhames, ributzka

Subscribers: aemerson, llvm-commits

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

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

9 years ago[PowerPC] Readjust the loop unrolling threshold
Hal Finkel [Sat, 10 Jan 2015 00:31:10 +0000 (00:31 +0000)]
[PowerPC] Readjust the loop unrolling threshold

Now that the way that the partial unrolling threshold for small loops is used
to compute the unrolling factor as been corrected, a slightly smaller threshold
is preferable. This is expected; other targets may need to re-tune as well.

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

9 years ago[LoopUnroll] Fix the partial unrolling threshold for small loop sizes
Hal Finkel [Sat, 10 Jan 2015 00:30:55 +0000 (00:30 +0000)]
[LoopUnroll] Fix the partial unrolling threshold for small loop sizes

When we compute the size of a loop, we include the branch on the backedge and
the comparison feeding the conditional branch. Under normal circumstances,
these don't get replicated with the rest of the loop body when we unroll. This
led to the somewhat surprising behavior that really small loops would not get
unrolled enough -- they could be unrolled more and the resulting loop would be
below the threshold, because we were assuming they'd take
(LoopSize * UnrollingFactor) instructions after unrolling, instead of
(((LoopSize-2) * UnrollingFactor)+2) instructions. This fixes that computation.

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

9 years agoUse the DiagnosticHandler to print diagnostics when reading bitcode.
Rafael Espindola [Sat, 10 Jan 2015 00:07:30 +0000 (00:07 +0000)]
Use the DiagnosticHandler to print diagnostics when reading bitcode.

The bitcode reading interface used std::error_code to report an error to the
callers and it is the callers job to print diagnostics.

This is not ideal for error handling or diagnostic reporting:

* For error handling, all that the callers care about is 3 possibilities:
  * It worked
  * The bitcode file is corrupted/invalid.
  * The file is not bitcode at all.

* For diagnostic, it is user friendly to include far more information
  about the invalid case so the user can find out what is wrong with the
  bitcode file. This comes up, for example, when a developer introduces a
  bug while extending the format.

The compromise we had was to have a lot of error codes.

With this patch we use the DiagnosticHandler to communicate with the
human and std::error_code to communicate with the caller.

This allows us to have far fewer error codes and adds the infrastructure to
print better diagnostics. This is so because the diagnostics are printed when
he issue is found. The code that detected the problem in alive in the stack and
can pass down as much context as needed. As an example the patch updates
test/Bitcode/invalid.ll.

Using a DiagnosticHandler also moves the fatal/non-fatal error decision to the
caller. A simple one like llvm-dis can just use fatal errors. The gold plugin
needs a bit more complex treatment because of being passed non-bitcode files. An
hypothetical interactive tool would make all bitcode errors non-fatal.

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

9 years agoFix UBSan error reports in ValueMapCallbackVH and AssertingVH<T> empty/tombstone...
Alexey Samsonov [Fri, 9 Jan 2015 23:17:25 +0000 (23:17 +0000)]
Fix UBSan error reports in ValueMapCallbackVH and AssertingVH<T> empty/tombstone keys generation.

Summary:
One more attempt to fix UBSan reports: make sure DenseMapInfo::getEmptyKey()
and DenseMapInfo::getTombstoneKey() doesn't do any upcasts/downcasts to/from Value*.

Test Plan: check-llvm test suite with/without UBSan bootstrap

Reviewers: chandlerc, dexonsmith

Subscribers: llvm-commits, majnemer

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

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

9 years agoDisable Go bindings test under UBSan.
Alexey Samsonov [Fri, 9 Jan 2015 23:17:23 +0000 (23:17 +0000)]
Disable Go bindings test under UBSan.

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

9 years agoFix the JIT event listeners and replace the associated tests.
Andrew Kaylor [Fri, 9 Jan 2015 22:53:24 +0000 (22:53 +0000)]
Fix the JIT event listeners and replace the associated tests.

The changes to EventListenerCommon.h were contributed by Arch Robison.

This fixes bug 22095.

http://reviews.llvm.org/D6905

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

9 years agoUpdate comment.
Michael Zolotukhin [Fri, 9 Jan 2015 22:15:06 +0000 (22:15 +0000)]
Update comment.

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

9 years agoSimplifyCFG: check uses of constant-foldable instrs in switch destinations (PR20210)
Hans Wennborg [Fri, 9 Jan 2015 22:13:31 +0000 (22:13 +0000)]
SimplifyCFG: check uses of constant-foldable instrs in switch destinations (PR20210)

The previous code assumed that such instructions could not have any uses
outside CaseDest, with the motivation that the instruction could not
dominate CommonDest because CommonDest has phi nodes in it. That simply
isn't true; e.g., CommonDest could have an edge back to itself.

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

9 years ago[X86][SSE] Avoid vector byte shuffles with zero by using pshufb to create zeros
Simon Pilgrim [Fri, 9 Jan 2015 22:03:19 +0000 (22:03 +0000)]
[X86][SSE] Avoid vector byte shuffles with zero by using pshufb to create zeros

pshufb can shuffle in zero bytes as well as bytes from a source vector - we can use this to avoid having to shuffle 2 vectors and ORing the result when the used inputs from a vector are all zeroable.

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

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

9 years agoFix an ASAN failure introduced with r225537 (adding the -universal-headers to llvm...
Kevin Enderby [Fri, 9 Jan 2015 21:55:03 +0000 (21:55 +0000)]
Fix an ASAN failure introduced with r225537 (adding the -universal-headers to llvm-obdump).
And a fly by fix to some formatting issues with the same commit.

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

9 years agoAdd a testcase of llvm-lto error handling.
Rafael Espindola [Fri, 9 Jan 2015 20:55:09 +0000 (20:55 +0000)]
Add a testcase of llvm-lto error handling.

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

9 years agoRemove duplicating code. NFC.
Michael Zolotukhin [Fri, 9 Jan 2015 20:36:19 +0000 (20:36 +0000)]
Remove duplicating code. NFC.

The removed condition is checked in the previous loop.

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

9 years agoAdd the option, -universal-headers, used with -macho to print the Mach-O universal...
Kevin Enderby [Fri, 9 Jan 2015 19:22:37 +0000 (19:22 +0000)]
Add the option, -universal-headers, used with -macho to print the Mach-O universal headers to llvm-objdump.

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

9 years agoRe-reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before
Tim Northover [Fri, 9 Jan 2015 19:19:56 +0000 (19:19 +0000)]
Re-reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before
doing Load PRE"

It's not really expected to stick around, last time it provoked a weird LTO
build failure that I can't reproduce now, and the bot logs are long gone. I'll
re-revert it if the failures recur.

Original description: Perform Scalar PRE on gep indices that feed loads before
doing Load PRE.

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

9 years agoRecommit r224935 with a fix for the ObjC++/AArch64 bug that that revision
Lang Hames [Fri, 9 Jan 2015 18:55:42 +0000 (18:55 +0000)]
Recommit r224935 with a fix for the ObjC++/AArch64 bug that that revision
introduced.

A test case for the bug was already committed in r225385.

Patch by Rafael Espindola.

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

9 years agoRevert "Bitcode: Move the DEBUG_LOC record to DEBUG_LOC_OLD"
Duncan P. N. Exon Smith [Fri, 9 Jan 2015 17:53:27 +0000 (17:53 +0000)]
Revert "Bitcode: Move the DEBUG_LOC record to DEBUG_LOC_OLD"

This reverts commit r225498 (but leaves r225499, which was a worthy
cleanup).

My plan was to change `DEBUG_LOC` to store the `MDNode` directly rather
than its operands (patch was to go out this morning), but on reflection
it's not clear that it's strictly better.  (I had missed that the
current code is unlikely to emit the `MDNode` at all.)

Conflicts:
lib/Bitcode/Reader/BitcodeReader.cpp (due to r225499)

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

9 years ago[mips] Add support for accessing $gp as a named register.
Daniel Sanders [Fri, 9 Jan 2015 17:21:30 +0000 (17:21 +0000)]
[mips] Add support for accessing $gp as a named register.

Summary:
Mips Linux uses $gp to hold a pointer to thread info structure and accesses it
with a named register. This makes this work for LLVM.

The N32 ABI doesn't quite work yet since the frontend generates incorrect IR
for this case. It neglects to truncate the 64-bit GPR to a 32-bit value before
converting to a pointer. Given correct IR (as in the testcase in this patch),
it works correctly.

Reviewers: sstankovic, vmedic, atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits

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

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

9 years agofix typos; remove names from comments; NFC
Sanjay Patel [Fri, 9 Jan 2015 17:11:51 +0000 (17:11 +0000)]
fix typos; remove names from comments; NFC

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

9 years agoremove names from comments; NFC
Sanjay Patel [Fri, 9 Jan 2015 16:47:20 +0000 (16:47 +0000)]
remove names from comments; NFC

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

9 years agofix typos; NFC
Sanjay Patel [Fri, 9 Jan 2015 16:35:37 +0000 (16:35 +0000)]
fix typos; NFC

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

9 years agofix typo; NFC
Sanjay Patel [Fri, 9 Jan 2015 16:29:50 +0000 (16:29 +0000)]
fix typo; NFC

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

9 years agomore efficient use of a dyn_cast; no functional change intended
Sanjay Patel [Fri, 9 Jan 2015 16:28:15 +0000 (16:28 +0000)]
more efficient use of a dyn_cast; no functional change intended

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

9 years ago[PowerPC] Enable late partial unrolling on the POWER7
Hal Finkel [Fri, 9 Jan 2015 15:51:16 +0000 (15:51 +0000)]
[PowerPC] Enable late partial unrolling on the POWER7

The P7 benefits from not have really-small loops so that we either have
multiple dispatch groups in the loop and/or the ability to form more-full
dispatch groups during scheduling. Setting the partial unrolling threshold to
44 seems good, empirically, for the P7. Compared to using no late partial
unrolling, this yields the following test-suite speedups:

SingleSource/Benchmarks/Adobe-C++/simple_types_constant_folding
-66.3253% +/- 24.1975%
SingleSource/Benchmarks/Misc-C++/oopack_v1p8
-44.0169% +/- 29.4881%
SingleSource/Benchmarks/Misc/pi
-27.8351% +/- 12.2712%
SingleSource/Benchmarks/Stanford/Bubblesort
-30.9898% +/- 22.4647%

I've speculatively added a similar setting for the P8. Also, I've noticed that
the unroller does not quite calculate the unrolling factor correctly for really
tiny loops because it neglects to account for the fact that not every loop body
replicant contains an ending branch and counter increment. I'll fix that later.

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

9 years ago[mips] Add comment which explains why we need to change the assembler options before...
Toma Tabacu [Fri, 9 Jan 2015 15:00:30 +0000 (15:00 +0000)]
[mips] Add comment which explains why we need to change the assembler options before and after inline asm blocks. NFC.

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

9 years agoAssumption that "VectorizedValue" will always be an Instruction is not correct.
Suyog Sarda [Fri, 9 Jan 2015 10:23:48 +0000 (10:23 +0000)]
Assumption that "VectorizedValue" will always be an Instruction is not correct.
It can be a constant or a vector argument.

ex :

define i32 @hadd(<4 x i32> %a) #0 {
entry:
  %vecext = extractelement <4 x i32> %a, i32 0
  %vecext1 = extractelement <4 x i32> %a, i32 1
  %add = add i32 %vecext, %vecext1
  %vecext2 = extractelement <4 x i32> %a, i32 2
  %add3 = add i32 %add, %vecext2
  %vecext4 = extractelement <4 x i32> %a, i32 3
  %add5 = add i32 %add3, %vecext4
  ret i32 %add5
}

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

9 years agoARM: add support for R_ARM_ABS16
Saleem Abdulrasool [Fri, 9 Jan 2015 06:57:24 +0000 (06:57 +0000)]
ARM: add support for R_ARM_ABS16

Add support for R_ARM_ABS16 relocation mapping.  Addresses PR22156.

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

9 years agotest: add additional test for SVN r225507
Saleem Abdulrasool [Fri, 9 Jan 2015 06:57:18 +0000 (06:57 +0000)]
test: add additional test for SVN r225507

Add an additional test case to ensure that we generate the relocation even if
the thumb target is used.

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

9 years agoARM: add support for R_ARM_ABS8 relocations
Saleem Abdulrasool [Fri, 9 Jan 2015 05:59:12 +0000 (05:59 +0000)]
ARM: add support for R_ARM_ABS8 relocations

Add support for R_ARM_ABS8 relocation.  Addresses PR22126.

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

9 years agoRegisterCoalescer: Fix removeCopyByCommutingDef with subreg liveness
Matthias Braun [Fri, 9 Jan 2015 03:01:31 +0000 (03:01 +0000)]
RegisterCoalescer: Fix removeCopyByCommutingDef with subreg liveness

The code that eliminated additional coalescable copies in
removeCopyByCommutingDef() used MergeValueNumberInto() which internally
may merge A into B or B into A. In this case A and B had different Def
points, so we have to reset ValNo.Def to the intended one after merging.

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

9 years agoRegisterCoalescer: Some cleanup in removeCopyByCommutingDef(), NFC
Matthias Braun [Fri, 9 Jan 2015 03:01:28 +0000 (03:01 +0000)]
RegisterCoalescer: Some cleanup in removeCopyByCommutingDef(), NFC

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

9 years agoRegisterCoalescer: No need to set kill flags, they are recompute later anyway
Matthias Braun [Fri, 9 Jan 2015 03:01:26 +0000 (03:01 +0000)]
RegisterCoalescer: No need to set kill flags, they are recompute later anyway

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

9 years agoRegisterCoalescer: Turn some impossible conditions into asserts
Matthias Braun [Fri, 9 Jan 2015 03:01:23 +0000 (03:01 +0000)]
RegisterCoalescer: Turn some impossible conditions into asserts

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

9 years agoBitcode: Share logic for last instruction, NFC
Duncan P. N. Exon Smith [Fri, 9 Jan 2015 02:51:45 +0000 (02:51 +0000)]
Bitcode: Share logic for last instruction, NFC

Share logic for getting the last instruction emitted.

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

9 years agoBitcode: Move the DEBUG_LOC record to DEBUG_LOC_OLD
Duncan P. N. Exon Smith [Fri, 9 Jan 2015 02:48:48 +0000 (02:48 +0000)]
Bitcode: Move the DEBUG_LOC record to DEBUG_LOC_OLD

Prepare to simplify the `DebugLoc` record.

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

9 years ago[PowerPC] Add a flag for experimenting with subreg liveness tracking
Hal Finkel [Fri, 9 Jan 2015 02:03:11 +0000 (02:03 +0000)]
[PowerPC] Add a flag for experimenting with subreg liveness tracking

This cannot yet be enabled by default, it causes ~50 miscompiles in the test
suite.

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

9 years ago[PowerPC] Fold [sz]ext with fp_to_int lowering where possible
Hal Finkel [Fri, 9 Jan 2015 01:34:30 +0000 (01:34 +0000)]
[PowerPC] Fold [sz]ext with fp_to_int lowering where possible

On modern cores with lfiw[az]x, we can fold a sign or zero extension from i32
to i64 into the load necessary for an i64 -> fp conversion.

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

9 years ago[DAGCombine] Remainder of fix to r225380 (More FMA folding opportunities)
Hal Finkel [Fri, 9 Jan 2015 01:29:29 +0000 (01:29 +0000)]
[DAGCombine] Remainder of fix to r225380 (More FMA folding opportunities)

As pointed out by Aditya (and Owen), when we elide an FP extend to form an FMA,
we need to extend the incoming operands so that the resulting node will really
be legal. This is currently enabled only for PowerPC, and it happens to work
there regardless, but this should fix the functionality for everyone else
should anyone else wish to use it.

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

9 years ago[x86] Add a flag to control the vector shuffle legality predicates that
Chandler Carruth [Fri, 9 Jan 2015 01:24:36 +0000 (01:24 +0000)]
[x86] Add a flag to control the vector shuffle legality predicates that
complements the new vector shuffle lowering code path. This flag,
naturally, is *off* because we've not tested or evaluated the results of
this at all. However, the flag will make it much easier to evaluate
whether we can be this aggressive and whether there are missing vector
shuffle lowering optimizations.

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

9 years agoCleaup ValueHandle to no longer keep a PointerIntPair for the Value*.
Chandler Carruth [Fri, 9 Jan 2015 00:48:47 +0000 (00:48 +0000)]
Cleaup ValueHandle to no longer keep a PointerIntPair for the Value*.
This was used previously for metadata but is no longer needed there. Not
doing this simplifies ValueHandle and will make it easier to fix things
like AssertingVH's DenseMapInfo.

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

9 years agoPartial fix to r225380 (More FMA folding opportunities)
Hal Finkel [Fri, 9 Jan 2015 00:45:54 +0000 (00:45 +0000)]
Partial fix to r225380 (More FMA folding opportunities)

As pointed out by Aditya (and Owen), there are two things wrong with this code.
First, it adds patterns which elide FP extends when forming FMAs, and that might
not be profitable on all targets (it belongs behind the pre-existing
aggressive-FMA-formation flag). This is fixed by this change.

Second, the resulting nodes might have operands of different types (the
extensions need to be re-added). That will be fixed in the follow-up commit.

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

9 years ago[REFACTOR] Push logic from MemDepPrinter into getNonLocalPointerDependency
Philip Reames [Fri, 9 Jan 2015 00:26:45 +0000 (00:26 +0000)]
[REFACTOR] Push logic from MemDepPrinter into getNonLocalPointerDependency

Previously, MemDepPrinter handled volatile and unordered accesses without involving MemoryDependencyAnalysis.  By making a slight tweak to the documented interface - which is respected by both callers - we can move this responsibility to MDA for the benefit of any future callers.  This is basically just cleanup.

In the future, we may decide to extend MDA's non local dependency analysis to return useful results for ordered or volatile loads.  I believe (but have not really checked in detail) that local dependency analyis does get useful results for ordered, but not volatile, loads.

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

9 years agoReleaseNotes.rst: these are for 3.6
Hans Wennborg [Fri, 9 Jan 2015 00:21:26 +0000 (00:21 +0000)]
ReleaseNotes.rst: these are for 3.6

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

9 years ago[Refactor] Have getNonLocalPointerDependency take the query instruction
Philip Reames [Fri, 9 Jan 2015 00:04:22 +0000 (00:04 +0000)]
[Refactor] Have getNonLocalPointerDependency take the query instruction

Previously, MemoryDependenceAnalysis::getNonLocalPointerDependency was taking a list of properties about the instruction being queried. Since I'm about to need one more property to be passed down through the infrastructure - I need to know a query instruction is non-volatile in an inner helper - fix the interface once and for all.

I also added some assertions and behaviour clarifications around volatile and ordered field accesses. At the moment, this is mostly to document expected behaviour. The only non-standard instructions which can currently reach this are atomic, but unordered, loads and stores. Neither ordered or volatile accesses can reach here.

The call in GVN is protected by an isSimple check when it first considers the load. The calls in MemDepPrinter are protected by isUnordered checks. Both utilities also check isVolatile for loads and stores.

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

9 years agoLangRef: Add usage points for distinct MDNodes
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 23:50:26 +0000 (23:50 +0000)]
LangRef: Add usage points for distinct MDNodes

Omission pointed out by Sean Silva!

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

9 years agoIR: Drop TODO now that PR22111 is finished
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 22:43:19 +0000 (22:43 +0000)]
IR: Drop TODO now that PR22111 is finished

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

9 years agoUtils: Keep distinct MDNodes distinct in MapMetadata()
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 22:42:30 +0000 (22:42 +0000)]
Utils: Keep distinct MDNodes distinct in MapMetadata()

Create new copies of distinct `MDNode`s instead of following the
uniquing `MDNode` logic.

Just like self-references (or other cycles), `MapMetadata()` creates a
new node.  In practice most calls use `RF_NoModuleLevelChanges`, in
which case nothing is duplicated anyway.

Part of PR22111.

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

9 years agoIR: Add 'distinct' MDNodes to bitcode and assembly
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 22:38:29 +0000 (22:38 +0000)]
IR: Add 'distinct' MDNodes to bitcode and assembly

Propagate whether `MDNode`s are 'distinct' through the other types of IR
(assembly and bitcode).  This adds the `distinct` keyword to assembly.

Currently, no one actually calls `MDNode::getDistinct()`, so these nodes
only get created for:

  - self-references, which are never uniqued, and
  - nodes whose operands are replaced that hit a uniquing collision.

The concept of distinct nodes is still not quite first-class, since
distinct-ness doesn't yet survive across `MapMetadata()`.

Part of PR22111.

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

9 years agoremove function names from comments; NFC
Sanjay Patel [Thu, 8 Jan 2015 22:36:56 +0000 (22:36 +0000)]
remove function names from comments; NFC

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

9 years ago[PowerPC] Mark all instructions as non-cheap for MachineLICM
Hal Finkel [Thu, 8 Jan 2015 22:11:49 +0000 (22:11 +0000)]
[PowerPC] Mark all instructions as non-cheap for MachineLICM

MachineLICM uses a callback named hasLowDefLatency to determine if an
instruction def operand has a 'low' latency. If all relevant operands have a
'low' latency, the instruction is considered too cheap to hoist out of loops
even in low-register-pressure situations. On PowerPC cores, both the embedded
cores and the others, there is no reason to believe that this is a good choice:
all instructions have a cost inside a loop, and hoisting them when not limited
by register pressure is a reasonable default.

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

9 years ago[MachineLICM] A command-line option to hoist even cheap instructions
Hal Finkel [Thu, 8 Jan 2015 22:10:48 +0000 (22:10 +0000)]
[MachineLICM] A command-line option to hoist even cheap instructions

Add a command-line option to enable hoisting even cheap instructions (in
low-register-pressure situations). This is turned off by default, but has
proved useful for testing purposes.

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

9 years agoCodeGen: Use handy new-fangled post-increment, NFC
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 21:07:55 +0000 (21:07 +0000)]
CodeGen: Use handy new-fangled post-increment, NFC

Drive-by cleanup; I noticed this when reviewing the patch that became
r225466.

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

9 years ago[ARM] Fix a bug in constant island pass that was triggering an assertion.
Akira Hatanaka [Thu, 8 Jan 2015 20:44:50 +0000 (20:44 +0000)]
[ARM] Fix a bug in constant island pass that was triggering an assertion.

The assert was being triggered when the distance between a constant pool entry
and its user exceeded the maximally allowed distance after thumb2 branch
shortening. A padding was inserted after a thumb2 branch instruction was shrunk,
which caused the user to be out of range. This is wrong as the padding should
have been inserted by the layout algorithm so that the distance between two
instructions doesn't grow later during thumb2 instruction optimization.

This commit fixes the code in ARMConstantIslands::createNewWater to call
computeBlockSize and set BasicBlock::Unalign when a branch instruction is
inserted to create new water after a basic block. A non-zero Unalign causes
the worst-case padding to be inserted when adjustBBOffsetsAfter is called to
recompute the basic block offsets.

rdar://problem/19130476

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

9 years agoCodeGen: Use range-based for loops, NFC
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 20:44:33 +0000 (20:44 +0000)]
CodeGen: Use range-based for loops, NFC

Patch by Ramkumar Ramachandra!

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

9 years agoFix fcmp + fabs instcombines when using the intrinsic
Matt Arsenault [Thu, 8 Jan 2015 20:09:34 +0000 (20:09 +0000)]
Fix fcmp + fabs instcombines when using the intrinsic

This was only handling the libcall. This is another example
of why only the intrinsic should ever be used when it exists.

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

9 years agoThe Kaleidoscope tutorial should be using "mcjit" for the library,
Eric Christopher [Thu, 8 Jan 2015 19:07:01 +0000 (19:07 +0000)]
The Kaleidoscope tutorial should be using "mcjit" for the library,
"jit" doesn't exist anymore.

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

9 years ago[MCJIT] Remove a few redundant MCJIT tests, and drop the extraneous datalayout
Lang Hames [Thu, 8 Jan 2015 18:52:15 +0000 (18:52 +0000)]
[MCJIT] Remove a few redundant MCJIT tests, and drop the extraneous datalayout
strings from the copies that remain.

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

9 years agoMake the TargetMachine in MipsSubtarget a reference rather
Eric Christopher [Thu, 8 Jan 2015 18:18:57 +0000 (18:18 +0000)]
Make the TargetMachine in MipsSubtarget a reference rather
than a pointer to make unifying code a bit easier.

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

9 years agoUpdate include - this class doesn't use the target machine, but
Eric Christopher [Thu, 8 Jan 2015 18:18:54 +0000 (18:18 +0000)]
Update include - this class doesn't use the target machine, but
only the subtarget.

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

9 years agoFix a couple of odd formatting issues.
Eric Christopher [Thu, 8 Jan 2015 18:18:53 +0000 (18:18 +0000)]
Fix a couple of odd formatting issues.

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

9 years agoThis routine is in InstrInfo, there's no need to access it again.
Eric Christopher [Thu, 8 Jan 2015 18:18:50 +0000 (18:18 +0000)]
This routine is in InstrInfo, there's no need to access it again.

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

9 years ago[X86] Reflow comment. NFC.
Ahmed Bougacha [Thu, 8 Jan 2015 17:49:48 +0000 (17:49 +0000)]
[X86] Reflow comment. NFC.

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

9 years agoclang-format. NFC.
Rafael Espindola [Thu, 8 Jan 2015 16:25:01 +0000 (16:25 +0000)]
clang-format. NFC.

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

9 years agoMake this test a bit stricter.
Rafael Espindola [Thu, 8 Jan 2015 16:11:18 +0000 (16:11 +0000)]
Make this test a bit stricter.

It now checks for the end of the line or the opening '{'.
While at it, remove empty comments.

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

9 years agoAdd saving and restoring of r30 to the prologue and epilogue, respectively
Justin Hibbits [Thu, 8 Jan 2015 15:47:19 +0000 (15:47 +0000)]
Add saving and restoring of r30 to the prologue and epilogue, respectively

Summary: The PIC additions didn't update the prologue and epilogue code to save and restore r30 (PIC base register).  This does that.

Test Plan: Tests updated.

Reviewers: hfinkel

Reviewed By: hfinkel

Subscribers: llvm-commits

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

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

9 years agoExplicitly handle LinkOnceODRAutoHideLinkage. NFC. We already have a test.
Rafael Espindola [Thu, 8 Jan 2015 15:39:50 +0000 (15:39 +0000)]
Explicitly handle LinkOnceODRAutoHideLinkage. NFC. We already have a test.

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

9 years agoUpdate naming style and clang-format. NFC.
Rafael Espindola [Thu, 8 Jan 2015 15:36:32 +0000 (15:36 +0000)]
Update naming style and clang-format. NFC.

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

9 years agoFix large stack alignment codegen for ARM and Thumb2 targets
Kristof Beyls [Thu, 8 Jan 2015 15:09:14 +0000 (15:09 +0000)]
Fix large stack alignment codegen for ARM and Thumb2 targets

This partially fixes PR13007 (ARM CodeGen fails with large stack
alignment): for ARM and Thumb2 targets, but not for Thumb1, as it
seems stack alignment for Thumb1 targets hasn't been supported at
all.

Producing an aligned stack pointer is done by zero-ing out the lower
bits of the stack pointer. The BIC instruction was used for this.
However, the immediate field of the BIC instruction only allows to
encode an immediate that can zero out up to a maximum of the 8 lower
bits. When a larger alignment is requested, a BIC instruction cannot
be used; llvm was silently producing incorrect code in this case.

This commit fixes code generation for large stack aligments by
using the BFC instruction instead, when the BFC instruction is
available.  When not, it uses 2 instructions: a right shift,
followed by a left shift to zero out the lower bits.

The lowering of ARM::Int_eh_sjlj_dispatchsetup still has code
that unconditionally uses BIC to realign the stack pointer, so it
very likely has the same problem. However, I wasn't able to
produce a test case for that. This commit adds an assert so that
the compiler will fail the assert instead of silently generating
wrong code if this is ever reached.

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

9 years agoR600/SI: Remove SIISelLowering::legalizeOperands()
Tom Stellard [Thu, 8 Jan 2015 15:08:17 +0000 (15:08 +0000)]
R600/SI: Remove SIISelLowering::legalizeOperands()

Its functionality has been replaced by calling
SIInstrInfo::legalizeOperands() from
SIISelLowering::AdjstInstrPostInstrSelection() and running the
SIFoldOperands and SIShrinkInstructions passes.

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

9 years agoMasked Load/Store - fixed a bug in type legalization.
Elena Demikhovsky [Thu, 8 Jan 2015 12:29:19 +0000 (12:29 +0000)]
Masked Load/Store - fixed a bug in type legalization.

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

9 years agoFix a think-o in the test for r225438.
Michael Kuperstein [Thu, 8 Jan 2015 12:05:02 +0000 (12:05 +0000)]
Fix a think-o in the test for r225438.

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

9 years agoFix include ordering, NFC.
Michael Kuperstein [Thu, 8 Jan 2015 11:59:43 +0000 (11:59 +0000)]
Fix include ordering, NFC.

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

9 years ago[X86] Don't try to generate direct calls to TLS globals
Michael Kuperstein [Thu, 8 Jan 2015 11:50:58 +0000 (11:50 +0000)]
[X86] Don't try to generate direct calls to TLS globals

The call lowering assumes that if the callee is a global, we want to emit a direct call.
This is correct for regular globals, but not for TLS ones.

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

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

9 years agoMove SPAdj logic from PEI into the targets (NFC)
Michael Kuperstein [Thu, 8 Jan 2015 11:04:38 +0000 (11:04 +0000)]
Move SPAdj logic from PEI into the targets (NFC)

PEI tries to keep track of how much starting or ending a call sequence adjusts the stack pointer by, so that it can resolve frame-index references. Currently, it takes a very simplistic view of how SP adjustments are done - both FrameStartOpcode and FrameDestroyOpcode adjust it exactly by the amount written in its first argument.

This view is in fact incorrect for some targets (e.g. due to stack re-alignment, or because it may want to adjust the stack pointer in multiple steps). However, that doesn't cause breakage, because most targets (the only in-tree exception appears to be 32-bit ARM) rely on being able to simplify the call frame pseudo-instructions earlier, so this code is never hit.

Moving the computation into TargetInstrInfo allows targets to override the way the adjustment is computed if they need to have a non-zero SPAdj.

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

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

9 years agoFix test case I missed in r225432.
Craig Topper [Thu, 8 Jan 2015 07:57:27 +0000 (07:57 +0000)]
Fix test case I missed in r225432.

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

9 years ago[X86] Don't print 'dword ptr' or 'qword ptr' on the operand to some of the LEA varian...
Craig Topper [Thu, 8 Jan 2015 07:41:30 +0000 (07:41 +0000)]
[X86] Don't print 'dword ptr' or 'qword ptr' on the operand to some of the LEA variants in Intel syntax. The memory operand is inherently unsized.

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

9 years agoRevert "Reapply: Teach SROA how to update debug info for fragmented variables."
Adrian Prantl [Thu, 8 Jan 2015 02:02:00 +0000 (02:02 +0000)]
Revert "Reapply: Teach SROA how to update debug info for fragmented variables."

This reverts commit r225379 while investigating an assertion failure reported
by Alexey.

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

9 years ago[RegAllocGreedy] Introduce a late pass to repair broken hints.
Quentin Colombet [Thu, 8 Jan 2015 01:16:39 +0000 (01:16 +0000)]
[RegAllocGreedy] Introduce a late pass to repair broken hints.

A broken hint is a copy where both ends are assigned different colors. When a
variable gets evicted in the neighborhood of such copies, it is likely we can
reconcile some of them.

** Context **

Copies are inserted during the register allocation via splitting. These split
points are required to relax the constraints on the allocation problem. When
such a point is inserted, both ends of the copy would not share the same color
with respect to the current allocation problem. When variables get evicted,
the allocation problem becomes different and some split point may not be
required anymore. However, the related variables may already have been colored.

This usually shows up in the assembly with pattern like this:
def A
...
save A to B
def A
use A
restore A from B
...
use B

Whereas we could simply have done:
def B
...
def A
use A
...
use B

** Proposed Solution **

A variable having a broken hint is marked for late recoloring if and only if
selecting a register for it evict another variable. Indeed, if no eviction
happens this is pointless to look for recoloring opportunities as it means the
situation was the same as the initial allocation problem where we had to break
the hint.

Finally, when everything has been allocated, we look for recoloring
opportunities for all the identified candidates.
The recoloring is performed very late to rely on accurate copy cost (all
involved variables are allocated).
The recoloring is simple unlike the last change recoloring. It propagates the
color of the broken hint to all its copy-related variables. If the color is
available for them, the recoloring uses it, otherwise it gives up on that hint
even if a more complex coloring would have worked.

The recoloring happens only if it is profitable. The profitability is evaluated
using the expected frequency of the copies of the currently recolored variable
with a) its current color and b) with the target color. If a) is greater or
equal than b), then it is profitable and the recoloring happen.

** Example **

Consider the following example:
BB1:
  a =
  b =
BB2:
  ...
   = b
   = a
Let us assume b gets split:
BB1:
  a =
  b =
BB2:
  c = b
  ...
  d = c
  = d
  = a
Because of how the allocation work, b, c, and d may be assigned different
colors. Now, if a gets evicted to make room for c, assuming b and d were
assigned to something different than a.
We end up with:
BB1:
  a =
  st a, SpillSlot
  b =
BB2:
  c = b
  ...
  d = c
  = d
  e = ld SpillSlot
  = e
This is likely that we can assign the same register for b, c, and d,
getting rid of 2 copies.

** Performances **

Both ARM64 and x86_64 show performance improvements of up to 3% for the
llvm-testsuite + externals with Os and O3. There are a few regressions too that
comes from the (in)accuracy of the block frequency estimate.

<rdar://problem/18312047>

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

9 years ago[SelectionDAG] Allow targets to specify legality of extloads' result
Ahmed Bougacha [Thu, 8 Jan 2015 00:51:32 +0000 (00:51 +0000)]
[SelectionDAG] Allow targets to specify legality of extloads' result
type (in addition to the memory type).

The *LoadExt* legalization handling used to only have one type, the
memory type.  This forced users to assume that as long as the extload
for the memory type was declared legal, and the result type was legal,
the whole extload was legal.

However, this isn't always the case.  For instance, on X86, with AVX,
this is legal:
    v4i32 load, zext from v4i8
but this isn't:
    v4i64 load, zext from v4i8
Whereas v4i64 is (arguably) legal, even without AVX2.

Note that the same thing was done a while ago for truncstores (r46140),
but I assume no one needed it yet for extloads, so here we go.

Calls to getLoadExtAction were changed to add the value type, found
manually in the surrounding code.

Calls to setLoadExtAction were mechanically changed, by wrapping the
call in a loop, to match previous behavior.  The loop iterates over
the MVT subrange corresponding to the memory type (FP vectors, etc...).
I also pulled neighboring setTruncStoreActions into some of the loops;
those shouldn't make a difference, as the additional types are illegal.
(e.g., i128->i1 truncstores on PPC.)

No functional change intended.

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

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