oota-llvm.git
8 years agoAMDGPU/SI: Fix read2 merging into a super register.
Matt Arsenault [Tue, 14 Jul 2015 17:57:36 +0000 (17:57 +0000)]
AMDGPU/SI: Fix read2 merging into a super register.

If the read2 produced was supposed to be writing into a
super register, it would use the wrong subregister indices.
Fix this by inserting copies, so we only ever write to a vreg_64.
Run the register coalescer again to clean this up, although this
isn't ideal and often does result in an extra move.

Also remove the assert that offset1 > offset0.

There isn't a real reason to not allow this other than a minor
convenience in the compiler, and it doesn't seem worth the effort
of avoiding it.

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

8 years agoMachineRegisterInfo: Remove UsedPhysReg infrastructure
Matthias Braun [Tue, 14 Jul 2015 17:52:07 +0000 (17:52 +0000)]
MachineRegisterInfo: Remove UsedPhysReg infrastructure

We have a detailed def/use lists for every physical register in
MachineRegisterInfo anyway, so there is little use in maintaining an
additional bitset of which ones are used.

Removing it frees us from extra book keeping. This simplifies
VirtRegMap.

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

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

8 years agoAvoid MSVC-incompatible use of init list.
David Blaikie [Tue, 14 Jul 2015 17:40:53 +0000 (17:40 +0000)]
Avoid MSVC-incompatible use of init list.

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

8 years agoRAGreedy: Keep track of allocated PhysRegs internally
Matthias Braun [Tue, 14 Jul 2015 17:38:17 +0000 (17:38 +0000)]
RAGreedy: Keep track of allocated PhysRegs internally

Do not use MachineRegisterInfo::setPhysRegUsed()/isPhysRegUsed()
anymore. This bitset changes function-global state and is set by the
VirtRegRewriter anyway.
Simply use a bitvector private to RAGreedy.

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

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

8 years agoAdd missing builtins to the PPC back end for ABI compliance (vol. 4)
Nemanja Ivanovic [Tue, 14 Jul 2015 17:25:20 +0000 (17:25 +0000)]
Add missing builtins to the PPC back end for ABI compliance (vol. 4)

This patch corresponds to review:
http://reviews.llvm.org/D11183

Back end portion of the fourth round of additions to altivec.h.

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

8 years agoARM: add at least one real test for r242123.
Tim Northover [Tue, 14 Jul 2015 17:23:55 +0000 (17:23 +0000)]
ARM: add at least one real test for r242123.

The ones committed were orthogonal to the change and would have passed before
that revision. What it *did* do was prevent an assertion failure when
generating object files.

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

8 years agoPrologEpilogInserter: Rewrite API to determine callee save regsiters.
Matthias Braun [Tue, 14 Jul 2015 17:17:13 +0000 (17:17 +0000)]
PrologEpilogInserter: Rewrite API to determine callee save regsiters.

This changes TargetFrameLowering::processFunctionBeforeCalleeSavedScan():

- Rename the function to determineCalleeSaves()
- Pass a bitset of callee saved registers by reference, thus avoiding
  the function-global PhysRegUsed bitset in MachineRegisterInfo.
- Without PhysRegUsed the implementation is fine tuned to not save
  physcial registers which are only read but never modified.

Related to rdar://21539507

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

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

8 years agoAArch64: add rev64 alias for 64-bit rev instruction.
Tim Northover [Tue, 14 Jul 2015 17:07:29 +0000 (17:07 +0000)]
AArch64: add rev64 alias for 64-bit rev instruction.

It could be useful to assembly programmers and makes the permitted variants a
little more uniform.

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

8 years ago[Hexagon] Generate "extract" instructions more aggressively
Krzysztof Parzyszek [Tue, 14 Jul 2015 17:07:24 +0000 (17:07 +0000)]
[Hexagon] Generate "extract" instructions more aggressively

Generate extract instructions (via intrinsics) before the DAG combiner
folds shifts into unrecognizable forms.

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

8 years agollvm-ar: Don't try to extract from thin archives.
Rafael Espindola [Tue, 14 Jul 2015 16:55:13 +0000 (16:55 +0000)]
llvm-ar: Don't try to extract from thin archives.

This matches the gnu ar behavior.

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

8 years agoARMAsmParser: Take MCInst param by const-ref
Hans Wennborg [Tue, 14 Jul 2015 16:39:01 +0000 (16:39 +0000)]
ARMAsmParser: Take MCInst param by const-ref

