8 years agoInstrProf: Add missing header from r229478
Justin Bogner [Tue, 17 Feb 2015 08:26:06 +0000 (08:26 +0000)]
InstrProf: Add missing header from r229478

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

8 years ago[X86] Combine vector anyext + and into a vector zext
Michael Kuperstein [Tue, 17 Feb 2015 08:22:51 +0000 (08:22 +0000)]
[X86] Combine vector anyext + and into a vector zext

Vector zext tends to get legalized into a vector anyext, represented as a vector shuffle with an undef vector + a bitcast, that gets ANDed with a mask that zeroes the undef elements.
Combine this into an explicit shuffle with a zero vector instead. This allows shuffle lowering to match it as a zext, instead of matching it as an anyext and emitting an explicit AND.
This combine only covers a subset of the cases, but it's a start.

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

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

8 years agoRe-apply "InstrProf: Add unit tests for the profile reader and writer"
Justin Bogner [Tue, 17 Feb 2015 07:50:59 +0000 (07:50 +0000)]
Re-apply "InstrProf: Add unit tests for the profile reader and writer"

Add these tests again, but use va_list instead of initializer lists.

This reverts r229456, reapplying r229455.

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

8 years ago[PBQP] NDEBUG guards added around code needed for assert.
Jonas Paulsson [Tue, 17 Feb 2015 07:45:06 +0000 (07:45 +0000)]
[PBQP] NDEBUG guards added around code needed for assert.

wasConservativelyAllocatable() is only called to assert that a conservatively
allocatable node wasn't forced to spill.

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

8 years agoMake the PowerPC AsmPrinter independent of global subtarget
Eric Christopher [Tue, 17 Feb 2015 07:21:21 +0000 (07:21 +0000)]
Make the PowerPC AsmPrinter independent of global subtarget
initialization. Initialize the subtarget once per function and
migrate EmitStartOfAsmFile to either use attributes on the
TargetMachine or get information from all of the various

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

8 years agoInstrProf: Use a test fixture in the coverage mapping tests
Justin Bogner [Tue, 17 Feb 2015 06:56:49 +0000 (06:56 +0000)]
InstrProf: Use a test fixture in the coverage mapping tests

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

8 years agoAdd a FIXME to move IsLittleEndian to the target machine.
Eric Christopher [Tue, 17 Feb 2015 06:45:17 +0000 (06:45 +0000)]
Add a FIXME to move IsLittleEndian to the target machine.

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

8 years agoMove ABI handling and 64-bitness to the PowerPC target machine.
Eric Christopher [Tue, 17 Feb 2015 06:45:15 +0000 (06:45 +0000)]
Move ABI handling and 64-bitness to the PowerPC target machine.
This required changing how the computation of the ABI is handled
and how some of the checks for ABI/target are done.

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

8 years ago[Orc][Kaleidoscope] Fix misnumbered steps in comments, plus tidy one
Lang Hames [Tue, 17 Feb 2015 05:53:28 +0000 (05:53 +0000)]
[Orc][Kaleidoscope] Fix misnumbered steps in comments, plus tidy one
explanation up a little.

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

8 years ago[Orc][Kaleidoscope] Add an example of extreme-laziness in Orc.
Lang Hames [Tue, 17 Feb 2015 05:40:42 +0000 (05:40 +0000)]
[Orc][Kaleidoscope] Add an example of extreme-laziness in Orc.

The version of the tutorial uses the new compile callbacks API to inject stubs
that trigger IRGen & Codegen of their respective function bodies when they are
first called.

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

8 years ago[Orc][Kaleidoscope] Update the MainLoop code of the orc/kaleidoscope tutorials
Lang Hames [Tue, 17 Feb 2015 05:36:59 +0000 (05:36 +0000)]
[Orc][Kaleidoscope] Update the MainLoop code of the orc/kaleidoscope tutorials
to get rid of the duplicate prompt. NFC.

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

8 years agoAsmPrinter: Use DIExpression default constructor, NFC
Duncan P. N. Exon Smith [Tue, 17 Feb 2015 02:42:45 +0000 (02:42 +0000)]
AsmPrinter: Use DIExpression default constructor, NFC

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

8 years ago[x86] Teach the unpack lowering to try wider element unpacks.
Chandler Carruth [Tue, 17 Feb 2015 02:12:24 +0000 (02:12 +0000)]
[x86] Teach the unpack lowering to try wider element unpacks.

This allows it to match still more places where previously we would have
to fall back on floating point shuffles or other more complex lowering

I'm hoping to replace some of the hand-rolled unpack matching with this
routine is it gets more and more clever.

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

8 years ago[BDCE] Add a bit-tracking DCE pass
Hal Finkel [Tue, 17 Feb 2015 01:36:59 +0000 (01:36 +0000)]
[BDCE] Add a bit-tracking DCE pass

BDCE is a bit-tracking dead code elimination pass. It is based on ADCE (the
"aggressive DCE" pass), with the added capability to track dead bits of integer
valued instructions and remove those instructions when all of the bits are

