OSDN Git Service

android-x86/external-llvm.git
6 years ago[LV] NFC patch for moving VP*Recipe class definitions from LoopVectorize.cpp to VPlan.h
Hal Finkel [Sat, 16 Dec 2017 01:12:50 +0000 (01:12 +0000)]
[LV] NFC patch for moving VP*Recipe class definitions from LoopVectorize.cpp to VPlan.h

This is a small step forward to move VPlan stuff to where it should belong (i.e., VPlan.*):

  1. VP*Recipe classes in LoopVectorize.cpp are moved to VPlan.h.
  2. Many of VP*Recipe::print() and execute() definitions are still left in
     LoopVectorize.cpp since they refer to things declared in LoopVectorize.cpp. To
     be moved to VPlan.cpp at a later time.
  3. InterleaveGroup class is moved from anonymous namespace to llvm namespace.
     Referencing it in anonymous namespace from VPlan.h ended up in warning.

Patch by Hideki Saito, thanks!

Differential Revision: https://reviews.llvm.org/D41045

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

6 years agoAdd -enable-import-metadata to test
Teresa Johnson [Sat, 16 Dec 2017 01:00:48 +0000 (01:00 +0000)]
Add -enable-import-metadata to test

r320895 modified a test so that it needs -enable-import-metadata which
is false by default for NDEBUG.

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

6 years ago[X86] Add back the assert from r320830 that was reverted in r320850
Craig Topper [Sat, 16 Dec 2017 00:33:16 +0000 (00:33 +0000)]
[X86] Add back the assert from r320830 that was reverted in r320850

Hopefully r320864 has fixed the offending case that failed the assert.

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

6 years agoFix NDEBUG build problem in r320895
Teresa Johnson [Sat, 16 Dec 2017 00:29:31 +0000 (00:29 +0000)]
Fix NDEBUG build problem in r320895

Fix incorrect placement of #endif causing NDEBUG build failures.

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

6 years ago[ThinLTO] Enable importing of aliases as copy of aliasee
Teresa Johnson [Sat, 16 Dec 2017 00:18:12 +0000 (00:18 +0000)]
[ThinLTO] Enable importing of aliases as copy of aliasee

Summary:
This implements a missing feature to allow importing of aliases, which
was previously disabled because alias cannot be available_externally.
We instead import an alias as a copy of its aliasee.

Some additional work was required in the IndexBitcodeWriter for the
distributed build case, to ensure that the aliasee has a value id
in the distributed index file (i.e. even when it is not being
imported directly).

This is a performance win in codes that have many aliases, e.g. C++
applications that have many constructor and destructor aliases.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D40747

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

6 years agoFix WebAssembly backend for some LLVM API changes
David Blaikie [Fri, 15 Dec 2017 23:52:06 +0000 (23:52 +0000)]
Fix WebAssembly backend for some LLVM API changes

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

6 years ago[TableGen][GlobalISel] Make the different Matcher comparable
Quentin Colombet [Fri, 15 Dec 2017 23:24:39 +0000 (23:24 +0000)]
[TableGen][GlobalISel] Make the different Matcher comparable

This opens refactoring opportunities in the match table now that we can
check that two predicates are the same.

NFC.

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

6 years ago[TableGen][GlobalISel] Fix unused variable warning in release mode
Quentin Colombet [Fri, 15 Dec 2017 23:24:36 +0000 (23:24 +0000)]
[TableGen][GlobalISel] Fix unused variable warning in release mode

Introduced in r320887.

NFC.

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

6 years agoRevert "Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header.""
Paul Robinson [Fri, 15 Dec 2017 23:21:52 +0000 (23:21 +0000)]
Revert "Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header.""

This reverts commit 0afef672f63f0e4e91938656bc73424a8c058bfc.
Still failing at runtime on bots.

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

6 years ago[TableGen][GlobalISel] Have the predicate directly know which data they are dealing...
Quentin Colombet [Fri, 15 Dec 2017 23:07:42 +0000 (23:07 +0000)]
[TableGen][GlobalISel] Have the predicate directly know which data they are dealing with

Prior to this patch, a predicate wouldn't make sense outside of its
rule. Indeed, it was only during emitting a rule that a predicate would
be made aware of the IDs of the data it is checking. Because of that,
predicates could not be moved around or compared between each other.

NFC.

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

6 years agoRecommit "[DWARFv5] Dump an MD5 checksum in the line-table header."
Paul Robinson [Fri, 15 Dec 2017 22:57:17 +0000 (22:57 +0000)]
Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."
Adds missing support for DW_FORM_data16.

Update of r320852, fixing the unittest to use a hand-coded struct
instead of std::array to guarantee data layout.

Differential Revision: https://reviews.llvm.org/D41090

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

6 years agoFix unused variable in non-assert builds
Matthias Braun [Fri, 15 Dec 2017 22:53:33 +0000 (22:53 +0000)]
Fix unused variable in non-assert builds

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

6 years agoMachineFunction: Return reference from getFunction(); NFC
Matthias Braun [Fri, 15 Dec 2017 22:22:58 +0000 (22:22 +0000)]
MachineFunction: Return reference from getFunction(); NFC

The Function can never be nullptr so we can return a reference.

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

6 years agoMachineFunction: Slight refactoring; NFC
Matthias Braun [Fri, 15 Dec 2017 22:22:46 +0000 (22:22 +0000)]
MachineFunction: Slight refactoring; NFC

Slight cleanup/refactor in preparation for upcoming commit.

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