(Broken out from http://reviews.llvm.org/D11167)

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

8 years agoAdd default value for Args parameter of IRBuilder::CreateCall
David Blaikie [Tue, 14 Jul 2015 16:38:30 +0000 (16:38 +0000)]
Add default value for Args parameter of IRBuilder::CreateCall

Convenient for calls to zero-argument functions.

Patch by servuswiegehtz at yahoo.de

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

8 years agoSleep for 2.1 seconds to see if that makes the test stable on windows.
Rafael Espindola [Tue, 14 Jul 2015 16:34:23 +0000 (16:34 +0000)]
Sleep for 2.1 seconds to see if that makes the test stable on windows.

Might fix pr24106.

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

8 years agoAllocate the IntervalMap in ELF.h on the heap to work around MSVC alignment bug ...
Hans Wennborg [Tue, 14 Jul 2015 16:27:16 +0000 (16:27 +0000)]
Allocate the IntervalMap in ELF.h on the heap to work around MSVC alignment bug (PR24113)

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

8 years agollvm-ar: print an error when the requested member is not found.
Rafael Espindola [Tue, 14 Jul 2015 16:02:40 +0000 (16:02 +0000)]
llvm-ar: print an error when the requested member is not found.

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

8 years agoUse a range loop. NFC.
Rafael Espindola [Tue, 14 Jul 2015 15:22:42 +0000 (15:22 +0000)]
Use a range loop. NFC.

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

8 years agoRevert "Fix `llvm-config` to emit the linker flag for the combined shared object...
JF Bastien [Tue, 14 Jul 2015 15:10:34 +0000 (15:10 +0000)]
Revert "Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components."

This reverts commit 01446706b4c0a86bb64768f307079cab5c514aa3.

Causes breakage, seems to be related to 'svn' in the file's name:

  CC=gcc CXX=g++ \
  ../llvm/configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --enable-shared \
    --enable-libffi \
    --enable-targets=all \
    --disable-assertions \
    --with-python=/usr/bin/python2 \
    --enable-optimized

  make REQUIRES_RTTI=1 ENABLE_PIC=1

results:
llvm[2]: Linking Release unit test Support (without symbols)
llvm[2]: ======= Finished Linking Release Unit test Support (without symbols)
make[3]: Entering directory '/build/llvm-svn/src/build/bindings/ocaml/llvm'
make[3]: *** No rule to make target '/build/llvm-
svn/src/build/Release/lib/ocaml/libLLVM-3.7.0svn.so', needed by 'build-
deplibs'.  Stop.
make[3]: *** Waiting for unfinished jobs....
llvm[3]: Compiling llvm_ocaml.c for Release build
make[3]: Leaving directory '/build/llvm-svn/src/build/bindings/ocaml/llvm'
/build/llvm-svn/src/llvm/Makefile.rules:880: recipe for target 'all' failed
/build/llvm-svn/src/llvm/Makefile.rules:965: recipe for target 'all' failed

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

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

8 years agoRename a test. NFC.
Rafael Espindola [Tue, 14 Jul 2015 15:06:18 +0000 (15:06 +0000)]
Rename a test. NFC.

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

8 years agoCaused regressions: compile Release+Asserts failed on clang-native-arm-cortex-a9
Alexandros Lamprineas [Tue, 14 Jul 2015 14:34:06 +0000 (14:34 +0000)]
Caused regressions: compile Release+Asserts failed on clang-native-arm-cortex-a9
Revert "-Added API for retrieving the default FPU of a CPU from TargetParser."

This reverts commit 01199ab0c6ff2d5c4f6b2c05a95ec011e41c4669.

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

8 years agoAMDGPU/SI: Add support for shrinking v_cndmask_b32_e32 instructions
Tom Stellard [Tue, 14 Jul 2015 14:15:03 +0000 (14:15 +0000)]
AMDGPU/SI: Add support for shrinking v_cndmask_b32_e32 instructions

Reviewers: arsenm

Subscribers: llvm-commits

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

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

8 years agoSilencing two MSVC warnings; 'argument' : truncation from 'unsigned int' to 'int16_t...
Aaron Ballman [Tue, 14 Jul 2015 14:14:00 +0000 (14:14 +0000)]
Silencing two MSVC warnings; 'argument' : truncation from 'unsigned int' to 'int16_t' and truncation of constant value. NFC intended.

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

8 years ago-Added API for retrieving the default FPU of a CPU from TargetParser.
Alexandros Lamprineas [Tue, 14 Jul 2015 13:20:48 +0000 (13:20 +0000)]
-Added API for retrieving the default FPU of a CPU from TargetParser.
-Implemented as a table lookup.

Change-Id: Ibf7217f6bd2769e9c06835a5aede3d072dee6757
Phabricator: http://reviews.llvm.org/D11100

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

8 years ago[mips] Fix li/la differences between IAS and GAS.
Daniel Sanders [Tue, 14 Jul 2015 12:24:22 +0000 (12:24 +0000)]
[mips] Fix li/la differences between IAS and GAS.

Summary:
- Signed 16-bit should have priority over unsigned.
- For la, unsigned 16-bit must use ori+addu rather than directly use ori.
- Correct tests on 32-bit immediates with 64-bit predicates by
  sign-extending the immediate beforehand. For example, isInt<16>(0xffff8000)
  should be true and use addiu.

Also split li/la testing into separate files due to their size.

Reviewers: vkalintiris

Subscribers: llvm-commits

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

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

8 years ago[PM/AA] Reformat GlobalsModRef so that subsequent patches I make here
Chandler Carruth [Tue, 14 Jul 2015 08:42:39 +0000 (08:42 +0000)]
[PM/AA] Reformat GlobalsModRef so that subsequent patches I make here
don't continually introduce formatting deltas. NFC

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

8 years agoFix comment typo
Petr Pavlu [Tue, 14 Jul 2015 08:00:34 +0000 (08:00 +0000)]
Fix comment typo

Test commit access.

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

8 years ago[SROA] Don't de-atomic volatile loads and stores
David Majnemer [Tue, 14 Jul 2015 06:19:58 +0000 (06:19 +0000)]
[SROA] Don't de-atomic volatile loads and stores

Volatile loads and stores are made visible in global state regardless of
what memory is involved.  It is not correct to disregard the ordering
and synchronization scope because it is possible to synchronize with
memory operations performed by hardware.

This partially addresses PR23737.

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

8 years agoGenerate correct asm info for mingw and cygwin ARM targets.
Yaron Keren [Tue, 14 Jul 2015 05:51:05 +0000 (05:51 +0000)]
Generate correct asm info for mingw and cygwin ARM targets.

http://reviews.llvm.org/D11075

Patch by Martell Malone
Reviewed by Reid Kleckner

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

8 years ago[CMake] Unbreak add_llvm_external_project when external projects are specified.
NAKAMURA Takumi [Tue, 14 Jul 2015 05:12:53 +0000 (05:12 +0000)]
[CMake] Unbreak add_llvm_external_project when external projects are specified.

LLVM_EXTERNAL_*_SOURCE_DIR is reset as PATH with set(CACHE PATH).
Then the CACHE PATH variable, LLVM_EXTERNAL_*_SOURCE_DIR, is normalized as
${CMAKE_SOURCE_DIR}/${path_var} if ${path_var} is relative.

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

8 years agoPrune trailing whitespaces and CRs.
NAKAMURA Takumi [Tue, 14 Jul 2015 04:03:49 +0000 (04:03 +0000)]
Prune trailing whitespaces and CRs.

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

8 years agoGive an explicit triple to llvm/test/CodeGen/X86/pr13577.ll.
NAKAMURA Takumi [Tue, 14 Jul 2015 03:07:06 +0000 (03:07 +0000)]
Give an explicit triple to llvm/test/CodeGen/X86/pr13577.ll.

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

8 years agoRevert "LegalizeDAG: Fix and improve FCOPYSIGN/FABS legalization"
Matthias Braun [Tue, 14 Jul 2015 02:09:57 +0000 (02:09 +0000)]
Revert "LegalizeDAG: Fix and improve FCOPYSIGN/FABS legalization"

Accidental commit, needs review first.

This reverts commit r242107.

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

8 years agoLegalizeDAG: Fix and improve FCOPYSIGN/FABS legalization
Matthias Braun [Tue, 14 Jul 2015 02:08:26 +0000 (02:08 +0000)]
LegalizeDAG: Fix and improve FCOPYSIGN/FABS legalization

- Factor out code to query and modify the sign bit of a floatingpoint
  value as an integer. This also works if none of the targets integer
  types is big enough to hold all bits of the floatingpoint value.

- Legalize FABS(x) as FCOPYSIGN(x, 0.0) if FCOPYSIGN is available,
  otherwise perform bit manipulation on the sign bit. The previous code
  used "x >u 0 ? x : -x" which is incorrect for x being -0.0! It also
  takes 34 instructions on ARM Cortex-M4. With this patch we only
  require 5:
    vldr d0, LCPI0_0
    vmov r2, r3, d0
    lsrs r2, r3, #31
    bfi r1, r2, #31, #1
    bx lr
  (This could be further improved if the compiler would recognize that
   r2, r3 is zero).

- Only lower FCOPYSIGN(x, y) = sign(x) ? -FABS(x) : FABS(x) if FABS is
  available otherwise perform bit manipulation on the sign bit.

- Perform the sign(x) test by masking out the sign bit and comparing
  with 0 rather than shifting the sign bit to the highest position and
  testing for "<s 0". For x86 copysignl (on 80bit values) this gets us:
    testl $32768, %eax
  rather than:
    shlq $48, %rax
    sets %al
    testb %al, %al

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

8 years agoX86: Check output of x86 copysignl testcase.
Matthias Braun [Tue, 14 Jul 2015 02:08:23 +0000 (02:08 +0000)]
X86: Check output of x86 copysignl testcase.

This makes the changes in an upcoming patch visible.

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

8 years agoAdd capability to get and set the personalitty function from the C API
Andrew Wilkins [Tue, 14 Jul 2015 01:23:06 +0000 (01:23 +0000)]
Add capability to get and set the personalitty function from the C API

Summary:
The capability was lost with D10429 where the personality function was set at function level rather than landing pad level. Now there is no way to get/set the personality function from the C API. That is a problem.

Note that the whole thing could be avoided by improving the C API testing, as started by D10725

Reviewers: chandlerc, bogner, majnemer, andrew.w.kaylor, rafael, rnk, axw

Subscribers: rafael, llvm-commits

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

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

8 years ago[CMake] Forgot to quote the first part of STREQUAL.
Chris Bieneman [Tue, 14 Jul 2015 01:19:07 +0000 (01:19 +0000)]
[CMake] Forgot to quote the first part of STREQUAL.

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

8 years ago[CMake] We shouldn't be storing values in the cache unless they actually need CMake...
Chris Bieneman [Tue, 14 Jul 2015 01:17:43 +0000 (01:17 +0000)]
[CMake] We shouldn't be storing values in the cache unless they actually need CMake cache behavior.

add_llvm_external_project puts LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR into the cache even if it is just the in-tree default path. This causes all sorts of oddness, and makes it so that I can't change the behavior of this variable.

This patch never puts LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR into the cache. It will only end up in the cache if it is specified on the command line, which is the correct behavior.

There is also a temporary change to remove non-default values from the cache if they are already present. This should have the impact of cleaning out unncecissary values from the caches on the buildbots and people's local build directories. This part of the change is marked with a TODO and can be removed in a few days.

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

8 years agoAdd a herper function. NFC.
Rafael Espindola [Tue, 14 Jul 2015 01:06:16 +0000 (01:06 +0000)]
Add a herper function. NFC.

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

8 years agoMIR Serialization: Serialize the variable sized stack objects.
Alex Lorenz [Tue, 14 Jul 2015 00:26:26 +0000 (00:26 +0000)]
MIR Serialization: Serialize the variable sized stack objects.

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

8 years agoUpdate enforceKnownAlignment after the isWeakForLinker semantic change
Reid Kleckner [Tue, 14 Jul 2015 00:11:08 +0000 (00:11 +0000)]
Update enforceKnownAlignment after the isWeakForLinker semantic change

Previously we would refrain from attempting to increase the linkage of
available_externally globals because they were considered weak for the
linker. Now they are treated more like a declaration instead of a weak
definition.

This was causing SSE alignment faults in Chromuim, when some code
assumed it could increase the alignment of a dllimported global that it
didn't control.  http://crbug.com/509256

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

8 years agoMIR Serialization: Serialize the sub register indices.
Alex Lorenz [Mon, 13 Jul 2015 23:24:34 +0000 (23:24 +0000)]
MIR Serialization: Serialize the sub register indices.

This commit serializes the sub register indices from the register machine
operands.

Reviewers: Duncan P. N. Exon Smith

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

8 years agoAdd missing file.
Rafael Espindola [Mon, 13 Jul 2015 23:14:26 +0000 (23:14 +0000)]
Add missing file.

Sorry about that.

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

8 years agoFix reading archive members with / in the name.
Rafael Espindola [Mon, 13 Jul 2015 23:07:05 +0000 (23:07 +0000)]
Fix reading archive members with / in the name.

This is important for thin archives.

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

8 years ago[PPC64LE] More improvements to VSX swap optimization
Bill Schmidt [Mon, 13 Jul 2015 22:58:19 +0000 (22:58 +0000)]
[PPC64LE] More improvements to VSX swap optimization

This patch allows VSX swap optimization to succeed more frequently.
Specifically, it is concerned with common code sequences that occur
when copying a scalar floating-point value to a vector register.  This
patch currently handles cases where the floating-point value is
already in a register, but does not yet handle loads (such as via an
LXSDX scalar floating-point VSX load).  That will be dealt with later.

A typical case is when a scalar value comes in as a floating-point
parameter.  The value is copied into a virtual VSFRC register, and
then a sequence of SUBREG_TO_REG and/or COPY operations will convert
it to a full vector register of the class required by the context.  If
this vector register is then used as part of a lane-permuted
computation, the original scalar value will be in the wrong lane.  We
can fix this by adding a swap operation following any widening
SUBREG_TO_REG operation.  Additional COPY operations may be needed
around the swap operation in order to keep register assignment happy,
but these are pro forma operations that will be removed by coalescing.

If a scalar value is otherwise directly referenced in a computation
(such as by one of the many XS* vector-scalar operations), we
currently disable swap optimization.  These operations are
lane-sensitive by definition.  A MentionsPartialVR flag is added for
use in each swap table entry that mentions a scalar floating-point
register without having special handling defined.

A common idiom for PPC64LE is to convert a double-precision scalar to
a vector by performing a splat operation.  This ensures that the value
can be referenced as V[0], as it would be for big endian, whereas just
converting the scalar to a vector with a SUBREG_TO_REG operation
leaves this value only in V[1].  A doubleword splat operation is one
form of an XXPERMDI instruction, which takes one doubleword from a
first operand and another doubleword from a second operand, with a
two-bit selector operand indicating which doublewords are chosen.  In
the general case, an XXPERMDI can be permitted in a lane-swapped
region provided that it is properly transformed to select the
corresponding swapped values.  This transformation is to reverse the
order of the two input operands, and to reverse and complement the
bits of the selector operand (derivation left as an exercise to the
reader ;).

A new test case that exercises the scalar-to-vector and generalized
XXPERMDI transformations is added as CodeGen/PowerPC/swaps-le-5.ll.
The patch also requires a change to CodeGen/PowerPC/swaps-le-3.ll to
use CHECK-DAG instead of CHECK for two independent instructions that
now appear in reverse order.

There are two small unrelated changes that are added with this patch.
First, the XXSLDWI instruction was incorrectly omitted from the list
of lane-sensitive instructions; this is now fixed.  Second, I observed
that the same webs were being rejected over and over again for
different reasons.  Since it's sufficient to reject a web only once, I
added a check for this to speed up the compilation time slightly.

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

8 years agoUse std::make_tuple to reduce code duplication.
Rafael Espindola [Mon, 13 Jul 2015 22:01:02 +0000 (22:01 +0000)]
Use std::make_tuple to reduce code duplication.

Thanks to David Blaikie for the suggestion.

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

8 years agoRemove unnecessary lines from the test in r242068.
Pete Cooper [Mon, 13 Jul 2015 21:50:35 +0000 (21:50 +0000)]
Remove unnecessary lines from the test in r242068.

This test case was breaking the hexagon elf bot.  The failing lines
were actually unnecessary as checking that the store still reads the
correct value demonstrates that everything is working fine now.

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

8 years agoReduce memory usage of ComputeEditDistance() by (almost) 50%
Nico Weber [Mon, 13 Jul 2015 21:33:21 +0000 (21:33 +0000)]
Reduce memory usage of ComputeEditDistance() by (almost) 50%

ComputeEditDistance() currently keeps two rows of the edit distance matrix in
memory.  That's unnecessary, one row plus one additional element are sufficient.
With this change, strings up to 64 chars can be processed without going to the
heap, compared to 32 chars previously.  (But the main motivation is that the
code gets a bit simpler.)

No intended behavior change.

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

8 years agoLoop idiom recognizer was replacing too many uses of popcount.
Pete Cooper [Mon, 13 Jul 2015 21:25:33 +0000 (21:25 +0000)]
Loop idiom recognizer was replacing too many uses of popcount.

When spotting that a loop can use ctpop, we were incorrectly replacing all uses of a value with a value derived from ctpop.

The bug here was exposed because we were replacing a use prior to the ctpop with the ctpop value and so we have a use before def, i.e., we changed

 %tobool.5 = icmp ne i32 %num, 0
 store i1 %tobool.5, i1* %ptr
 br i1 %tobool.5, label %for.body.lr.ph, label %for.end

to

 store i1 %1, i1* %ptr
 %0 = call i32 @llvm.ctpop.i32(i32 %num)
 %1 = icmp ne i32 %0, 0
 br i1 %1, label %for.body.lr.ph, label %for.end

Even if we inserted the ctpop so that it dominates the store here, that would still be incorrect.  The store doesn’t want the result of ctpop.

The fix is very simple, and involves replacing only the branch condition with the ctpop instead of all uses.

Reviewed by Hal Finkel.

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

8 years ago[WinEH] Emit the LSDA even if no lpads remain but outlining occurred
Reid Kleckner [Mon, 13 Jul 2015 20:41:46 +0000 (20:41 +0000)]
[WinEH] Emit the LSDA even if no lpads remain but outlining occurred

The outlined funclets call intrinsics which reference labels from the
LSDA. This situation can easily arise in small functions with a single
cleanup at -O0, where Clang marks a definition as nounwind, and then
WinEHPrepare "discovers" that the landingpad is dead by accident and
deletes it.

We now need to ask the LLVM IR Function for it's personality directly,
rather than going through MachineModuleInfo.

Fixes PR23892.

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

8 years ago[Hexagon] Move BitTracker into the llvm namespace and remove redundant qualifications
Benjamin Kramer [Mon, 13 Jul 2015 20:38:16 +0000 (20:38 +0000)]
[Hexagon] Move BitTracker into the llvm namespace and remove redundant qualifications

No functional change intended.

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

8 years agoAdd support deterministic output in llvm-ar and make it the default.
Rafael Espindola [Mon, 13 Jul 2015 20:38:09 +0000 (20:38 +0000)]
Add support deterministic output in llvm-ar and make it the default.

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

8 years agoRevert "[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registrati...
Chris Bieneman [Mon, 13 Jul 2015 20:30:58 +0000 (20:30 +0000)]
Revert "[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working."

Reverting r242059 because it broke some bots. I'm attempting to reproduce the failures now.

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

8 years ago[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that...
Chris Bieneman [Mon, 13 Jul 2015 20:23:15 +0000 (20:23 +0000)]
[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working.

Summary:
This change re-lands r241621, with an additional fix that was required to allow tool sources to live outside the llvm checkout. It also no longer renames LLVM_EXTERNAL_*_SOURCE_DIR. This change was reverted in r241663, because it renamed several variables of the format LLVM_EXTERNAL_*_* to LLVM_TOOL_*_*.

Original Summary:
The tools CMakeLists file already had implicit tool registration, but there were a few things off about it that needed to be altered to make it work. This change addresses all that. The changes in this patch are:

* factored out canonicalizing tool names from paths to CMake variables * removed the LLVM_IMPLICIT_PROJECT_IGNORE mechanism in favor of LLVM_EXTERNAL_${nameUPPER}_BUILD which I renamed to LLVM_TOOL_${nameUPPER}_BUILD because it applies to internal and external tools
* removed ignore_llvm_tool_subdirectory() in favor of just setting LLVM_TOOL_${nameUPPER}_BUILD to Off
* Added create_llvm_tool_options() to resolve a bug in add_llvm_external_project() - the old LLVM_EXTERNAL_${nameUPPER}_BUILD would not work on a clean CMake directory because the option could be created after it was set in code.
* Removed all but the minimum required calls to add_llvm_external_project from tools/CMakeLists.txt

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

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

8 years ago[CMake] Add missing DebugInfo libraries to llvm-shlib
Keno Fischer [Mon, 13 Jul 2015 19:41:51 +0000 (19:41 +0000)]
[CMake] Add missing DebugInfo libraries to llvm-shlib

Reviewers: beanz

Subscribers: llvm-commits

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

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

8 years agoAMDGPU: Minor cleanups to always inline pass
Matt Arsenault [Mon, 13 Jul 2015 19:08:36 +0000 (19:08 +0000)]
AMDGPU: Minor cleanups to always inline pass

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

8 years ago[MC] Correctly escape .safeseh's symbol
David Majnemer [Mon, 13 Jul 2015 18:51:15 +0000 (18:51 +0000)]
[MC] Correctly escape .safeseh's symbol

This fixes PR24107.

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

8 years agoEnable partial and runtime loop unrolling for NVPTX.
Mark Heffernan [Mon, 13 Jul 2015 18:33:21 +0000 (18:33 +0000)]
Enable partial and runtime loop unrolling for NVPTX.

Enable partial and runtime loop unrolling for NVPTX backend via
TTI::UnrollingPreferences with a small threshold. This partially unrolls
small loops which are often unrolled by the PTX to SASS compiler
and unrolling earlier can be beneficial.

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

8 years agoEnable runtime unrolling with unroll pragma metadata
Mark Heffernan [Mon, 13 Jul 2015 18:26:27 +0000 (18:26 +0000)]
Enable runtime unrolling with unroll pragma metadata

Enable runtime unrolling for loops with unroll count metadata ("#pragma unroll N")
and a runtime trip count. Also, do not unroll loops with unroll full metadata if the
loop has a runtime loop count. Previously, such loops would be unrolled with a
very large threshold (pragma-unroll-threshold) if runtime unrolled happened to be
enabled resulting in a very large (and likely unwise) unroll factor.

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

8 years agoService the doxygen comments in DwarfUnit and DwarfDebug.
Adrian Prantl [Mon, 13 Jul 2015 18:25:29 +0000 (18:25 +0000)]
Service the doxygen comments in DwarfUnit and DwarfDebug.

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

8 years agoMIR Serialization: Serialize the fixed stack objects.
Alex Lorenz [Mon, 13 Jul 2015 18:07:26 +0000 (18:07 +0000)]
MIR Serialization: Serialize the fixed stack objects.

This commit serializes the fixed stack objects, including fixed spill slots.
The fixed stack objects are serialized using a YAML sequence of YAML inline
mappings. Each mapping has the object's ID, type, size, offset, and alignment.
The objects that aren't spill slots also serialize the isImmutable and isAliased
flags.

The fixed stack objects are a part of the machine function's YAML mapping.

Reviewers: Duncan P. N. Exon Smith

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

8 years ago[WinEH] Strip the \01 character from the __CxxFrameHandler3 thunk name
Reid Kleckner [Mon, 13 Jul 2015 17:55:14 +0000 (17:55 +0000)]
[WinEH] Strip the \01 character from the __CxxFrameHandler3 thunk name

Add another C++ 32-bit EH table test.

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

8 years agoRemove macro guards for extern template instantiations.
Benjamin Kramer [Mon, 13 Jul 2015 17:21:31 +0000 (17:21 +0000)]
Remove macro guards for extern template instantiations.

This is a C++11 feature that both GCC and MSVC have supported as ane extension
long before C++11 was approved.

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

8 years agoAvoid using Loop::getSubLoopsVector.
Benjamin Kramer [Mon, 13 Jul 2015 17:21:14 +0000 (17:21 +0000)]
Avoid using Loop::getSubLoopsVector.

Passes should never modify it, just use the const version. While there
reduce copying in LoopInterchange. No functional change intended.

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

8 years agoFix handling of the 'n' asm constraint with invalid operands.
James Y Knight [Mon, 13 Jul 2015 16:36:22 +0000 (16:36 +0000)]
Fix handling of the 'n' asm constraint with invalid operands.

It had accidently accepted a symbol+offset value (and emitted
incorrect code for it, keeping only the offset part) instead of
properly reporting the constraint as invalid.

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

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

8 years agoAMDGPU/SI: Select mad patterns to v_mac_f32
Tom Stellard [Mon, 13 Jul 2015 15:47:57 +0000 (15:47 +0000)]
AMDGPU/SI: Select mad patterns to v_mac_f32

The two-address instruction pass will convert these back to v_mad_f32
if necessary.

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

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

8 years agoARM: Fix cttz expansion on vector types.
Logan Chien [Mon, 13 Jul 2015 15:37:30 +0000 (15:37 +0000)]
ARM: Fix cttz expansion on vector types.

The 64/128-bit vector types are legal if NEON instructions are
available.  However, there was no matching patterns for @llvm.cttz.*()
intrinsics and result in fatal error.

This commit fixes the problem by lowering cttz to:
a. ctpop((x & -x) - 1)
b. width - ctlz(x & -x) - 1

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

8 years ago[ARM] Handle commutativity when converting to tADDhirr in Thumb2
Scott Douglass [Mon, 13 Jul 2015 15:31:48 +0000 (15:31 +0000)]
[ARM] Handle commutativity when converting to tADDhirr in Thumb2

Also, run thumb_rewrite.s tests in Thumb2 now that they pass.

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

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

8 years ago[ARM] Add Thumb2 ADD with SP narrowing from 3 operand to 2
Scott Douglass [Mon, 13 Jul 2015 15:31:40 +0000 (15:31 +0000)]
[ARM] Add Thumb2 ADD with SP narrowing from 3 operand to 2

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

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

8 years ago[ARM] Small refactor of tryConvertingToTwoOperandForm (nfc)
Scott Douglass [Mon, 13 Jul 2015 15:31:33 +0000 (15:31 +0000)]
[ARM] Small refactor of tryConvertingToTwoOperandForm (nfc)

Also, add more Thumb2 ADD tests requested during review of
http://reviews.llvm.org/D11053.

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

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

8 years agoCleanup after r241809 - remove uncessary call to std::sort
Silviu Baranga [Mon, 13 Jul 2015 14:48:24 +0000 (14:48 +0000)]
Cleanup after r241809 - remove uncessary call to std::sort

Summary:
The iteration order within a member of DepCands is deterministic
and therefore we don't have to sort the accesses within a member.
We also don't have to copy the indices of the pointers into a
vector, since we can iterate over the members of the class.

Subscribers: llvm-commits

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

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

8 years agoRemove unused variable.
Rafael Espindola [Mon, 13 Jul 2015 14:43:33 +0000 (14:43 +0000)]
Remove unused variable.

Sorry I missed it in the previous commit.

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

8 years agoAliases don't have available_externally linkage.
Rafael Espindola [Mon, 13 Jul 2015 14:39:02 +0000 (14:39 +0000)]
Aliases don't have available_externally linkage.

Allowing that is probably a good idea, but currently we don't, so
this is dead code.

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

8 years agoDon't change the visibility when converting a definition to a declaration.
Rafael Espindola [Mon, 13 Jul 2015 14:18:22 +0000 (14:18 +0000)]
Don't change the visibility when converting a definition to a declaration.

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

8 years agoRemoving several -Wunused-but-set-variable warnings; NFC intended.
Aaron Ballman [Mon, 13 Jul 2015 14:04:30 +0000 (14:04 +0000)]
Removing several -Wunused-but-set-variable warnings; NFC intended.

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

8 years agoPrint the visibility of available_externally functions.
Rafael Espindola [Mon, 13 Jul 2015 13:55:18 +0000 (13:55 +0000)]
Print the visibility of available_externally functions.

We were already printing it for declarations, but not available_externally.

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

8 years agoRevert r241981 "Revert "Revert r236894 "[BasicAA] Fix zext & sext handling"""
Manuel Klimek [Mon, 13 Jul 2015 13:50:55 +0000 (13:50 +0000)]
Revert r241981 "Revert "Revert r236894 "[BasicAA] Fix zext & sext handling"""

The repros from PR23626 still fail.

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

8 years agoAVX-512: Added all AVX-512 forms of Vector Convert for Float/Double/Int/Long types.
Elena Demikhovsky [Mon, 13 Jul 2015 13:26:20 +0000 (13:26 +0000)]
AVX-512: Added all AVX-512 forms of Vector Convert for Float/Double/Int/Long types.
In this patch I have only encoding. Intrinsics and DAG lowering will be in the next patch.
I temporary removed the old intrinsics test (just to split this patch).
Half types are not covered here.

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

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

8 years ago[llvm-stress] Remove unneeded llvm:: prefix. NFC.
Pawel Bylica [Mon, 13 Jul 2015 11:25:56 +0000 (11:25 +0000)]
[llvm-stress] Remove unneeded llvm:: prefix. NFC.

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

8 years ago[mips] Explained the 'w' modifier in the Inline Assembler documentation.
Daniel Sanders [Mon, 13 Jul 2015 09:24:21 +0000 (09:24 +0000)]
[mips] Explained the 'w' modifier in the Inline Assembler documentation.

It exists for compatibility with GCC which requires it to print MSA registers
for the 'f' constraint. Although LLVM doesn't need it, the 'w' modifier should
still be used for portability between the two compilers.

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

8 years ago[LSR] don't attempt to promote ephemeral values to indvars
Jingyue Wu [Mon, 13 Jul 2015 03:28:53 +0000 (03:28 +0000)]
[LSR] don't attempt to promote ephemeral values to indvars

Summary:
This at least saves compile time. I also encountered a case where
ephemeral values affect whether other variables are promoted, causing
performance issues. It may be a bug in LSR, but I didn't manage to
reduce it yet. Anyhow, I believe it's in general not worth considering
ephemeral values in LSR.

Reviewers: atrick, hfinkel

Subscribers: llvm-commits

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

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

8 years ago[InstSimplify] Teach InstSimplify how to simplify extractelement
David Majnemer [Mon, 13 Jul 2015 01:15:53 +0000 (01:15 +0000)]
[InstSimplify] Teach InstSimplify how to simplify extractelement

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

8 years ago[InstSimplify] Teach InstSimplify how to simplify extractvalue
David Majnemer [Mon, 13 Jul 2015 01:15:46 +0000 (01:15 +0000)]
[InstSimplify] Teach InstSimplify how to simplify extractvalue

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

8 years agoFix PR24099 reported by Tomas Brukner.
Yaron Keren [Sun, 12 Jul 2015 20:40:41 +0000 (20:40 +0000)]
Fix PR24099 reported by Tomas Brukner.

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

8 years ago[ARM] Add support for nest attribute using r12
Renato Golin [Sun, 12 Jul 2015 18:16:40 +0000 (18:16 +0000)]
[ARM] Add support for nest attribute using r12

Register r12 ('ip') is used by GCC for this purpose
and hence is used here. As discussed on the GCC mailing
list, the register choice is an ABI issue and so
choosing the same register as GCC means
__builtin_call_with_static_chain is compatible.

A similar patch has just gone in the AArch64 backend,
so this is just the ARM counterpart, following the same
discussion.

Patch by Stephen Cross.

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

8 years ago[X86][SSE] Tidied up vector extend/truncation tests. NFCI.
Simon Pilgrim [Sun, 12 Jul 2015 17:40:49 +0000 (17:40 +0000)]
[X86][SSE] Tidied up vector extend/truncation tests. NFCI.

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

8 years ago[X86][SSE] (V)PMINSB is commutable.
Simon Pilgrim [Sun, 12 Jul 2015 16:44:11 +0000 (16:44 +0000)]
[X86][SSE] (V)PMINSB is commutable.

(V)PMINSB is no different to the other (V)PMIN/(V)PMAX B/D/W instructions - it is fully commutable.

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

8 years agoTrim trailing whitespaces. NFC.
Simon Pilgrim [Sun, 12 Jul 2015 11:17:33 +0000 (11:17 +0000)]
Trim trailing whitespaces. NFC.

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

8 years ago[X86][SSE] Vectorized v4i32 non-uniform shifts.
Simon Pilgrim [Sun, 12 Jul 2015 11:15:19 +0000 (11:15 +0000)]
[X86][SSE] Vectorized v4i32 non-uniform shifts.

While the v4i32 shl operation is already vectorized using a cvttps2dq/pmulld pattern, the lshr/ashr opeations are still scalarized.

This patch adds vectorization support for non-uniform v4i32 shift operations - it splats constant shift amounts to allow them to use the immediate sse shift instructions, or extracts/zero-extends non-constant shift amounts. The individual results are then blended together.

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

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

8 years ago[LICM] Don't try to sink values out of loops without any exits
David Majnemer [Sun, 12 Jul 2015 03:53:05 +0000 (03:53 +0000)]
[LICM] Don't try to sink values out of loops without any exits

There is no suitable basic block to sink instructions in loops without
exits.  The only way an instruction in a loop without exits can be used
is as an incoming value to a PHI.  In such cases, the incoming block for
the corresponding value is unreachable.

This fixes PR24013.

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

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

8 years ago[PowerPC] Make use of the TargetRecip system
Hal Finkel [Sun, 12 Jul 2015 02:33:57 +0000 (02:33 +0000)]
[PowerPC] Make use of the TargetRecip system

r238842 added the TargetRecip system for controlling use of reciprocal
estimates for sqrt and division using a set of parameters that can be set by
the frontend. Clang now supports a sophisticated -mrecip option, and this will
allow that option to effectively control the relevant code-generation
functionality of the PPC backend.

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

8 years ago[PowerPC] Support the nest parameter attribute
Hal Finkel [Sun, 12 Jul 2015 00:37:44 +0000 (00:37 +0000)]
[PowerPC] Support the nest parameter attribute

This adds support for the 'nest' attribute, which allows the static chain
register to be set for functions calls under non-Darwin PPC/PPC64 targets. r11
is the chain register (which the PPC64 ELF ABI calls the "environment
pointer"). For indirect calls under PPC64 ELFv1, this would normally be loaded
from the function descriptor, but providing an explicit 'nest' parameter will
override that process and use the value provided.

This allows __builtin_call_with_static_chain to work as expected on PowerPC.

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

8 years agoRevert "[ExecutionEngine] Use std::function rather than a function pointer for the...
Renato Golin [Sat, 11 Jul 2015 13:42:48 +0000 (13:42 +0000)]
Revert "[ExecutionEngine] Use std::function rather than a function pointer for the LazyFunctionCreator."

This reverts commit r241962, as it was breaking all ARM buildbots.

It also reverts the two subsequent related commits:

r241974: "[ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a warning."

r241973: "[ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for r241962."

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

8 years agoRevert "Revert r236894 "[BasicAA] Fix zext & sext handling""
Hal Finkel [Sat, 11 Jul 2015 11:04:54 +0000 (11:04 +0000)]
Revert "Revert r236894 "[BasicAA] Fix zext & sext handling""

r236894 caused PR23626 (Clang miscompiles webkit's base64 decoder), and was
reverted in r237984. This reapplies the patch with an additional test case for
PR23626 and the associated fix (both scales and offsets in the
BasicAliasAnalysis::constantOffsetHeuristic should initially be zero).

Patch by Nick White, thanks!

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

8 years agoMove getStrideFromPointer and friends from LoopVectorize to VectorUtils
Hal Finkel [Sat, 11 Jul 2015 10:52:42 +0000 (10:52 +0000)]
Move getStrideFromPointer and friends from LoopVectorize to VectorUtils

The following functions are moved from the LoopVectorizer to VectorUtils:

  - getGEPInductionOperand
  - stripGetElementPtr
  - getUniqueCastUse
  - getStrideFromPointer

These used to be static functions in LoopVectorize, but will also be used by
the upcoming loop versioning LICM transformation.

Patch by Ashutosh Nema!

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

8 years agoAdd argmemonly attribute.
Igor Laevsky [Sat, 11 Jul 2015 10:30:36 +0000 (10:30 +0000)]
Add argmemonly attribute.

This change adds new attribute called "argmemonly". Function marked with this attribute can only access memory through it's argument pointers. This attribute directly corresponds to the "OnlyAccessesArgumentPointees" ModRef behaviour in alias analysis.

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

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

8 years agoFix include guard typo introduced in r239315.
Yaron Keren [Sat, 11 Jul 2015 09:40:28 +0000 (09:40 +0000)]
Fix include guard typo introduced in r239315.

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

8 years agoDefine a new intrinsic @llvm.canonicalize.
Owen Anderson [Sat, 11 Jul 2015 07:01:27 +0000 (07:01 +0000)]
Define a new intrinsic @llvm.canonicalize.

This is used the canonicalize floating point values, which is useful for
implementing certain numeric primitives.  See the LangRef changes for
the full details of its semantics.

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

8 years ago[PM/AA] Completely remove the AliasAnalysis::copyValue interface.
Chandler Carruth [Sat, 11 Jul 2015 04:39:00 +0000 (04:39 +0000)]
[PM/AA] Completely remove the AliasAnalysis::copyValue interface.

No in-tree alias analysis used this facility, and it was not called in
any particularly rigorous way, so it seems unlikely to be correct.

Note that one of the only stateful AA implementations in-tree,
GlobalsModRef is completely broken currently (and any AA passes like it
are equally broken) because Module AA passes are not effectively
invalidated when a function pass that fails to update the AA stack runs.

Ultimately, it doesn't seem like we know how we want to build stateful
AA, and until then trying to support and maintain correctness for an
untested API is essentially impossible. To that end, I'm planning to rip
out all of the update API. It can return if and when we need it and know
how to build it on top of the new pass manager and as part of *tested*
stateful AA implementations in the tree.

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

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

8 years ago[ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a
Lang Hames [Sat, 11 Jul 2015 02:07:28 +0000 (02:07 +0000)]
[ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a
warning.

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

8 years ago[ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for
Lang Hames [Sat, 11 Jul 2015 01:59:04 +0000 (01:59 +0000)]
[ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for
r241962.

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

8 years agoRenamed some uses of unroll to interleave in the vectorizer.
Tyler Nowicki [Sat, 11 Jul 2015 00:31:11 +0000 (00:31 +0000)]
Renamed some uses of unroll to interleave in the vectorizer.

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