Currently, it does not actually do this all-bits-dead removal, but rather
replaces the instruction's uses with a constant zero, and lets instcombine (and
the later run of ADCE) do the rest. Because we essentially get a run of ADCE
"for free" while tracking the dead bits, we also do what ADCE does and removes
actually-dead instructions as well (this includes instructions newly trivially
dead because all bits were dead, but not all such instructions can be removed).

The motivation for this is a case like:

int __attribute__((const)) foo(int i);
int bar(int x) {
  x |= (4 & foo(5));
  x |= (8 & foo(3));
  x |= (16 & foo(2));
  x |= (32 & foo(1));
  x |= (64 & foo(0));
  x |= (128& foo(4));
  return x >> 4;

As it turns out, if you order the bit-field insertions so that all of the dead
ones come last, then instcombine will remove them. However, if you pick some
other order (such as the one above), the fact that some of the calls to foo()
are useless is not locally obvious, and we don't remove them (without this

I did a quick compile-time overhead check using sqlite from the test suite
(Release+Asserts). BDCE took ~0.4% of the compilation time (making it about
twice as expensive as ADCE).

I've not looked at why yet, but we eliminate instructions due to having
all-dead bits in:

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

8 years ago[Orc] Update the Orc indirection utils and refactor the CompileOnDemand layer.
Lang Hames [Tue, 17 Feb 2015 01:18:38 +0000 (01:18 +0000)]
[Orc] Update the Orc indirection utils and refactor the CompileOnDemand layer.

This patch replaces most of the Orc indirection utils API with a new class:
JITCompileCallbackManager, which creates and manages JIT callbacks.
Exposing this functionality directly allows the user to create callbacks that
are associated with user supplied compilation actions. For example, you can
create a callback to lazyily IR-gen something from an AST. (A kaleidoscope
example demonstrating this will be committed shortly).

This patch also refactors the CompileOnDemand layer to use the
JITCompileCallbackManager API.

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

8 years agoSpecify arch in test/CodeGen/X86/float-conv-elim.ll
Hal Finkel [Tue, 17 Feb 2015 00:11:19 +0000 (00:11 +0000)]
Specify arch in test/CodeGen/X86/float-conv-elim.ll

This test was failing on non-x86 hosts because it specified a cpu of x86_64,
but not an architecture. x86_64 is obviously not a valid cpu on all

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

8 years agoAsmPrinter: Stop creating DebugLocs
Duncan P. N. Exon Smith [Tue, 17 Feb 2015 00:02:27 +0000 (00:02 +0000)]
AsmPrinter: Stop creating DebugLocs

While looking at a heap profile of a clang LTO bootstrap with -g, I
noticed that 2.2% of memory in an `llvm-lto` of clang is from calling
`DebugLoc::get()` in `collectVariableInfo()` (accounting for ~40% of
memory used for `MDLocation`s).

I suspect this was introduced by r226736, whose goal was to prevent
uniquing of `DebugLoc`s (goal achieved, if so).

There's no reason we need a `DebugLoc` here at all -- it was just being
used for (in)convenient API -- so the fix is to pass the scope and
inlined-at directly to `LexicalScopes::findInlinedScope()`.

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

8 years ago[PowerPC] Support non-direct-sub/superclass VSX copies
Hal Finkel [Mon, 16 Feb 2015 23:46:30 +0000 (23:46 +0000)]
[PowerPC] Support non-direct-sub/superclass VSX copies

Our register allocation has become better recently, it seems, and is now
starting to generate cross-block copies into inflated register classes. These
copies are not transformed into subregister insertions/extractions by the
PPCVSXCopy class, and so need to be handled directly by
PPCInstrInfo::copyPhysReg. The code to do this was *almost* there, but not
quite (it was unnecessarily restricting itself to only the direct
sub/super-register-class case (not copying between, for example, something in
VRRC and the lower-half of VSRC which are super-registers of F8RC).

Triggering this behavior manually is difficult; I'm including two
bugpoint-reduced test cases from the test suite.

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

8 years agoRevert "InstrProf: Add unit tests for the profile reader and writer"
Justin Bogner [Mon, 16 Feb 2015 23:31:07 +0000 (23:31 +0000)]
Revert "InstrProf: Add unit tests for the profile reader and writer"

Looks like the bots don't like my initializer lists.

This reverts r229455

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

8 years agoInstrProf: Add unit tests for the profile reader and writer
Justin Bogner [Mon, 16 Feb 2015 23:27:48 +0000 (23:27 +0000)]
InstrProf: Add unit tests for the profile reader and writer

This required some minor API to be added to these types to avoid
needing temp files.

Also, I've used initializer lists in the tests, as MSVC 2013 claims to
support them. I'll redo this without them if the bots complain.

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

8 years ago[Mips] Add .MIPS.options section descriptor kinds enumeration
Simon Atanasyan [Mon, 16 Feb 2015 22:59:29 +0000 (22:59 +0000)]
[Mips] Add .MIPS.options section descriptor kinds enumeration

No functional changes.

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

8 years ago[Orc] Add an emitAndFinalize method to the ObjectLinkingLayer, IRCompileLayer
Lang Hames [Mon, 16 Feb 2015 22:36:25 +0000 (22:36 +0000)]
[Orc] Add an emitAndFinalize method to the ObjectLinkingLayer, IRCompileLayer
and LazyEmittingLayer of Orc.

This method allows you to immediately emit and finalize a module. It is required
by an upcoming refactor of the indirection utils and the compile-on-demand

I've filed http://llvm.org/PR22608 to write unit tests for this and other Orc

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

8 years ago[ARM] Remove unused declaration. NFC.
Ahmed Bougacha [Mon, 16 Feb 2015 22:30:08 +0000 (22:30 +0000)]
[ARM] Remove unused declaration. NFC.

GlobalMerge was moved to lib/CodeGen a while ago, and is no longer
called "ARMGlobalMerge".

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

8 years ago[AVX512] Make 512b vector floating point rounds legal on AVX512.
Cameron McInally [Mon, 16 Feb 2015 22:15:42 +0000 (22:15 +0000)]
[AVX512] Make 512b vector floating point rounds legal on AVX512.

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

8 years agoRegisterCoalescer: Don't rematerialize subregister definitions.
Matthias Braun [Mon, 16 Feb 2015 22:05:17 +0000 (22:05 +0000)]
RegisterCoalescer: Don't rematerialize subregister definitions.

We cannot simply rematerialize instructions which only defining a
subregister, as the final value also depends on the previous

This fixes test/CodeGen/R600/subreg-coalescer-bug.ll with subreg
liveness enabled.

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

8 years agoRegisterCoalescer: Do not look for regclass of IMPLICIT_DEF.
Matthias Braun [Mon, 16 Feb 2015 22:05:12 +0000 (22:05 +0000)]
RegisterCoalescer: Do not look for regclass of IMPLICIT_DEF.

IMPLICIT_DEF is a generic instruction and has no (fixed) output register
class defined. The rematerialization code of the register coalescer
should not scan the instruction description for a register class.

This fixes a problem showing up in
test/CodeGen/R600/subreg-coalescer-crash.ll with subregister liveness

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

8 years ago[X86][SSE] Add SSE MOVQ instructions to SSEPackedInt domain
Simon Pilgrim [Mon, 16 Feb 2015 21:50:56 +0000 (21:50 +0000)]
[X86][SSE] Add SSE MOVQ instructions to SSEPackedInt domain

Patch to explicitly add the SSE MOVQ (rr,mr,rm) instructions to SSEPackedInt domain - prevents a number of costly domain switches.

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

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

8 years agoSelectionDAG: fold (fp_to_u/sint (s/uint_to_fp)) here too
Mehdi Amini [Mon, 16 Feb 2015 21:47:58 +0000 (21:47 +0000)]
SelectionDAG: fold (fp_to_u/sint (s/uint_to_fp)) here too

Update SPARC tests to match.

From: Fiona Glaser <fglaser@apple.com>

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

8 years agoInstCombine: fold more cases of (fp_to_u/sint (u/sint_to_fp val))
Mehdi Amini [Mon, 16 Feb 2015 21:47:54 +0000 (21:47 +0000)]
InstCombine: fold more cases of (fp_to_u/sint (u/sint_to_fp val))

Fixes radar 15486701.

From: Fiona Glaser <fglaser@apple.com>

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

8 years agoTests: reformat sitofp.ll and use FileCheck
Mehdi Amini [Mon, 16 Feb 2015 21:47:50 +0000 (21:47 +0000)]
Tests: reformat sitofp.ll and use FileCheck

From: Fiona Glaser <fglaser@apple.com>

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

8 years agoInstrProf: Use ErrorOr for IndexedInstrProfReader::create (NFC)
Justin Bogner [Mon, 16 Feb 2015 21:28:58 +0000 (21:28 +0000)]
InstrProf: Use ErrorOr for IndexedInstrProfReader::create (NFC)

The other InstrProfReader::create factories were updated to return
ErrorOr in r221120, and it's odd for these APIs not to match.

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

8 years ago[X86] Remove the multiply by 8 that goes into the shift constant for X86ISD::VSHLDQ...
Craig Topper [Mon, 16 Feb 2015 20:52:07 +0000 (20:52 +0000)]
[X86] Remove the multiply by 8 that goes into the shift constant for X86ISD::VSHLDQ and X86ISD::VSRLDQ. This simplifies the pattern matching in isel and allows these nodes to become the patterns embedded in the instruction.

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

8 years ago[X86] Remove x86.avx2.psll.dq.bs and x86.avx2.psrl.dq.bs intrinsics.
Craig Topper [Mon, 16 Feb 2015 20:51:59 +0000 (20:51 +0000)]
[X86] Remove x86.avx2.psll.dq.bs and x86.avx2.psrl.dq.bs intrinsics.

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

8 years agoARM: Transfer kill flag when lowering VSTMQIA to VSTMDIA.
Matthias Braun [Mon, 16 Feb 2015 19:34:30 +0000 (19:34 +0000)]
ARM: Transfer kill flag when lowering VSTMQIA to VSTMDIA.

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

8 years agoRegisterCoalescer: Improve previous fix for wrong def after.
Matthias Braun [Mon, 16 Feb 2015 19:34:27 +0000 (19:34 +0000)]
RegisterCoalescer: Improve previous fix for wrong def after.

The previous fix in r225503 was needlessly complicated. The problem goes
away as well if the arguments to MergeValueNumberInto are supplied in the
correct order.
This was previously missed because the existing code already had the
wrong order but an additional later Merge was hiding the bug for the
main liverange VNI.

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

8 years agoMSVC 2013 does not ICE on this code in the same fashion that MSVC 2012 did; NFC.
Aaron Ballman [Mon, 16 Feb 2015 19:33:36 +0000 (19:33 +0000)]
MSVC 2013 does not ICE on this code in the same fashion that MSVC 2012 did; NFC.

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

8 years agoBitcode: Fix major regression: large files w/ debug info
Duncan P. N. Exon Smith [Mon, 16 Feb 2015 19:18:01 +0000 (19:18 +0000)]
Bitcode: Fix major regression: large files w/ debug info

The metadata/value split introduced a major regression reading large
bitcode files that contain debug info (or other cyclic (non-self
reference) metadata graphs).  For the first time in a while, I dropped
from libLTO.dylib down to `llvm-lto` with a non-trivial bitcode file
(~350MB), and I hit this when reading the result of ld64's `-save-temps`
in `llvm-lto`.

Here's pseudo-code for what was going on:

      for each md:
        if has-fwd-ref: // Only true for cyclic graphs.
          any-fwd-refs <- true
      if any-fwd-refs:
        foreach md:
          resolve-cycles(md) // Handle cycles.

    foreach function:
      read-function-metadata-block: // Such as !alias, !loop
        if any-fwd-refs:
          foreach md: // (all metadata, not just this block)
            resolve-cycles(md) // A no-op, but the loop is expensive!!

This commit resets the `AnyFwdRefs` flag to `false`.  This on its own
was enough to change my Release+Asserts `llvm-lto` time for reading this
bitcode from over 20 minutes (I gave up on it) to 20 seconds.  I've gone
further by tracking the min/max metadata forward-references in a
metadata block.  This protects against a schema that has lots of
functions that each reference their own metadata cycle.

Unfortunately, this regression is in the 3.6 branch as well.

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

8 years agoConstantFold: Properly fold GEP indices wider than i64
David Majnemer [Mon, 16 Feb 2015 19:10:02 +0000 (19:10 +0000)]
ConstantFold: Properly fold GEP indices wider than i64

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

8 years agoRun LICM as part of the cleanup phase from the scalar optimizer.
James Molloy [Mon, 16 Feb 2015 18:59:54 +0000 (18:59 +0000)]
Run LICM as part of the cleanup phase from the scalar optimizer.

Things like LoopUnrolling can produce loop invariant values - make sure
we pick them up.

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

8 years agoWe require MSVC 1800 as our minimum, so these checks can safely go away; NFC. (It...
Aaron Ballman [Mon, 16 Feb 2015 18:34:57 +0000 (18:34 +0000)]
We require MSVC 1800 as our minimum, so these checks can safely go away; NFC. (It seems this code has been copy/pasted around, unfortunately.)

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

8 years agoWe require MSVC 1800 as our minimum, so these checks can safely go away; NFC.
Aaron Ballman [Mon, 16 Feb 2015 18:23:00 +0000 (18:23 +0000)]
We require MSVC 1800 as our minimum, so these checks can safely go away; NFC.

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

8 years agoMSVC 2013 supports std::forward_as_tuple, while MSVC 2012 did not; so we can move...
Aaron Ballman [Mon, 16 Feb 2015 18:21:19 +0000 (18:21 +0000)]
MSVC 2013 supports std::forward_as_tuple, while MSVC 2012 did not; so we can move to using the improved API.

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

8 years agoAArch64: Safely handle the incoming sret call argument.
Andrew Trick [Mon, 16 Feb 2015 18:10:47 +0000 (18:10 +0000)]
AArch64: Safely handle the incoming sret call argument.

This adds a safe interface to the machine independent InputArg struct
for accessing the index of the original (IR-level) argument. When a
non-native return type is lowered, we generate the hidden
machine-level sret argument on-the-fly. Before this fix, we were
representing this argument as OrigArgIndex == 0, which is an outright
lie. In particular this crashed in the AArch64 backend where we
actually try to access the type of the original argument.

Now we use a sentinel value for machine arguments that have no
original argument index. AArch64, ARM, Mips, and PPC now check for this
case before accessing the original argument.

Fixes <rdar://19792160> Null pointer assertion in AArch64TargetLowering

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

8 years ago[ADCE] Don't indent inside an anonymous namespace
Hal Finkel [Mon, 16 Feb 2015 18:08:00 +0000 (18:08 +0000)]
[ADCE] Don't indent inside an anonymous namespace

To be consistent with what clang-format does, don't add extra indentation
inside an anonymous namespace. NFC.

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

8 years ago[LoopReroll] Relax some assumptions a little.
James Molloy [Mon, 16 Feb 2015 17:02:00 +0000 (17:02 +0000)]
[LoopReroll] Relax some assumptions a little.

We won't find a root with index zero in any loop that we are able to reroll.
However, we may find one in a non-rerollable loop, so bail gracefully instead
of failing hard.

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

8 years ago[LoopReroll] Don't crash on dead code
James Molloy [Mon, 16 Feb 2015 17:01:52 +0000 (17:01 +0000)]
[LoopReroll] Don't crash on dead code

If a PHI has no users, don't crash; bail gracefully. This shouldn't
happen often, but we can make no guarantees that previous passes didn't leave
dead code around.

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

8 years ago[PBQP] Improve the assert for conservatively allocatables.
Jonas Paulsson [Mon, 16 Feb 2015 15:39:26 +0000 (15:39 +0000)]
[PBQP] Improve the assert for conservatively allocatables.

Remember if the node ever was in this state instead of checking just the
final state.

Reviewed by Arnaud de Grandmaison.

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

8 years ago[asan] Reuse a common function.
Evgeniy Stepanov [Mon, 16 Feb 2015 14:49:37 +0000 (14:49 +0000)]
[asan] Reuse a common function.

Do not reimplement RoundUpToAlignment.

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

8 years ago[x86] Add a generic unpack-targeted lowering technique. This can be used
Chandler Carruth [Mon, 16 Feb 2015 12:28:18 +0000 (12:28 +0000)]
[x86] Add a generic unpack-targeted lowering technique. This can be used
to generically lower blends and is particularly nice because it is
available frome SSE2 onward. This removes a lot of the remaining domain
crossing blends in SSE2 code.

I'm hoping to replace some of the "interleaved" lowering hacks with
something closer to this which should be more principled. First, this
needs to learn how to detect and use other interleavings besides that of
the natural type provided. That will be a follow-up patch though.

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

8 years ago[x86] Switch this test to use checks generated by my update script. NFC
Chandler Carruth [Mon, 16 Feb 2015 12:23:22 +0000 (12:23 +0000)]
[x86] Switch this test to use checks generated by my update script. NFC

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

8 years agoFix quoting of #pragma comment for MS compat, LLVM part.
Michael Kuperstein [Mon, 16 Feb 2015 11:57:17 +0000 (11:57 +0000)]
Fix quoting of #pragma comment for MS compat, LLVM part.

For #pragma comment(linker, ...) MSVC expects the comment string to be quoted, but for #pragma comment(lib, ...) the compiler itself quotes the library name.
Since this distinction disappears by the time the directive reaches the backend, move quoting for the "lib" version to the frontend.

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

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

8 years ago[x86] Add initial basic support for forming blends of v16i8 vectors.
Chandler Carruth [Mon, 16 Feb 2015 10:58:23 +0000 (10:58 +0000)]
[x86] Add initial basic support for forming blends of v16i8 vectors.

This blend instruction is ... really lame. The register usage is insane.
As a consequence this is probably only *barely* better than 2 pshufbs
followed by a por, and that mostly because it only has to read from
a single memory location.

However, this doesn't fix as much as I kind of expected, so more to go.
Pretty sure that the ordering and delegation of v16i8 is just really,
really bad.

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

8 years ago[x86] Add some more test cases for i8 vector blends.
Chandler Carruth [Mon, 16 Feb 2015 10:51:49 +0000 (10:51 +0000)]
[x86] Add some more test cases for i8 vector blends.

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

8 years agoDocument that defaulted & deleted methods and explicit conversions are allowed now.
Benjamin Kramer [Mon, 16 Feb 2015 10:28:41 +0000 (10:28 +0000)]
Document that defaulted & deleted methods and explicit conversions are allowed now.

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

8 years ago[x86] Switch my usage of VariadicFunction to a "normal" variadic
Chandler Carruth [Mon, 16 Feb 2015 09:59:48 +0000 (09:59 +0000)]
[x86] Switch my usage of VariadicFunction to a "normal" variadic
template now that we can use them.

This is, of course, horribly ugly because of the required recursive
formulation. Suggestions for making it less ugly welcome.

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

8 years agoIR: SrcTy == DstTy doesn't imply that a cast is valid
David Majnemer [Mon, 16 Feb 2015 09:37:35 +0000 (09:37 +0000)]
IR: SrcTy == DstTy doesn't imply that a cast is valid

Cast validity depends on the cast's kind, not just its types.

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

8 years agoAsmParser: extractvalue requires at least one index operand
David Majnemer [Mon, 16 Feb 2015 09:18:13 +0000 (09:18 +0000)]
AsmParser: extractvalue requires at least one index operand

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

8 years agoAsmParser: Make sure GlobalVariables have sane types
David Majnemer [Mon, 16 Feb 2015 08:41:08 +0000 (08:41 +0000)]
AsmParser: Make sure GlobalVariables have sane types

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

8 years agoAsmParser: Reject alloca with function type
David Majnemer [Mon, 16 Feb 2015 08:38:03 +0000 (08:38 +0000)]
AsmParser: Reject alloca with function type

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

8 years agoSwitch our index sequence away from template aliases and just use
Chandler Carruth [Mon, 16 Feb 2015 08:22:35 +0000 (08:22 +0000)]
Switch our index sequence away from template aliases and just use
classes. We can't use template aliases because on MSVC they don't appear
to work correctly in the common usage such as Format.h.

Many thanks to Zach for doing all the testing and debugging here. I just
slotted the fix into the code.

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

8 years agoVerifier: Diagnose module flags which have null ID operands
David Majnemer [Mon, 16 Feb 2015 08:14:22 +0000 (08:14 +0000)]
Verifier: Diagnose module flags which have null ID operands

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

8 years ago[X86] Add support for lowering shuffles to 256-bit PALIGNR instruction.
Craig Topper [Mon, 16 Feb 2015 06:29:06 +0000 (06:29 +0000)]
[X86] Add support for lowering shuffles to 256-bit PALIGNR instruction.

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

8 years ago[X86] Remove some hard tab characters from tests.
Craig Topper [Mon, 16 Feb 2015 06:29:02 +0000 (06:29 +0000)]
[X86] Remove some hard tab characters from tests.

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

8 years agoDebugInfo: Don't crash if 'Debug Info Version' has a strange value
David Majnemer [Mon, 16 Feb 2015 06:04:53 +0000 (06:04 +0000)]
DebugInfo: Don't crash if 'Debug Info Version' has a strange value

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

8 years agoDataLayout: Validate that the pref alignment is at least the ABI align
David Majnemer [Mon, 16 Feb 2015 05:41:55 +0000 (05:41 +0000)]
DataLayout: Validate that the pref alignment is at least the ABI align

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

8 years agoDataLayout: Report when the datalayout type alignment/width is too large
David Majnemer [Mon, 16 Feb 2015 05:41:53 +0000 (05:41 +0000)]
DataLayout: Report when the datalayout type alignment/width is too large

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

8 years agoIR: Properly return nullptr when getAggregateElement is out-of-bounds
David Majnemer [Mon, 16 Feb 2015 04:02:09 +0000 (04:02 +0000)]
IR: Properly return nullptr when getAggregateElement is out-of-bounds

We didn't properly handle the out-of-bounds case for
ConstantAggregateZero and UndefValue.  This would manifest as a crash
when the constant folder was asked to fold a load of a constant global
whose struct type has no operands.

This fixes PR22595.

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

8 years ago[CMake] Add RuntimeDyld to libdeps corresponding to r229343.
NAKAMURA Takumi [Mon, 16 Feb 2015 02:13:30 +0000 (02:13 +0000)]
[CMake] Add RuntimeDyld to libdeps corresponding to r229343.

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

8 years ago[x86] Teach the 128-bit vector shuffle lowering routines to take
Chandler Carruth [Mon, 16 Feb 2015 01:52:02 +0000 (01:52 +0000)]
[x86] Teach the 128-bit vector shuffle lowering routines to take
advantage of the existence of a reasonable blend instruction.

The 256-bit vector shuffle lowering has leveraged the general technique
of decomposed shuffles and blends for quite some time, but this never
made it back into the 128-bit code, and there are a large number of
patterns where this is substantially better. For example, this removes
almost all domain crossing in vector shuffles that involve some blend
and some permutation with SSE4.1 and later. See the massive reduction
in 'shufps' for integer test cases in this commit.

This isn't perfect yet for a few reasons:

1) The v8i16 shuffle lowering continues to plague me. We don't always
   form an unpack-based blend when that would be better. But the wins
   pretty drastically outstrip the losses here.
2) The v16i8 shuffle lowering is just a disaster here. I never went and
   implemented blend support here for some terrible reason. I'll do
   that next probably. I've not updated it for now.

More variations on this technique are coming as well -- we don't
shuffle-into-unpack or shuffle-into-palignr, both of which would also be

Note that some test cases grow significantly in the number of
instructions, but I expect to actually be faster. We use
pshufd+pshufd+blendw instead of a single shufps, but the pshufd's are
very likely to pipeline well (two ports on most modern intel chips) and
the blend is a *very* fast instruction. The domain switch penalty will
essentially always be more than a blend instruction, which is the only
increase in tree height.

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

8 years ago[x86] Clean up a few test cases with the update script. NFC
Chandler Carruth [Mon, 16 Feb 2015 01:39:50 +0000 (01:39 +0000)]
[x86] Clean up a few test cases with the update script. NFC

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

8 years ago[X86] Remove gcc builtins for AVX2 psll_dq and psrl_dq intrinsics. Clang no longer...
Craig Topper [Mon, 16 Feb 2015 00:42:36 +0000 (00:42 +0000)]
[X86] Remove gcc builtins for AVX2 psll_dq and psrl_dq intrinsics. Clang no longer needs them.

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

8 years ago[Bitcode reader] Fix a few assertions when reading invalid files
Filipe Cabecinhas [Mon, 16 Feb 2015 00:03:11 +0000 (00:03 +0000)]
[Bitcode reader] Fix a few assertions when reading invalid files

When creating {insert,extract}value instructions from a BitcodeReader, we
weren't verifying the fields were valid.

Bugs found with afl-fuzz

Reviewers: rafael

Subscribers: llvm-commits

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

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

8 years ago[ExecutionEngine] Fix dependence issue by moving RTDyldMemoryManager into
Lang Hames [Sun, 15 Feb 2015 23:22:43 +0000 (23:22 +0000)]
[ExecutionEngine] Fix dependence issue by moving RTDyldMemoryManager into

This should fix http://llvm.org/PR22593.

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

8 years agoMinGW's snprintf is not exposed through std::.
Benjamin Kramer [Sun, 15 Feb 2015 23:17:20 +0000 (23:17 +0000)]
MinGW's snprintf is not exposed through std::.

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

8 years agoRemoving LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the...
Aaron Ballman [Sun, 15 Feb 2015 22:54:22 +0000 (22:54 +0000)]
Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.

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

8 years agoFormat: Modernize using variadic templates.
Benjamin Kramer [Sun, 15 Feb 2015 22:15:41 +0000 (22:15 +0000)]
Format: Modernize using variadic templates.

Introduces a subset of C++14 integer sequences in STLExtras. This is
just enough to support unpacking a std::tuple into the arguments of
snprintf, we can add more of it when it's actually needed.

Also removes an ancient macro hack that leaks a macro into the global
namespace. Clean up users that made use of the convenient hack.

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

8 years agoRemoving LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the macro...
Aaron Ballman [Sun, 15 Feb 2015 22:00:20 +0000 (22:00 +0000)]
Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.

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

8 years agoSince MSVC 1800 is our lowest common denominator, we don't need an explicit check...
Aaron Ballman [Sun, 15 Feb 2015 21:21:52 +0000 (21:21 +0000)]
Since MSVC 1800 is our lowest common denominator, we don't need an explicit check for it in these macros any longer; NFC.

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

8 years agoCommandLine: Use variadic templates to simplify opt constructors.
Benjamin Kramer [Sun, 15 Feb 2015 21:11:25 +0000 (21:11 +0000)]
CommandLine: Use variadic templates to simplify opt constructors.

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

8 years agollvm-pdbdump: Fix warning caused by missing sentinel value.
Zachary Turner [Sun, 15 Feb 2015 20:37:44 +0000 (20:37 +0000)]
llvm-pdbdump: Fix warning caused by missing sentinel value.

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

8 years agollvm-pdbdump: Add flags controlling the type of values to dump.
Zachary Turner [Sun, 15 Feb 2015 20:27:53 +0000 (20:27 +0000)]
llvm-pdbdump: Add flags controlling the type of values to dump.

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

8 years agoFoldingSet: Replace faux variadics with real variadics. NFC.
Benjamin Kramer [Sun, 15 Feb 2015 20:12:17 +0000 (20:12 +0000)]
FoldingSet: Replace faux variadics with real variadics. NFC.

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

8 years agoRemove LLVM_HAS_VARIADIC_TEMPLATES and all the faux variadic workarounds guarded...
Benjamin Kramer [Sun, 15 Feb 2015 19:34:28 +0000 (19:34 +0000)]
Remove LLVM_HAS_VARIADIC_TEMPLATES and all the faux variadic workarounds guarded by it.

We no longer support compilers without variadic template support.

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

8 years agoUpdate the docs to require at least MSVC 2013.
Benjamin Kramer [Sun, 15 Feb 2015 19:34:17 +0000 (19:34 +0000)]
Update the docs to require at least MSVC 2013.

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

8 years agoRevert 229175
Philip Reames [Sun, 15 Feb 2015 19:07:31 +0000 (19:07 +0000)]
Revert 229175

This change is a logical suspect in 22587 and 22590.  Given it's of minimal importanance and I can't get clang to build on my home machine, I'm reverting so that I can deal with this next week.

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

8 years agoAdded (still inefficient) shuffle test case for PR21138
Simon Pilgrim [Sun, 15 Feb 2015 18:21:39 +0000 (18:21 +0000)]
Added (still inefficient) shuffle test case for PR21138

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

8 years agoReapply r229185(cbieneman) -- Raising minimum required Visual Studio version to 2013.
NAKAMURA Takumi [Sun, 15 Feb 2015 17:53:10 +0000 (17:53 +0000)]
Reapply r229185(cbieneman) -- Raising minimum required Visual Studio version to 2013.

This is based on the discussions on: [LLVMdev] [RFC] Raising LLVM minimum required MSVC version to 2013 for trunk

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

8 years ago[ADCE] Convert another loop for a range-based for
Hal Finkel [Sun, 15 Feb 2015 15:51:25 +0000 (15:51 +0000)]
[ADCE] Convert another loop for a range-based for

We can use a range-based for for the operands loop too; NFC.

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

8 years ago[ADCE] Use inst_range and range-based fors
Hal Finkel [Sun, 15 Feb 2015 15:51:23 +0000 (15:51 +0000)]
[ADCE] Use inst_range and range-based fors

Convert a few loops to range-based fors; NFC.

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

8 years ago[ADCE] Fix formatting of pointer types
Hal Finkel [Sun, 15 Feb 2015 15:47:52 +0000 (15:47 +0000)]
[ADCE] Fix formatting of pointer types

We prefer to put the * with the variable, not with the type; NFC.

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

8 years ago[ADCE] Fix capitalization of another local variable
Hal Finkel [Sun, 15 Feb 2015 15:45:30 +0000 (15:45 +0000)]
[ADCE] Fix capitalization of another local variable

Bring another local variable in compliance with our naming conventions, NFC.

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

8 years ago[ADCE] Fix capitalization of some local variables
Hal Finkel [Sun, 15 Feb 2015 15:45:28 +0000 (15:45 +0000)]
[ADCE] Fix capitalization of some local variables

Bring some local variables in compliance with our naming conventions, NFC.

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

8 years agoAdded some test cases of missed opportunities to use unpckl/unpckh shuffles
Simon Pilgrim [Sun, 15 Feb 2015 15:07:45 +0000 (15:07 +0000)]
Added some test cases of missed opportunities to use unpckl/unpckh shuffles

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

8 years agoCoding style fixes to recent patches. NFC.
Simon Pilgrim [Sun, 15 Feb 2015 14:19:29 +0000 (14:19 +0000)]
Coding style fixes to recent patches. NFC.

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

8 years ago[X86][AVX2] vpslldq/vpsrldq byte shifts for AVX2
Simon Pilgrim [Sun, 15 Feb 2015 13:19:52 +0000 (13:19 +0000)]
[X86][AVX2] vpslldq/vpsrldq byte shifts for AVX2

This patch refactors the existing lowerVectorShuffleAsByteShift function to add support for 256-bit vectors on AVX2 targets.

It also fixes a tablegen issue that prevented the lowering of vpslldq/vpsrldq vec256 instructions.

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

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

8 years ago[x86] Add the test case from PR22412, we now get this right even with
Chandler Carruth [Sun, 15 Feb 2015 12:45:05 +0000 (12:45 +0000)]
[x86] Add the test case from PR22412, we now get this right even with
the new vector shuffle legality.

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

8 years ago[x86] Teach the decomposed shuffle/blend lowering to use an early blend
Chandler Carruth [Sun, 15 Feb 2015 12:42:15 +0000 (12:42 +0000)]
[x86] Teach the decomposed shuffle/blend lowering to use an early blend
when that will allow it to lower with a single permute instead of
multiple permutes.

It tries to detect when it will only have to do a single permute in
either case to maximize folding of loads and such.

This cuts a *lot* of the avx2 shuffle permute counts in half. =]

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