6 years agoMachineModuleInfo: Remove unused function; NFC
Matthias Braun [Fri, 15 Dec 2017 22:22:42 +0000 (22:22 +0000)]
MachineModuleInfo: Remove unused function; NFC

Remove the unused setModule() function; it would be dangerous if someone
actually used it as it wouldn't reset/recompute various other module
related data.

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

6 years agoFixed the gcc 'enumeral and non-enumeral type in conditional expression [-Werror...
Galina Kistanova [Fri, 15 Dec 2017 22:15:29 +0000 (22:15 +0000)]
Fixed the gcc 'enumeral and non-enumeral type in conditional expression [-Werror=extra]' warning introduced by r320750

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

6 years ago[Hexagon] Remove recursion in visitUsesOf, replace with use queue
Krzysztof Parzyszek [Fri, 15 Dec 2017 21:34:05 +0000 (21:34 +0000)]
[Hexagon] Remove recursion in visitUsesOf, replace with use queue

This is primarily to reduce stack usage, but ordering the use queue
according to the position in the code (earlier instructions visited
before later ones) reduces the number of unnecessary bottoms due to
visiting instructions out of order, e.g.
  %reg1 = copy %reg0
  %reg2 = copy %reg0
  %reg3 = and %reg1, %reg2
Here, reg3 should be known to be same as reg0-2, but if reg3 is
evaluated after reg1 is updated, but before reg2 is updated, the two
inputs to the and will appear different, causing reg3 to become
bottom.

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

6 years ago[Hexagon] Handle concat_vectors of all allowed HVX types
Krzysztof Parzyszek [Fri, 15 Dec 2017 21:23:12 +0000 (21:23 +0000)]
[Hexagon] Handle concat_vectors of all allowed HVX types

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

6 years ago[X86] Use AND32ri8 instead of AND64ri8 in Asan code in EmitCallAsanReport for 32...
Craig Topper [Fri, 15 Dec 2017 21:18:06 +0000 (21:18 +0000)]
[X86] Use AND32ri8 instead of AND64ri8 in Asan code in EmitCallAsanReport for 32-bit mode.

This seemed to work due to a quirk in the X86 MC encoder that didn't emit a REX byte that the AND64ri8 implies when in 32-bit mode. This made the encoding the same as AND32ri8. I tried to add an assert to catch the dropped REX prefix that caught this.

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

6 years ago[X86] In LowerVectorCTPOP use ISD::ZERO_EXTEND/ISD::TRUNCATE instead of the target...
Craig Topper [Fri, 15 Dec 2017 21:18:05 +0000 (21:18 +0000)]
[X86] In LowerVectorCTPOP use ISD::ZERO_EXTEND/ISD::TRUNCATE instead of the target specific nodes.

The target independent nodes will get legalized to the target specific nodes by their own legalization process. Someday I'd like to stop using a target specific for zero extends and truncates of legal types so the less places we reference the target specific opcode the better.

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

6 years ago[X86] Remove unnecessary TODO.
Craig Topper [Fri, 15 Dec 2017 20:57:18 +0000 (20:57 +0000)]
[X86] Remove unnecessary TODO.

When I wrote it I thought we were missing a potential optimization for KNL. But investigating further shows that for KNL we still do the optimal thing by widening to v4f32 and then using special isel patterns to widen again to zmm a register.

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

6 years ago[LTO] Remove unused RegularLTOState::HasModule
Vitaly Buka [Fri, 15 Dec 2017 20:50:25 +0000 (20:50 +0000)]
[LTO] Remove unused RegularLTOState::HasModule

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

6 years agoRe-commit : [LICM] Allow sinking when foldable in loop
Jun Bum Lim [Fri, 15 Dec 2017 20:33:24 +0000 (20:33 +0000)]
Re-commit : [LICM] Allow sinking when foldable in loop

This recommits r320823 reverted due to the test failure in sink-foldable.ll and
an unused variable. Added "REQUIRES: aarch64-registered-target" in the test
and removed unused variable.

Original commit message:

  Continue trying to sink an instruction if its users in the loop is foldable.
  This will allow the instruction to be folded in the loop by decoupling it from
  the user outside of the loop.

  Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

  Reviewed By: hfinkel

  Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

  Differential Revision: https://reviews.llvm.org/D37076

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

6 years agoRevert "[DWARFv5] Dump an MD5 checksum in the line-table header."
Paul Robinson [Fri, 15 Dec 2017 20:29:25 +0000 (20:29 +0000)]
Revert "[DWARFv5] Dump an MD5 checksum in the line-table header."

Unit test fails on some bots.

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

6 years ago[llvm-objcopy] Reformat everything using clang-format -i
Jake Ehrlich [Fri, 15 Dec 2017 20:17:55 +0000 (20:17 +0000)]
[llvm-objcopy] Reformat everything using clang-format -i

Overtime some non-clang formatted code has creeped into llvm-objcopy. This
patch fixes all of that.

Differential Revision: https://reviews.llvm.org/D41262

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

6 years ago[Hexagon] Fix operand-swapping PatFrag for atomic stores
Krzysztof Parzyszek [Fri, 15 Dec 2017 20:13:57 +0000 (20:13 +0000)]
[Hexagon] Fix operand-swapping PatFrag for atomic stores

PatFrag now has the atomicity information stored as bit fields. They
need to be copied to the new PatFrag.

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

6 years ago[DWARFv5] Dump an MD5 checksum in the line-table header.
Paul Robinson [Fri, 15 Dec 2017 19:52:34 +0000 (19:52 +0000)]
[DWARFv5] Dump an MD5 checksum in the line-table header.
Adds missing support for DW_FORM_data16.

Differential Revision: https://reviews.llvm.org/D41090

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

6 years ago[X86] Remove assert in X86MCCodeEmitter.cpp that was added in r320830.
Craig Topper [Fri, 15 Dec 2017 19:38:14 +0000 (19:38 +0000)]
[X86] Remove assert in X86MCCodeEmitter.cpp that was added in r320830.

It seems to be failing real code which is concerning, but we were silently getting away with it. I'll investigate further.

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

6 years ago[SelectionDAG][X86] Fix insert_vector_elt lowering for v32i1/v64i1 with non-constant...
Craig Topper [Fri, 15 Dec 2017 19:35:22 +0000 (19:35 +0000)]
[SelectionDAG][X86] Fix insert_vector_elt lowering for v32i1/v64i1 with non-constant index

Summary:
Currently we don't handle v32i1/v64i1 insert_vector_elt correctly as we fail to look at the number of elements closely and assume it can only be v16i1 or v8i1.

We also can't type legalize v64i1 insert_vector_elt correctly on KNL due to the type not being byte addressable as required by the legalizing through memory accesses path requires.

For the first issue, the patch now tries to pick a 512-bit register with the correct number of elements and promotes to that.

For the second issue, we now extend the vector to a byte addressable type, do the stores to memory, load the two halves, and then truncate the halves back to the original type. Technically since we changed the type, we may not need two loads, but actually checking that is more work and for the v64i1 case we do need them.

Reviewers: RKSimon, delena, spatel, zvi

Reviewed By: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D40942

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

6 years ago[Memcpy Loop Lowering] Insert loop BB inbetween the split BB.
Sean Fertile [Fri, 15 Dec 2017 19:29:12 +0000 (19:29 +0000)]
[Memcpy Loop Lowering] Insert loop BB inbetween the split BB.

The original memcpy expansion inserted the loop basic block inbetween
the 2 new basic blocks created by splitting the original block the memcpy
call was in. This commit makes the new memcpy expansion do the same to keep the
layout of the IR matching between the old and new implementations.

Differential Review: https://reviews.llvm.org/D41197

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

6 years ago[X86] Add 'Requires<[In64BitMode]>' to a bunch of instructions that only have memory...
Craig Topper [Fri, 15 Dec 2017 19:01:51 +0000 (19:01 +0000)]
[X86] Add 'Requires<[In64BitMode]>' to a bunch of instructions that only have memory and immediate operands.

The asm parser wasn't preventing these from being accepted in 32-bit mode. Instructions that use a GR64 register are protected by the parser rejecting the register in 32-bit mode.

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

6 years ago[X86] Change BNDLDX to use anymem instead of i64mem for itsmemory operand.
Craig Topper [Fri, 15 Dec 2017 19:01:50 +0000 (19:01 +0000)]
[X86] Change BNDLDX to use anymem instead of i64mem for itsmemory operand.

This instruction doesn't access memory. It juse use a similar looking memory encoding. Don't require Intel syntax to put "qword ptr" in front of it.

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

6 years ago[X86] Remove the 'Requires' In64BitMode/Not64BitMode from the LWP instructions.
Craig Topper [Fri, 15 Dec 2017 19:01:49 +0000 (19:01 +0000)]
[X86] Remove the 'Requires' In64BitMode/Not64BitMode from the LWP instructions.

These aren't doing anything due to a top level "let Predicates =". I think the GR32/GR64 register class protects these anyway.

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

6 years ago[X86] Remove the 'Requires<[In64BitMode]>' from SHSTK instructions.
Craig Topper [Fri, 15 Dec 2017 19:01:48 +0000 (19:01 +0000)]
[X86] Remove the 'Requires<[In64BitMode]>' from SHSTK instructions.

This has no effect due to a top level "let Predicates =" around the instructions. But its also not required because the GR64 usage in the instruction guarantees it can never match.

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

6 years ago[TargetLibraryInfo] fix documentation comment; NFC
Sanjay Patel [Fri, 15 Dec 2017 18:54:29 +0000 (18:54 +0000)]
[TargetLibraryInfo] fix documentation comment; NFC

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

6 years ago[CodeGen] fix documentation comments; NFC
Sanjay Patel [Fri, 15 Dec 2017 18:34:45 +0000 (18:34 +0000)]
[CodeGen] fix documentation comments; NFC

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

6 years ago[AArch64] Fix typo in the ASIMD instruction optimization pass
Evandro Menezes [Fri, 15 Dec 2017 18:26:54 +0000 (18:26 +0000)]
[AArch64] Fix typo in the ASIMD instruction optimization pass

Fix typo in the representative instruction replacement.

Also, fix formatting and reword some comments.

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

6 years agofix typo in comment and remove inaccurate comment; NFC
Sanjay Patel [Fri, 15 Dec 2017 18:25:13 +0000 (18:25 +0000)]
fix typo in comment and remove inaccurate comment; NFC

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

6 years agoFix for bug PR35549 - Repeated schedule comments.
Andrew V. Tischenko [Fri, 15 Dec 2017 18:13:05 +0000 (18:13 +0000)]
Fix for bug PR35549 - Repeated schedule comments.
Differential Revision: https://reviews.llvm.org/D40960

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

6 years agoRevert "Re-commit : [LICM] Allow sinking when foldable in loop"
Jun Bum Lim [Fri, 15 Dec 2017 18:12:49 +0000 (18:12 +0000)]
Revert "Re-commit : [LICM] Allow sinking when foldable in loop"

This reverts commit r320833.

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