8 years ago[SDAG] Teach the SelectionDAG to canonicalize vector shuffles of splats
Chandler Carruth [Sun, 15 Feb 2015 12:18:12 +0000 (12:18 +0000)]
[SDAG] Teach the SelectionDAG to canonicalize vector shuffles of splats
directly into blends of the splats.

These patterns show up even very late in the vector shuffle lowering
where we don't have any chance for DAG combining to kick in, and
blending is a tremendously simpler operation to model. By coercing the
shuffle into a blend we can much more easily match and lower shuffles of

Immediately with this change there are significantly more blends being
matched in the x86 vector shuffle lowering.

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

8 years ago[x86] Teach the shuffle mask equivalence test to look through build
Chandler Carruth [Sun, 15 Feb 2015 12:07:55 +0000 (12:07 +0000)]
[x86] Teach the shuffle mask equivalence test to look through build
vectors and detect equivalent inputs.

This lets the code match unpck-style instructions when only one of the
inputs are lined up but the other input is a splat and so which lanes we
pull from doesn't matter. Today, this doesn't really happen, but just by
accident. I have a patch that normalizes how we shuffle splats, and with
that patch this will be necessary for a lot of the mask equivalence
tests to work.

I don't really know how to write a test case for this specific change
until the other change lands though.

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

8 years ago[x86] Tweak the ordering of unpack matching vs. element insertion, and
Chandler Carruth [Sun, 15 Feb 2015 12:01:14 +0000 (12:01 +0000)]
[x86] Tweak the ordering of unpack matching vs. element insertion, and
don't try to do element insertion for non-zero-index floating point

We don't have any useful patterns or lowering for element insertion into
high elements of a floating point vector, and the generic shuffle
lowering will end up being better -- namely it will fall back to unpck.
But we should try to handle other forms of element insertion before
matching unpck patterns.

While this doesn't matter much right now, I'm working on a patch that
makes unpck matching much more powerful, and that patch will break
without this re-ordering.

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