6 years ago[CodeGen] fix documentation comments; NFC
Sanjay Patel [Fri, 15 Dec 2017 18:09:33 +0000 (18:09 +0000)]
[CodeGen] fix documentation comments; NFC

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

6 years agoRe-commit : [LICM] Allow sinking when foldable in loop
Jun Bum Lim [Fri, 15 Dec 2017 17:58:59 +0000 (17:58 +0000)]
Re-commit : [LICM] Allow sinking when foldable in loop

 This recommit r320823 after fixing a test failure.

 Original commit message:

    Continue trying to sink an instruction if its users in the loop is foldable.
    This will allow the instruction to be folded in the loop by decoupling it from
    the user outside of the loop.

    Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

    Reviewed By: hfinkel

    Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

    Differential Revision: https://reviews.llvm.org/D37076

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

6 years agoUpdated llvm-objdump to display local relocations in Mach-O binaries
Michael Trent [Fri, 15 Dec 2017 17:57:40 +0000 (17:57 +0000)]
Updated llvm-objdump to display local relocations in Mach-O binaries

Summary:
llvm-objdump's Mach-O parser was updated in r306037 to display external
relocations for MH_KEXT_BUNDLE file types. This change extends the Macho-O
parser to display local relocations for MH_PRELOAD files. When used with
the -macho option relocations will be displayed in a historical format.

All tests are passing for llvm, clang, and lld. llvm-objdump builds without
compiler warnings.

rdar://35778019

Reviewers: enderby

Reviewed By: enderby

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D41199

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

6 years ago[X86] Fix XSAVE64 and similar instructions to not be allowed by the assembler in...
Craig Topper [Fri, 15 Dec 2017 17:22:58 +0000 (17:22 +0000)]
[X86] Fix XSAVE64 and similar instructions to not be allowed by the assembler in 32-bit mode.

There was a top level "let Predicates =" in the .td file that was overriding the Requires on each instruction.

I've added an assert to the code emitter to catch more cases like this. I'm sure this isn't the only place where the right predicates aren't being applied. This assert already found that we don't block btq/btsq/btrq in 32-bit mode.

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

6 years agoRevert "[LICM] Allow sinking when foldable in loop"
Jun Bum Lim [Fri, 15 Dec 2017 16:35:09 +0000 (16:35 +0000)]
Revert "[LICM] Allow sinking when foldable in loop"

This reverts commit r320823.

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

6 years ago[CodeGen] Print stack object references as %(fixed-)stack.0 in both MIR and debug...
Francis Visoiu Mistrih [Fri, 15 Dec 2017 16:33:45 +0000 (16:33 +0000)]
[CodeGen] Print stack object references as %(fixed-)stack.0 in both MIR and debug output

Work towards the unification of MIR and debug output by printing
`%stack.0` instead of `<fi#0>`, and `%fixed-stack.0` instead of
`<fi#-4>` (supposing there are 4 fixed stack objects).

Only debug syntax is affected.

Differential Revision: https://reviews.llvm.org/D41027

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

6 years ago[ThinLTO] Disallow multiple prevailing defs
Eugene Leviant [Fri, 15 Dec 2017 16:27:33 +0000 (16:27 +0000)]
[ThinLTO] Disallow multiple prevailing defs

https://reviews.llvm.org/D41291

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

6 years ago[X86] Widen (v2i32 (fp_to_uint v2f64)) to (v8i32 (fp_to_uint v8f64)) during legalizat...
Craig Topper [Fri, 15 Dec 2017 16:22:20 +0000 (16:22 +0000)]
[X86] Widen (v2i32 (fp_to_uint v2f64)) to (v8i32 (fp_to_uint v8f64)) during legalization if we have AVX512F, but not VLX. NFC

Previously we widened it using isel patterns.

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

6 years ago[LICM] Allow sinking when foldable in loop
Jun Bum Lim [Fri, 15 Dec 2017 16:09:54 +0000 (16:09 +0000)]
[LICM] Allow sinking when foldable in loop

Summary:
Continue trying to sink an instruction if its users in the loop is foldable.
This will allow the instruction to be folded in the loop by decoupling it from
the user outside of the loop.

Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

Reviewed By: hfinkel

Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D37076

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

6 years ago[ARM] Some DAG combine tests
Sam Parker [Fri, 15 Dec 2017 15:30:39 +0000 (15:30 +0000)]
[ARM] Some DAG combine tests

Add some more and and shift load combine tests.

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

6 years ago[MIR] Add support for missing CFI directives
Francis Visoiu Mistrih [Fri, 15 Dec 2017 15:17:18 +0000 (15:17 +0000)]
[MIR] Add support for missing CFI directives

The following CFI directives are suported by MC but not by MIR:

* .cfi_rel_offset
* .cfi_adjust_cfa_offset
* .cfi_escape
* .cfi_remember_state
* .cfi_restore_state
* .cfi_undefined
* .cfi_register
* .cfi_window_save

Add support for printing, parsing and update tests.

Differential Revision: https://reviews.llvm.org/D41230

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

6 years ago[X86] Add RTM schedule tests
Simon Pilgrim [Fri, 15 Dec 2017 14:37:28 +0000 (14:37 +0000)]
[X86] Add RTM schedule tests

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

6 years ago[InlineCost] Find repeated loads in the callee
Haicheng Wu [Fri, 15 Dec 2017 14:34:41 +0000 (14:34 +0000)]
[InlineCost] Find repeated loads in the callee

SROA analysis of InlineCost can figure out that some stores can be removed
after inlining and then the repeated loads clobbered by these stores are also
free.  This patch finds these clobbered loads and adjust the inline cost
accordingly.

Differential Revision: https://reviews.llvm.org/D33946

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

6 years ago[X86] Add MWAITX/MONITORX schedule tests
Simon Pilgrim [Fri, 15 Dec 2017 14:22:15 +0000 (14:22 +0000)]
[X86] Add MWAITX/MONITORX schedule tests

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

6 years agoFix the second build bot break introduced by r320791.
Nemanja Ivanovic [Fri, 15 Dec 2017 14:17:45 +0000 (14:17 +0000)]
Fix the second build bot break introduced by r320791.

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

6 years ago[X86] Add XOP schedule tests
Simon Pilgrim [Fri, 15 Dec 2017 14:02:35 +0000 (14:02 +0000)]
[X86] Add XOP schedule tests

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

6 years agoFix code causing fallthrough warnings in the PPC back end.
Nemanja Ivanovic [Fri, 15 Dec 2017 11:47:48 +0000 (11:47 +0000)]
Fix code causing fallthrough warnings in the PPC back end.

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

6 years ago[X86] Add AVX512 VPOPCNTDQ schedule tests
Simon Pilgrim [Fri, 15 Dec 2017 11:32:31 +0000 (11:32 +0000)]
[X86] Add AVX512 VPOPCNTDQ schedule tests

Demonstrates how to perform full coverage avx512 schedule tests

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

6 years ago[RISCV] Change shift amount operand of RVC shift instructions to uimmlog2xlennonzero
Alex Bradbury [Fri, 15 Dec 2017 10:20:51 +0000 (10:20 +0000)]
[RISCV] Change shift amount operand of RVC shift instructions to uimmlog2xlennonzero

c.slli/c.srli/c.srai allow a 5-bit shift in RV32C and a 6-bit shift in RV64C.
This patch adds uimmlog2xlennonzero to reflect this constraint as well as
tests.

Differential Revision: https://reviews.llvm.org/D41216

Patch by Shiva Chen.

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

6 years agoFix the build bot break introduced by r320791.
Nemanja Ivanovic [Fri, 15 Dec 2017 09:51:34 +0000 (09:51 +0000)]
Fix the build bot break introduced by r320791.

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

6 years ago[RISCV] Enable emission of alias instructions by default
Alex Bradbury [Fri, 15 Dec 2017 09:47:01 +0000 (09:47 +0000)]
[RISCV] Enable emission of alias instructions by default

This patch switches the default for -riscv-no-aliases to false
and updates all affected MC and CodeGen tests. As recommended in
D41071, MC tests use the canonical instructions and the CodeGen
tests use the aliases.

Additionally, for the f and d instructions with rounding mode,
the tests for the aliased versions are moved and tightened such
that they can actually detect if alias emission is enabled.
(see D40902 for context)

Differential Revision: https://reviews.llvm.org/D41225

Patch by Mario Werner.

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

6 years ago[PM] port Rewrite Statepoints For GC to the new pass manager.
Fedor Sergeev [Fri, 15 Dec 2017 09:32:11 +0000 (09:32 +0000)]
[PM] port Rewrite Statepoints For GC to the new pass manager.

Summary:
The port is nearly straightforward.
The only complication is related to the analyses handling,
since one of the analyses used in this module pass is domtree,
which is a function analysis. That requires asking for the results
of each function and disallows a single interface for run-on-module
pass action.

Decided to copy-paste the main body of this pass.
Most of its code is requesting analyses anyway, so not that much
of a copy-paste.

The rest of the code movement is to transform all the implementation
helper functions like stripNonValidData into non-member statics.

Extended all the related LLVM tests with new-pass-manager use.
No failures.

Reviewers: sanjoy, anna, reames

Reviewed By: anna

Subscribers: skatkov, llvm-commits

Differential Revision: https://reviews.llvm.org/D41162

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

6 years ago[ARM] Add tests for D34515
Roger Ferrer Ibanez [Fri, 15 Dec 2017 09:24:46 +0000 (09:24 +0000)]
[ARM] Add tests for D34515

This is NFC and a preparatory step for D34515.

Differential Revision: https://reviews.llvm.org/D41122

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

6 years ago[LLVMgold] Don't set undefined symbol as prevailing
Eugene Leviant [Fri, 15 Dec 2017 09:18:21 +0000 (09:18 +0000)]
[LLVMgold] Don't set undefined symbol as prevailing

Differential revision: https://reviews.llvm.org/D41113

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

6 years ago[PowerPC] Convert r+r instructions to r+i (pre and post RA)
Nemanja Ivanovic [Fri, 15 Dec 2017 07:27:53 +0000 (07:27 +0000)]
[PowerPC] Convert r+r instructions to r+i (pre and post RA)

This patch adds the necessary infrastructure to convert instructions that
take two register operands to those that take a register and immediate if
the necessary operand is produced by a load-immediate. Furthermore, it uses
this infrastructure to perform such conversions twice - first at MachineSSA
and then pre-emit.

There are a number of reasons we may end up with opportunities for this
transformation, including but not limited to:
- X-Form instructions chosen since the exact offset isn't available at ISEL time
- Atomic instructions with constant operands (we will add patterns for this
  in the future)
- Tail duplication may duplicate code where one block contains this redundancy
- When emitting compare-free code in PPCDAGToDAGISel, we don't handle constant
  comparands specially

Furthermore, this patch moves the initialization of PPCMIPeepholePass so that
it can be used for MIR tests.

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

6 years ago[X86] Fix a couple bugs in my recent changes to vXi1 insert_subvector lowering.
Craig Topper [Fri, 15 Dec 2017 07:16:41 +0000 (07:16 +0000)]
[X86] Fix a couple bugs in my recent changes to vXi1 insert_subvector lowering.

A couple places didn't use the same SDValue variables to connect everything all the way through.

I don't have a test case for a bug in insert into the lower bits of a non-zero, non-undef vector. Not sure the best way to create that. We don't create the case when lowering concat_vectors which is the main way to get insert_subvectors.

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

6 years ago[SCEV] Fix the movement of insertion point in expander. PR35406.
Serguei Katkov [Fri, 15 Dec 2017 05:24:42 +0000 (05:24 +0000)]
[SCEV] Fix the movement of insertion point in expander. PR35406.

We cannot move the insertion point to header if SCEV contains div/rem
operations due to they may go over check for zero denominator.

Reviewers: sanjoy, mkazantsev, sebpop
Reviewed By: sebpop
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41229

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

6 years agoRecommit CodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value
Yaxun Liu [Fri, 15 Dec 2017 03:56:57 +0000 (03:56 +0000)]
Recommit CodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value

The regression on ppc64 was not due to this commit.

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

6 years agoDisabling r312514 as it causes miscompiles that show up on bootstrap
Nemanja Ivanovic [Fri, 15 Dec 2017 01:38:03 +0000 (01:38 +0000)]
Disabling r312514 as it causes miscompiles that show up on bootstrap

The compare elimination peephole introduced in https://reviews.llvm.org/rL312514
causes a miscompile in AMDGPUInstrInfo.cpp which in turn causes some AMDGPU
test case failures in stage2 bootstrap testing. This miscompile didn't cause any
test case failures until https://reviews.llvm.org/rL320614, so it appeared as if
that patch caused these failures.
Disabling this transformation for now to bring the build bots back to green and
the author of the patch will investigate the miscompile.

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

6 years ago[cmake] Fix clang-cl cross-compilation on macOS
Shoaib Meenai [Fri, 15 Dec 2017 01:05:48 +0000 (01:05 +0000)]
[cmake] Fix clang-cl cross-compilation on macOS

macOS paths usually start with /Users, which clang-cl interprets as a
macro undefine, leading to pretty much everything failing to compile.

CMake should be taught to put a -- in its compilation rules for clang-cl
(and I've been meaning to submit that upstream for a while). In the
meantime, however, and to support older CMake versions, we can just
create a custom make rules override to fix the compilation rules.

Differential Revision: https://reviews.llvm.org/D41219

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

6 years ago[X86] Add a TODO about v8i1 CONCAT_VECTORS.
Craig Topper [Fri, 15 Dec 2017 01:03:46 +0000 (01:03 +0000)]
[X86] Add a TODO about v8i1 CONCAT_VECTORS.

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

6 years ago[SelectionDAG] Make getNode calls that take an ArrayRef of SDValue for operands call...
Craig Topper [Fri, 15 Dec 2017 01:03:45 +0000 (01:03 +0000)]
[SelectionDAG] Make getNode calls that take an ArrayRef of SDValue for operands call NewSDValueDbgMsg.

This makes it work better with some build_vector and concat_vectors creations.

Adjust the NewSDValueDbgMsg in getConstant to avoid duplicating the print when it calls getSplatBuildVector since getSplatBuildVector didn't trigger a print before.

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

6 years ago[X86] Further rearrange the setOperationAction calls to separate the ones that requir...
Craig Topper [Fri, 15 Dec 2017 01:03:43 +0000 (01:03 +0000)]
[X86] Further rearrange the setOperationAction calls to separate the ones that require 512-bit registers OR VLX into separate sections. NFCI

We have several instructions that were introduced in AVX512F that are only available in 512-bit form on KNL. We still make use of them for 128/256 by artificially widening and extracting during isel.

This commit separates these operations from the true 512-bit operations. This way we can qualify the normal 512-bit operations with needing 512-bit register support. And these special operations will get qualified with needing 512-bit registers OR VLX.

The 512-bit register qualification will be introduced in a future patch this just gets everything grouped to minimize deltas on that patch.

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

6 years ago[X86] Group setOperationActions related to vXi1 masks together. NFCI
Craig Topper [Fri, 15 Dec 2017 01:03:42 +0000 (01:03 +0000)]
[X86] Group setOperationActions related to vXi1 masks together. NFCI

Previously they were sort of interleaved in with XMM/YMM/ZMM action related code.

Trying to separate things so its easier to split 512-bit vectors later.

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

6 years ago[X86] Make ISD::INSERT_SUBVECTOR v8i1 legal with AVX512F because we should be custom...
Craig Topper [Fri, 15 Dec 2017 01:03:40 +0000 (01:03 +0000)]
[X86] Make ISD::INSERT_SUBVECTOR v8i1 legal with AVX512F because we should be custom lowering inserting v1i1 into v8i1 under this.

I don't have a test case at the moment. Just noticed while auditing things.

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

6 years ago[X86] Move some of the hasVLX qualified code out of the main hasAVX512 block in the...
Craig Topper [Fri, 15 Dec 2017 01:03:38 +0000 (01:03 +0000)]
[X86] Move some of the hasVLX qualified code out of the main hasAVX512 block in the X86ISelLowering constructor. NFCI

Move it into the separate hasVLX block later in the constructor.

I'm trying to separate 128/256 and 512-bit related code so we can eventually qualify the hasAVX512 block with support for 512-bit vectors required by the prefer-vector-width feature support being talked about in D41096.

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

6 years agoFastISel: support no-PLT PIC calls on ELF x86_64
Saleem Abdulrasool [Fri, 15 Dec 2017 00:32:09 +0000 (00:32 +0000)]
FastISel: support no-PLT PIC calls on ELF x86_64

Add support for properly handling PIC code with no-PLT.  This equates to
`-fpic -fno-plt -O0` with the clang frontend.  External functions are
marked with nonlazybind, which must then be indirected through the GOT.
This allows code to be built without optimizations in PIC mode without
going through the PLT.  Addresses PR35653!

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

6 years agoDon't crash in llvm-pdbutil when dumping TypeIndexes with high bit set.
Zachary Turner [Fri, 15 Dec 2017 00:27:49 +0000 (00:27 +0000)]
Don't crash in llvm-pdbutil when dumping TypeIndexes with high bit set.

This is a special code that indicates that it's a function id.
While I'm still not certain how to interpret these, we definitely
should *not* be using these values as indices into an array directly.
For now, when we encounter one of these, just print the numeric value.

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

6 years ago[WebAssembly] Implement @llvm.global_ctors and @llvm.global_dtors
Sam Clegg [Fri, 15 Dec 2017 00:17:10 +0000 (00:17 +0000)]
[WebAssembly] Implement @llvm.global_ctors and @llvm.global_dtors

Summary:
- lowers @llvm.global_dtors by adding @llvm.global_ctors
  functions which register the destructors with `__cxa_atexit`.
- impements @llvm.global_ctors with wasm start functions and linker metadata

See [here](https://github.com/WebAssembly/tool-conventions/issues/25) for more background.

Subscribers: jfb, dschuff, mgorny, jgravelle-google, aheejin, sunfish

Differential Revision: https://reviews.llvm.org/D41211

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

6 years ago[debuginfo] Remove obsolete test_debuginfo.pl that was moved to debuginfo-tests.
Don Hinton [Fri, 15 Dec 2017 00:06:26 +0000 (00:06 +0000)]
[debuginfo] Remove obsolete test_debuginfo.pl that was moved to debuginfo-tests.

Summary:
Now that r320495, "[debuginfo-tests] Support moving
debuginfo-tests to llvm/projects," has landed, which includes a local
copy of test_debuginfo.pl, remove the obsolete copy.

Reviewers: zturner, aprantl

Reviewed By: aprantl

Subscribers: llvm-commits, JDevlieghere

Differential Revision: https://reviews.llvm.org/D41260

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

6 years agoRemove a non-modular header (& inline it into its one use)
David Blaikie [Thu, 14 Dec 2017 23:45:58 +0000 (23:45 +0000)]
Remove a non-modular header (& inline it into its one use)

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

6 years ago[TableGen][GlobalISel] Add a common class for all PredicateMatcher
Quentin Colombet [Thu, 14 Dec 2017 23:44:07 +0000 (23:44 +0000)]
[TableGen][GlobalISel] Add a common class for all PredicateMatcher

NFC.

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

6 years ago[ProfileData] Use a different data structure to save memory.
George Burgess IV [Thu, 14 Dec 2017 23:32:57 +0000 (23:32 +0000)]
[ProfileData] Use a different data structure to save memory.

This change swaps FunctionSamples to a std::map. This saves us around
17% of the memory required to parse sample profiles. To put hard numbers
on this, clang now eats around 1.3GB of RAM instead of 1.6GB while
parsing a 50MB profile.

The CPU time taken by a large profile merge (3.1GB of data across 226
files) is also reduced by ~11% by this patch (1:09.08 vs 1:01.11).

This was split out at the request of reviewers in D41152.

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

6 years ago[Unit][AArch64] Additional tests for target parsing
Evandro Menezes [Thu, 14 Dec 2017 23:13:04 +0000 (23:13 +0000)]
[Unit][AArch64] Additional tests for target parsing

Add Exynos M2/M3 to extension check.

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

6 years ago[AArch64] Test patch
Evandro Menezes [Thu, 14 Dec 2017 23:06:18 +0000 (23:06 +0000)]
[AArch64] Test patch

Fix formatting by adding a missing blank line to test new network setup.

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

6 years agoEmitFuncArgumentDbgValue: Prefer stack slots over registers for stack arguments
Adrian Prantl [Thu, 14 Dec 2017 22:55:06 +0000 (22:55 +0000)]
EmitFuncArgumentDbgValue: Prefer stack slots over registers for stack arguments

While investigating LLVM PR22316 (http://llvm.org/bugs/show_bug.cgi?id=22316)
I started wondering if it were not always preferable to emit the
initial DBG_VALUEs for stack arguments as FI locations instead of
describing the first register they get copied into. The advantage of
doing this is that the arguments will be available as soon as the
stack is setup. As illustrated by the testcase in the PR, the first
copy of the FI into a register may be sunk by MachineSink.cpp into a
later basic block. By describing the argument on the stack, we nicely
circumvent this problem.

<rdar://problem/19583723>

Differential Revision: https://reviews.llvm.org/D41135

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

6 years ago[X86] Remove an unnecessary SmallVector that was collecting chains for two SDNode...
Craig Topper [Thu, 14 Dec 2017 22:50:10 +0000 (22:50 +0000)]
[X86] Remove an unnecessary SmallVector that was collecting chains for two SDNode's we're still holding SDValues for. NFCI

We can just get the chains from those SDValues to create the TokenFactor.

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

6 years agoTLI: Allow using PSV for intrinsic mem operands
Matt Arsenault [Thu, 14 Dec 2017 22:34:10 +0000 (22:34 +0000)]
TLI: Allow using PSV for intrinsic mem operands

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

6 years agoFix many -Wsign-compare and -Wtautological-constant-compare warnings.
Zachary Turner [Thu, 14 Dec 2017 22:07:03 +0000 (22:07 +0000)]
Fix many -Wsign-compare and -Wtautological-constant-compare warnings.

Most of the -Wsign-compare warnings are due to the fact that
enums are signed by default in the MS ABI, while the
tautological comparison warnings trigger on x86 builds where
sizeof(size_t) is 4 bytes, so N > numeric_limits<unsigned>::max()
is always false.

Differential Revision: https://reviews.llvm.org/D41256

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

6 years ago[SimplifyCFG] don't sink common insts too soon (PR34603)
Sanjay Patel [Thu, 14 Dec 2017 22:05:20 +0000 (22:05 +0000)]
[SimplifyCFG] don't sink common insts too soon (PR34603)

This should solve:
https://bugs.llvm.org/show_bug.cgi?id=34603
...by preventing SimplifyCFG from altering redundant instructions before early-cse has a chance to run.
It changes the default (canonical-forming) behavior of SimplifyCFG, so we're only doing the
sinking transform later in the optimization pipeline.

Differential Revision: https://reviews.llvm.org/D38566

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

6 years agoDAG: Expose all MMO flags in getTgtMemIntrinsic
Matt Arsenault [Thu, 14 Dec 2017 21:39:51 +0000 (21:39 +0000)]
DAG: Expose all MMO flags in getTgtMemIntrinsic

Rather than adding more bits to express every
MMO flag you could want, just directly use the
MMO flags. Also fixes using a bunch of bool arguments to
getMemIntrinsicNode.

On AMDGPU, buffer and image intrinsics should always
have MODereferencable set, but currently there is no
way to do that directly during the initial intrinsic
lowering.

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

6 years ago[Hexagon] Generate HVX code for comparisons and selects
Krzysztof Parzyszek [Thu, 14 Dec 2017 21:28:48 +0000 (21:28 +0000)]
[Hexagon] Generate HVX code for comparisons and selects

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

6 years ago[WebAssembly] Add support for init functions linking metadata
Sam Clegg [Thu, 14 Dec 2017 21:10:03 +0000 (21:10 +0000)]
[WebAssembly] Add support for init functions linking metadata

Summary:
This change lays the groundwork lowering of @llvm.global_ctors
and @llvm.global_dtors for the wasm object format.  Some parts
of this patch are subset of: https://reviews.llvm.org/D40759

See https://github.com/WebAssembly/tool-conventions/issues/25

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish

Differential Revision: https://reviews.llvm.org/D41208

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

6 years agoRevert "Fix isPodLike for MSVC and use it in TypeHashing."
Zachary Turner [Thu, 14 Dec 2017 19:59:10 +0000 (19:59 +0000)]
Revert "Fix isPodLike for MSVC and use it in TypeHashing."

This reverts commit ac5edc198eb612f82293850c3488042708b1c5fa.

Apparently this doesn't cover all the bases, so some compilers
and standard libraries still think this is not trivially copyable
even though it is.  Reverting this back to an MSVC-only check for
now so that at least we have some coverage.

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

6 years agoFix isPodLike for MSVC and use it in TypeHashing.
Zachary Turner [Thu, 14 Dec 2017 19:41:28 +0000 (19:41 +0000)]
Fix isPodLike for MSVC and use it in TypeHashing.

This should be a better check than using is_trivially_copyable
behind an #ifdef _MSC_VER.

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

6 years ago[SLPVectorizer] Don't ignore scalar extraction instructions of aggregate value
Guozhi Wei [Thu, 14 Dec 2017 19:35:43 +0000 (19:35 +0000)]
[SLPVectorizer] Don't ignore scalar extraction instructions of aggregate value

In SLPVectorizer, the vector build instructions (insertvalue for aggregate type) is passed to BoUpSLP.buildTree, it is treated as UserIgnoreList, so later in cost estimation, the cost of these instructions are not counted.
For aggregate value, later usage are more likely to be done in scalar registers, either used as individual scalars or used as a whole for function call or return value. Ignore scalar extraction instructions may cause too aggressive vectorization for aggregate values, and slow down performance. So for vectorization of aggregate value, the scalar extraction instructions are required in cost estimation.

Differential Revision: https://reviews.llvm.org/D41139

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

6 years agoOnly use is_trivially_copyable if we know it's safe to do so.
Zachary Turner [Thu, 14 Dec 2017 19:11:28 +0000 (19:11 +0000)]
Only use is_trivially_copyable if we know it's safe to do so.

Apparently this isn't present on older versions of libstdc++, so
it causes some builds to fail.

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

6 years agoAdd MVT::v128i1, NFC
Krzysztof Parzyszek [Thu, 14 Dec 2017 19:05:21 +0000 (19:05 +0000)]
Add MVT::v128i1, NFC

Hexagon HVX has type v128i8, comparing two vectors of that type will
produce v128i1 types in SelectionDAG.

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

6 years ago[opt-viewer] Render utf-8 characters properly in the generated HTML
Adam Nemet [Thu, 14 Dec 2017 18:55:33 +0000 (18:55 +0000)]
[opt-viewer] Render utf-8 characters properly in the generated HTML

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

6 years ago[MC] Allow .file directives to be out-of-order
Paul Robinson [Thu, 14 Dec 2017 18:46:43 +0000 (18:46 +0000)]
[MC] Allow .file directives to be out-of-order

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