OSDN Git Service

android-x86/external-llvm.git
5 years ago[AArch64] Add new target feature to fuse arithmetic and logic operations
Evandro Menezes [Mon, 14 Jan 2019 23:54:36 +0000 (23:54 +0000)]
[AArch64] Add new target feature to fuse arithmetic and logic operations

This feature enables the fusion of some arithmetic and logic instructions
together.

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

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

5 years ago[ORC] Move ORC Core symbol map and set types into their own header: CoreTypes.h.
Lang Hames [Mon, 14 Jan 2019 23:49:13 +0000 (23:49 +0000)]
[ORC] Move ORC Core symbol map and set types into their own header: CoreTypes.h.

This will allow other utilities (including a future RuntimeDyld replacement) to
use these types without pulling in the major Core types (JITDylib, etc.).

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

5 years ago[X86] Fix unused variable warning in Release builds. NFC.
Benjamin Kramer [Mon, 14 Jan 2019 23:29:54 +0000 (23:29 +0000)]
[X86] Fix unused variable warning in Release builds. NFC.

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

5 years agoUpdate GettingStarted guide to recommend that people use the new
James Y Knight [Mon, 14 Jan 2019 22:27:32 +0000 (22:27 +0000)]
Update GettingStarted guide to recommend that people use the new
official Git repository.

Remove the directions for using git-svn, and demote the prominence of
the svn instructions.

Also, fix a few other issues while I'm in there:

* Mention LLVM_ENABLE_PROJECTS more.
* Getting started doesn't need to mention test-suite, but should
  mention clang and the other projects.
* Remove mentions of "configure", since that's long gone.

I've also adjusted a few other mentions of svn to point to github, but
have not done so comprehensively.

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

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

5 years agoRevert "[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors"
Nikita Popov [Mon, 14 Jan 2019 22:18:39 +0000 (22:18 +0000)]
Revert "[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors"

This reverts commit r351125.

I missed test changes in an SLPVectorizer test, due to the cost model
changes. Reverting for now.

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

5 years ago[Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from
Lang Hames [Mon, 14 Jan 2019 22:05:12 +0000 (22:05 +0000)]
[Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from
MachOObjectFile::getSymbolByIndex.

ObjectFile derivatives should prefer symbol_iterator/SymbolRef over
basic_symbol_iterator/BasicSymbolRef where possible, as the former
retain their link to the ObjectFile (rather than a SymbolicFile) and provide
more functionality.

No test for this: Existing code is working, and we don't have (m)any libObject
unit tests. I'll think about how we can test more systematically going forward.

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

5 years ago[WebAssembly][FastISel] Do not assume naive CmpInst lowering
Thomas Lively [Mon, 14 Jan 2019 22:03:43 +0000 (22:03 +0000)]
[WebAssembly][FastISel] Do not assume naive CmpInst lowering

Summary:
Fixes https://bugs.llvm.org/show_bug.cgi?id=40172. See
test/CodeGen/WebAssembly/PR40172.ll for an explanation.

Reviewers: dschuff, aheejin

Subscribers: nikic, llvm-commits, sunfish, jgravelle-google, sbc100

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

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

5 years ago[llvm-ar] Temporarily remove failing test which is breaking buildbots
Jordan Rupprecht [Mon, 14 Jan 2019 21:58:15 +0000 (21:58 +0000)]
[llvm-ar] Temporarily remove failing test which is breaking buildbots

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

5 years ago[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors
Nikita Popov [Mon, 14 Jan 2019 21:43:30 +0000 (21:43 +0000)]
[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors

Related to https://bugs.llvm.org/show_bug.cgi?id=40123.

Rather than scalarizing, expand a vector USUBSAT into UMAX+SUB,
which produces much better code for X86.

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

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

5 years ago[opaque pointer types] Update GetElementPtr creation APIs to
James Y Knight [Mon, 14 Jan 2019 21:39:35 +0000 (21:39 +0000)]
[opaque pointer types] Update GetElementPtr creation APIs to
consistently accept a pointee-type argument.

Note: this also adds a new C API and soft-deprecates the old C API.

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

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

5 years ago[opaque pointer types] Update LoadInst creation APIs to consistently
James Y Knight [Mon, 14 Jan 2019 21:37:53 +0000 (21:37 +0000)]
[opaque pointer types] Update LoadInst creation APIs to consistently
accept a return-type argument.

Note: this also adds a new C API and soft-deprecates the old C API.

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

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

5 years ago[opaque pointer types] Update InvokeInst creation APIs to consistently
James Y Knight [Mon, 14 Jan 2019 21:37:48 +0000 (21:37 +0000)]
[opaque pointer types] Update InvokeInst creation APIs to consistently
accept a callee-type argument.

Note: this also adds a new C API and soft-deprecates the old C API.

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

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

5 years ago[opaque pointer types] Update CallInst creation APIs to consistently
James Y Knight [Mon, 14 Jan 2019 21:37:42 +0000 (21:37 +0000)]
[opaque pointer types] Update CallInst creation APIs to consistently
accept a callee-type argument.

Note: this also adds a new C API and soft-deprecates the old C API.

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

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

5 years ago[llvm-ar] Flatten thin archives.
Jordan Rupprecht [Mon, 14 Jan 2019 21:11:46 +0000 (21:11 +0000)]
[llvm-ar] Flatten thin archives.

Summary:
Normal behavior for GNU ar is to flatten thin archives when adding them to another thin archive, i.e. add the members directly instead of nesting the archive.

Some refactoring done as part of this patch to ease things:
 - Consolidate `addMember`/`addLibMember` methods
 - Rename `addMember` to `addChildMember` to make it more visibly different at the call site that an archive child is passed instead of a regular member
 - Pass in a separate vector and splice it back into position instead of passing a vector + optional Pos (which makes expanding libs tricky)

This fixes PR37530 as raised by https://github.com/ClangBuiltLinux/linux/issues/279.

Reviewers: mstorsjo, pcc, ruiu

Reviewed By: mstorsjo

Subscribers: llvm-commits, tpimh, nickdesaulniers

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

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

5 years ago[SanitizerCoverage][NFC] Use appendToUsed instead of include
Jonathan Metzman [Mon, 14 Jan 2019 21:02:02 +0000 (21:02 +0000)]
[SanitizerCoverage][NFC] Use appendToUsed instead of include

Summary:
Use appendToUsed instead of include to ensure that
SanitizerCoverage's constructors are not stripped.

Also, use isOSBinFormatCOFF() to determine if target
binary format is COFF.

Reviewers: pcc

Reviewed By: pcc

Subscribers: hiraditya

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

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

5 years ago[lit] llvm-lit.in: specify file encoding to UTF-8
George Karpenkov [Mon, 14 Jan 2019 20:02:11 +0000 (20:02 +0000)]
[lit] llvm-lit.in: specify file encoding to UTF-8

This is needed because otherwise if source dir is at location whose path
contains non-ASCII character then python will complain about
SyntaxError.

SyntaxError: Non-ASCII character '\xc4' in file
/home/D?vis/libc++/src/build/bin/llvm-lit on line 16, but no encoding
declared; see http://python.org/dev/peps/pep-0263/ for details

Patch by davispuh

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

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

5 years ago[X86] Silence a -Wparentheses warning on gcc. NFC
Craig Topper [Mon, 14 Jan 2019 19:44:02 +0000 (19:44 +0000)]
[X86] Silence a -Wparentheses warning on gcc. NFC

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

5 years agoexpand DIContext interface a bit
David Callahan [Mon, 14 Jan 2019 19:11:32 +0000 (19:11 +0000)]
expand DIContext interface a bit

Summary:
This allows a bit more control for scenarios where client might
modifiy a DIContext

Reviewers: twoh, Kader, modocache

Reviewed By: Kader

Subscribers: llvm-commits

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

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

5 years ago[llvm][IRBuilder] Introspection for CreateAlignmentAssumption*() functions
Roman Lebedev [Mon, 14 Jan 2019 19:09:15 +0000 (19:09 +0000)]
[llvm][IRBuilder] Introspection for CreateAlignmentAssumption*() functions

Summary:
Clang calls these functions to produce IR for assume-aligned attributes.
I would like to teach UBSAN to verify these assumptions.
For that, i need to access the final pointer on which the check is performed,
and the actual `icmp` that does the check.

The alternative to this would be to fully re-implement this in clang.

Reviewers: spatel, dneilson, craig.topper, dblaikie, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, llvm-commits

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

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

5 years ago[X86][SSSE3] Bailout of lowerVectorShuffleAsPermuteAndUnpack for shuffle-with-zero...
Simon Pilgrim [Mon, 14 Jan 2019 19:07:26 +0000 (19:07 +0000)]
[X86][SSSE3] Bailout of lowerVectorShuffleAsPermuteAndUnpack for shuffle-with-zero (PR40306)

If we have PSHUFB and we're shuffling with a zero vector, then we are better off not doing VECTOR_SHUFFLE(UNPCK()) as we lose track of those zero elements.

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

5 years agoIgnore PhiNodes when mapping sample profile data
David Callahan [Mon, 14 Jan 2019 19:05:59 +0000 (19:05 +0000)]
Ignore PhiNodes when mapping sample profile data

Summary: Like branch instructions, phi nodes frequently do not have debug information related to the block they are in and so they should be ignored.

Reviewers: danielcdh, twoh, Kader, wmi

Reviewed By: wmi

Subscribers: aprantl, llvm-commits

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

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

5 years ago[llvm-objcopy] [COFF] Remove unreferenced undefined externals with --strip-unneeded.
Martin Storsjo [Mon, 14 Jan 2019 18:56:47 +0000 (18:56 +0000)]
[llvm-objcopy] [COFF] Remove unreferenced undefined externals with --strip-unneeded.

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

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

5 years ago[llvm-objcopy] [COFF] Test absolute symbols wrt --strip-unneeded and --discard-all...
Martin Storsjo [Mon, 14 Jan 2019 18:56:27 +0000 (18:56 +0000)]
[llvm-objcopy] [COFF] Test absolute symbols wrt --strip-unneeded and --discard-all. NFC.

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

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

5 years agoRevert "Merge branch 'arcpatch-D55094'"
David Callahan [Mon, 14 Jan 2019 18:49:27 +0000 (18:49 +0000)]
Revert "Merge branch 'arcpatch-D55094'"

This reverts commit a9788dd6587d67c856df74eedff5a6ad34ce8320, reversing
changes made to f1309ffebf718d16aec4fab83380556c660e2825.

unintended merge pushed

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

5 years ago[MC][X86] Add test case for invalid use of "(%dx)" operand.
Nirav Dave [Mon, 14 Jan 2019 18:44:32 +0000 (18:44 +0000)]
[MC][X86] Add test case for invalid use of "(%dx)" operand.

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

5 years ago[x86] lower extracted add/sub to horizontal vector math
Sanjay Patel [Mon, 14 Jan 2019 18:44:02 +0000 (18:44 +0000)]
[x86] lower extracted add/sub to horizontal vector math

add (extractelt (X, 0), extractelt (X, 1)) --> extractelt (hadd X, X), 0

This is the integer sibling to D56011.

There's an additional restriction to only to do this transform in the
case where we don't have extra extracts from the source vector. Without
that, we can fail to match larger horizontal patterns that are more
beneficial than this minimal case. An improvement to the more general
h-op lowering may allow us to remove the restriction here in a follow-up.

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

5 years agoMerge branch 'arcpatch-D55094'
David Callahan [Mon, 14 Jan 2019 18:35:43 +0000 (18:35 +0000)]
Merge branch 'arcpatch-D55094'

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

5 years agoRevert "[VFS] Allow multiple RealFileSystem instances with independent CWDs."
Amara Emerson [Mon, 14 Jan 2019 18:32:09 +0000 (18:32 +0000)]
Revert "[VFS] Allow multiple RealFileSystem instances with independent CWDs."
This reverts commit r351079, r351069 and r351050 as it broken the greendragon bots on macOS.

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

5 years agogn build: Unbreak mac build after r350977
Nico Weber [Mon, 14 Jan 2019 18:30:35 +0000 (18:30 +0000)]
gn build: Unbreak mac build after r350977

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

5 years agogn build: Fix path to gn.py in docs
Nico Weber [Mon, 14 Jan 2019 18:26:55 +0000 (18:26 +0000)]
gn build: Fix path to gn.py in docs

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

5 years agocmake: Don't install plugins used for examples or tests
Tom Stellard [Mon, 14 Jan 2019 18:25:35 +0000 (18:25 +0000)]
cmake: Don't install plugins used for examples or tests

Summary:
This patch drops install targets for LLVMHello.so,
TestPlugin.so, and BugpointPasses.so.

Reviewers: chandlerc, beanz, thakis, philip.pfaffe

Reviewed By: chandlerc

Subscribers: SquallATF, mgorny, llvm-commits

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

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

5 years ago[WebAssembly] Remove tests for old intrinsics.
Dan Gohman [Mon, 14 Jan 2019 18:25:29 +0000 (18:25 +0000)]
[WebAssembly] Remove tests for old intrinsics.

This is a followup to r351084 which removes the tests for the old
intrinsic names.

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

5 years agogn build: svn propset svn:executable on utils/gn/gn.py
Nico Weber [Mon, 14 Jan 2019 18:24:44 +0000 (18:24 +0000)]
gn build: svn propset svn:executable on utils/gn/gn.py

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

5 years ago[WebAssembly] Remove old intrinsics
Dan Gohman [Mon, 14 Jan 2019 18:23:45 +0000 (18:23 +0000)]
[WebAssembly] Remove old intrinsics

This removes the old grow_memory and mem.grow-style intrinsics, leaving just
the memory.grow-style intrinsics.

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

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

5 years ago[WebAssembly] Add a release notes blurb
Dan Gohman [Mon, 14 Jan 2019 18:20:30 +0000 (18:20 +0000)]
[WebAssembly] Add a release notes blurb

Bid farewell to LLVM_EXPERIMENTAL_TARGETS_TO_BUILD!

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

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

5 years ago[VFS] Disable unix-assuming VFS test on windows
Sam McCall [Mon, 14 Jan 2019 17:51:10 +0000 (17:51 +0000)]
[VFS] Disable unix-assuming VFS test on windows

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

5 years ago[X86] Add PR40306 shuffle test case
Simon Pilgrim [Mon, 14 Jan 2019 17:49:11 +0000 (17:49 +0000)]
[X86] Add PR40306 shuffle test case

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

5 years agoReapply r345008 "Split MachinePipeliner code into header and cpp files"
Adrian Prantl [Mon, 14 Jan 2019 17:24:11 +0000 (17:24 +0000)]
Reapply r345008 "Split MachinePipeliner code into header and cpp files"

Split MachinePipeliner code into header and cpp files to allow
inheritance from SwingSchedulerDAG.

This reapplies https://reviews.llvm.org/D56084 after moving the
implementation of the dump functions into the .cpp files. This fixes a
linker error when building with Clang modules enables and local
submodule visibility disabled.

Original patch by Lama Saba <lama.saba@intel.com>!

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

5 years agoRemove NameLen argument from newly-introduced IR C APIs.
James Y Knight [Mon, 14 Jan 2019 17:16:55 +0000 (17:16 +0000)]
Remove NameLen argument from newly-introduced IR C APIs.

Normally, changing the function signatures of C APIs is disallowed,
but as these two are brand new last week, and haven't been released
yet, it is okay in this instance.

As per discussion in D56556, we will not add NameLen arguments to IR
building APIs, for the following reasons:

1. We do not want to deprecate all of the IR building APIs, just to add a
NameLen argument to each one.

2. Consistency is important, so adding it just to new ones is unfortunate.

3. The IR names are completely optional, useful for readability of IR
only. There is no value in ever supporting nul bytes.

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

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

5 years agoReland "Refactor GetRegistersForValue. NFCI."
Nirav Dave [Mon, 14 Jan 2019 17:09:45 +0000 (17:09 +0000)]
Reland "Refactor GetRegistersForValue. NFCI."

Remove over-strictification class membership check.

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

5 years ago[DAGCombiner] Add (sub_sat x, x) -> 0 combine
Simon Pilgrim [Mon, 14 Jan 2019 15:43:34 +0000 (15:43 +0000)]
[DAGCombiner] Add (sub_sat x, x) -> 0 combine

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

5 years ago[DAGCombiner] Enable sub saturation constant folding
Simon Pilgrim [Mon, 14 Jan 2019 15:28:53 +0000 (15:28 +0000)]
[DAGCombiner] Enable sub saturation constant folding

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

5 years ago[X86] Add sub saturation constant folding and self tests.
Simon Pilgrim [Mon, 14 Jan 2019 15:08:51 +0000 (15:08 +0000)]
[X86] Add sub saturation constant folding and self tests.

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

5 years ago[DAGCombiner] Add add/sub saturation undef handling
Simon Pilgrim [Mon, 14 Jan 2019 14:16:24 +0000 (14:16 +0000)]
[DAGCombiner] Add add/sub saturation undef handling

Match ConstantFolding.cpp:
(add_sat x, undef) -> -1
(sub_sat x, undef) -> 0

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

5 years ago[VFS] Fix unused variable warning. NFC
Sam McCall [Mon, 14 Jan 2019 14:13:24 +0000 (14:13 +0000)]
[VFS] Fix unused variable warning. NFC

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

5 years ago[MIPS GlobalISel] Fix release build make-check after r351046
Petar Avramovic [Mon, 14 Jan 2019 14:12:43 +0000 (14:12 +0000)]
[MIPS GlobalISel] Fix release build make-check after r351046

Add 'REQUIRES: asserts' to test that uses debug output in
order to fix r351046 for buildbots that use release build.

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

5 years ago[DAGCombiner] add saturation instructions are commutative
Simon Pilgrim [Mon, 14 Jan 2019 14:02:24 +0000 (14:02 +0000)]
[DAGCombiner] add saturation instructions are commutative

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

5 years ago[X86] Add add/sub saturation undef tests.
Simon Pilgrim [Mon, 14 Jan 2019 13:47:07 +0000 (13:47 +0000)]
[X86] Add add/sub saturation undef tests.

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

5 years agogn build: Add gn.py wrapper script that adds --dotfile= and --root= parameters
Nico Weber [Mon, 14 Jan 2019 12:50:40 +0000 (12:50 +0000)]
gn build: Add gn.py wrapper script that adds --dotfile= and --root= parameters

Since people weren't enthused about moving the .gn file to the toplevel in
D56419, here's a script to make gn at least somewhat more pleasant to invoke
(useful for gn clean, gn args --list, gn desc, etc).

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

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

5 years ago[DAGCombiner] Enable add saturation constant folding
Simon Pilgrim [Mon, 14 Jan 2019 12:34:31 +0000 (12:34 +0000)]
[DAGCombiner] Enable add saturation constant folding

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

5 years ago[mips] Optimize shifts for types larger than GPR size (mips2/mips3)
Aleksandar Beserminji [Mon, 14 Jan 2019 12:28:51 +0000 (12:28 +0000)]
[mips] Optimize shifts for types larger than GPR size (mips2/mips3)

With this patch, shifts are lowered to optimal number of instructions
necessary to shift types larger than the general purpose register size.

This resolves PR/32293.

Thanks to Kyle Butt for reporting the issue!

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

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

5 years ago[DebugInfo] Remove un-necessary logic from HoistThenElseCodeToIf
Jeremy Morse [Mon, 14 Jan 2019 12:13:12 +0000 (12:13 +0000)]
[DebugInfo] Remove un-necessary logic from HoistThenElseCodeToIf

Following PR39807, the way in which SimplifyCFG hoists common code on
branch paths was fixed in r347782. However this left extra code hanging
around HoistThenElseCodeToIf that wasn't necessary and needlessly
complicated matters -- we no longer need to look up through the 'if'
basic block to find a location for hoisted 'select' insts, we can instead
use the location chosen by applyMergedLocation.

This patch deletes that extra logic, and updates a regression test to
reflect the new logic (selects get the merged location, not a previous
insts location).

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

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

5 years ago[DAGCombiner] Add add saturation constant folding tests.
Simon Pilgrim [Mon, 14 Jan 2019 12:12:42 +0000 (12:12 +0000)]
[DAGCombiner] Add add saturation constant folding tests.

Exposes an issue with sadd_sat for computeOverflowKind, so I've disabled it for now.

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

5 years ago[ARM GlobalISel] Import MOVi32imm into GlobalISel
Diana Picus [Mon, 14 Jan 2019 12:04:08 +0000 (12:04 +0000)]
[ARM GlobalISel] Import MOVi32imm into GlobalISel

Make it possible for TableGen to produce code for selecting MOVi32imm.
This allows reasonably recent ARM targets to select a lot more constants
than before.

We achieve this by adding GISelPredicateCode to arm_i32imm. It's
impossible to use the exact same code for both DAGISel and GlobalISel,
since one uses "Subtarget->" and the other "STI." to refer to the
subtarget. Moreover, in GlobalISel we don't have ready access to the
MachineFunction, so we need to add a bit of code for obtaining it from
the instruction that we're selecting. This is also the reason why it
needs to remain a PatLeaf instead of the more specific IntImmLeaf.

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

5 years ago[SelectionDAG] Add type sanity assertions for add/sub saturation node creation.
Simon Pilgrim [Mon, 14 Jan 2019 11:56:59 +0000 (11:56 +0000)]
[SelectionDAG] Add type sanity assertions for add/sub saturation node creation.

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

5 years ago[AMDGPU] Add support for TFE/LWE in image intrinsics. 2nd try
David Stuttard [Mon, 14 Jan 2019 11:55:24 +0000 (11:55 +0000)]
[AMDGPU] Add support for TFE/LWE in image intrinsics. 2nd try

TFE and LWE support requires extra result registers that are written in the
event of a failure in order to detect that failure case.
The specific use-case that initiated these changes is sparse texture support.

This means that if image intrinsics are used with either option turned on, the
programmer must ensure that the return type can contain all of the expected
results. This can result in redundant registers since the vector size must be a
power-of-2.

This change takes roughly 6 parts:
1. Modify the instruction defs in tablegen to add new instruction variants that
can accomodate the extra return values.
2. Updates to lowerImage in SIISelLowering.cpp to accomodate setting TFE or LWE
(where the bulk of the work for these instruction types is now done)
3. Extra verification code to catch cases where intrinsics have been used but
insufficient return registers are used.
4. Modification to the adjustWritemask optimisation to account for TFE/LWE being
enabled (requires extra registers to be maintained for error return value).
5. An extra pass to zero initialize the error value return - this is because if
the error does not occur, the register is not written and thus must be zeroed
before use. Also added a new (on by default) option to ensure ALL return values
are zero-initialized that is required for sparse texture support.
6. Disable the inst_combine optimization in the presence of tfe/lwe (later TODO
for this to re-enable and handle correctly).

There's an additional fix now to avoid a dmask=0

For an image intrinsic with tfe where all result channels except tfe
were unused, I was getting an image instruction with dmask=0 and only a
single vgpr result for tfe. That is incorrect because the hardware
assumes there is at least one vgpr result, plus the one for tfe.

Fixed by forcing dmask to 1, which gives the desired two vgpr result
with tfe in the second one.

The TFE or LWE result is returned from the intrinsics using an aggregate
type. Look in the test code provided to see how this works, but in essence IR
code to invoke the intrinsic looks as follows:

%v = call {<4 x float>,i32} @llvm.amdgcn.image.load.1d.v4f32i32.i32(i32 15,
                                      i32 %s, <8 x i32> %rsrc, i32 1, i32 0)
%v.vec = extractvalue {<4 x float>, i32} %v, 0
%v.err = extractvalue {<4 x float>, i32} %v, 1

This re-submit of the change also includes a slight modification in
SIISelLowering.cpp to work-around a compiler bug for the powerpc_le
platform that caused a buildbot failure on a previous submission.

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

Change-Id: If222bc03642e76cf98059a6bef5d5bffeda38dda

Work around for ppcle compiler bug

Change-Id: Ie284cf24b2271215be1b9dc95b485fd15000e32b

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

5 years ago[VFS] Allow multiple RealFileSystem instances with independent CWDs.
Sam McCall [Mon, 14 Jan 2019 10:56:35 +0000 (10:56 +0000)]
[VFS] Allow multiple RealFileSystem instances with independent CWDs.

Summary:
Previously only one RealFileSystem instance was available, and its working
directory is shared with the process. This doesn't work well for multithreaded
programs that want to work with relative paths - the vfs::FileSystem is assumed
to provide the working directory, but a thread cannot control this exclusively.

The new vfs::createPhysicalFileSystem() factory copies the process's working
directory initially, and then allows it to be independently modified.

This implementation records the working directory path, and glues it to relative
paths to provide the correct absolute path to the sys::fs:: functions.
This will give different results in unusual situations (e.g. the CWD is moved).

The main alternative is the use of openat(), fstatat(), etc to ask the OS to
resolve paths relative to a directory handle which can be kept open. This is
more robust. There are two reasons not to do this initially:
1. these functions are not available on all supported Unixes, and are somewhere
   between difficult and unavailable on Windows. So we need a path-based
   fallback anyway.
2. this would mean also adding support at the llvm::sys::fs level, which is a
   larger project. My clearest idea is an OS-specific `BaseDirectory` object
   that can be optionally passed to functions there. Eventually this could be
   backed by either paths or a fd where openat() is supported.
   This is a large project, and demonstrating here that a path-based fallback
   works is a useful prerequisite.

There is some subtlety to the path-manipulation mechanism:
  - when setting the working directory, both Specified=makeAbsolute(path) and
    Resolved=realpath(path) are recorded. These may differ in the presence of
    symlinks.
  - getCurrentWorkingDirectory() and makeAbsolute() use Specified - this is
    similar to the behavior of $PWD and sys::path::current_path
  - IO operations like openFileForRead use Resolved. This is similar to the
    behavior of an openat() based implementation, that doesn't see changes
    in symlinks.
There may still be combinations of operations and FS states that yield unhelpful
behavior. This is hard to avoid with symlinks and FS abstractions :(

The caching behavior of the current working directory is removed in this patch.
getRealFileSystem() is now specified to link to the process CWD, so the caching
is incorrect.
The user who needed this so far is clangd, which will immediately switch to
createPhysicalFileSystem().

Reviewers: ilya-biryukov, bkramer, labath

Subscribers: ioeric, kadircet, kristina, llvm-commits

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

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

5 years agoReplace "no-frame-pointer-*" function attributes with "frame-pointer"
Francis Visoiu Mistrih [Mon, 14 Jan 2019 10:55:55 +0000 (10:55 +0000)]
Replace "no-frame-pointer-*" function attributes with "frame-pointer"

Part of the effort to refactoring frame pointer code generation. We used
to use two function attributes "no-frame-pointer-elim" and
"no-frame-pointer-elim-non-leaf" to represent three kinds of frame
pointer usage: (all) frames use frame pointer, (non-leaf) frames use
frame pointer, (none) frame use frame pointer. This CL makes the idea
explicit by using only one enum function attribute "frame-pointer"

Option "-frame-pointer=" replaces "-disable-fp-elim" for tools such as
llc.

"no-frame-pointer-elim" and "no-frame-pointer-elim-non-leaf" are still
supported for easy migration to "frame-pointer".

tests are mostly updated with

// replace command line args â€˜-disable-fp-elim=false’ with â€˜-frame-pointer=none’
grep -iIrnl '\-disable-fp-elim=false' * | xargs sed -i '' -e "s/-disable-fp-elim=false/-frame-pointer=none/g"

// replace command line args â€˜-disable-fp-elim’ with â€˜-frame-pointer=all’
grep -iIrnl '\-disable-fp-elim' * | xargs sed -i '' -e "s/-disable-fp-elim/-frame-pointer=all/g"

Patch by Yuanfang Chen (tabloid.adroit)!

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

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

5 years ago[MIPS GlobalISel] Add pre legalizer combiner pass
Petar Avramovic [Mon, 14 Jan 2019 10:27:05 +0000 (10:27 +0000)]
[MIPS GlobalISel] Add pre legalizer combiner pass

Introduce GlobalISel pre legalizer pass for MIPS.
It will be used to cope with instructions that require
combining before legalization.

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

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

5 years ago[BasicBlockUtils] Generalize DeleteDeadBlock to deal with multiple dead blocks
Max Kazantsev [Mon, 14 Jan 2019 10:26:26 +0000 (10:26 +0000)]
[BasicBlockUtils] Generalize DeleteDeadBlock to deal with multiple dead blocks

Utility function `DeleteDeadBlock` expects that all predecessors of a block being
deleted are already deleted, with the exception of single-block loop. It makes it
hard to use for deletion of a set of blocks that may contain cyclic dependencies.
The is no correct order of invocations of this function that does not produce
dangling pointers on already deleted blocks.

This patch introduces a generalized version of this function `DeleteDeadBlocks`
that allows us to remove multiple blocks at once, even if there are cycles among
them. The only requirement is that no block being deleted should have a predecessor
that is not being deleted.

The logic of `DeleteDeadBlocks` is following:
  for each block
    create relevant DT updates;
    remove all instructions (replace with undef if needed);
    replace terminator with unreacheable;
  apply DT updates;
  for each block
    delete block;

Therefore, `DeleteDeadBlock` becomes a particular case of
the general algorithm called for a single block.

Differential Revision: https://reviews.llvm.org/D56120
Reviewed By: skatkov

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

5 years ago[llvm-symbolizer] Add -addresses, -a as aliases for -print-address
Dmitry Venikov [Mon, 14 Jan 2019 10:10:51 +0000 (10:10 +0000)]
[llvm-symbolizer] Add -addresses, -a as aliases for -print-address

Summary: Provides -addresses, -a as aliases for -print-address. Motivation: https://bugs.llvm.org/show_bug.cgi?id=40067.

Reviewers: jhenderson, ruiu, rnk, fjricci

Reviewed By: jhenderson

Subscribers: rupprecht, llvm-commits

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

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

5 years agoFix defines.txt
Thomas Preud'homme [Mon, 14 Jan 2019 10:10:48 +0000 (10:10 +0000)]
Fix defines.txt

Support arbitrary suffix when matching FileCheck executable name in
defines.txt to successfully match FileCheck.EXE on Microsoft Windows.

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

5 years agoDetect incorrect FileCheck variable CLI definition
Thomas Preud'homme [Mon, 14 Jan 2019 09:29:10 +0000 (09:29 +0000)]
Detect incorrect FileCheck variable CLI definition

Summary:
While the backend code of FileCheck relies on definition of variable
from the command-line to have an equal sign '=' and a variable name
before that, the frontend does not actually enforce it. This leads to
FileCheck crashing when invoked with invalid syntax for the -D option.

This patch adds the missing validation in the frontend. It also makes
the -D option an AlwaysPrefix option to be able to detect -D=FOO as
being a define without variable and -D as missing its value.

Copyright:
- Linaro (changes in version 2 of revision D55940)
- GraphCore (changes in later versions)

Reviewers: jdenny

Subscribers: JonChesterfield, hiraditya, kristina, probinson,
llvm-commits

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

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

5 years agoAdd support for prefix-only CLI options
Thomas Preud'homme [Mon, 14 Jan 2019 09:28:53 +0000 (09:28 +0000)]
Add support for prefix-only CLI options

Summary:
Add support for options that always prefix their value, giving an error
if the value is in the next argument or if the option is given a value
assignment (ie. opt=val). This is the desired behavior for the -D option
of FileCheck for instance.

Copyright:
- Linaro (changes in version 2 of revision D55940)
- GraphCore (changes in later versions and introduced when creating
  D56549)

Reviewers: jdenny

Subscribers: llvm-commits, probinson, kristina, hiraditya,
JonChesterfield

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

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

5 years ago[X86] Remove mask parameter from avx512 pmultishiftqb intrinsics. Use select in IR...
Craig Topper [Mon, 14 Jan 2019 08:46:45 +0000 (08:46 +0000)]
[X86] Remove mask parameter from avx512 pmultishiftqb intrinsics. Use select in IR instead.

Fixes PR40259

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

5 years ago[X86] Add new test file that was supposed to go with r351028.
Craig Topper [Mon, 14 Jan 2019 08:46:42 +0000 (08:46 +0000)]
[X86] Add new test file that was supposed to go with r351028.

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

5 years ago[X86] Update type profile for DBPSADBW to indicate the immediate is an i8 not just...
Craig Topper [Mon, 14 Jan 2019 02:59:08 +0000 (02:59 +0000)]
[X86] Update type profile for DBPSADBW to indicate the immediate is an i8 not just any int.

Removes some type checks from X86GenDAGISel.inc

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

5 years ago[X86] Remove unused intrinsic handlers. NFC
Craig Topper [Mon, 14 Jan 2019 01:56:59 +0000 (01:56 +0000)]
[X86] Remove unused intrinsic handlers. NFC

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

5 years ago[X86] Remove FPCLASS intrinsic handler. Use INTR_TYPE_2OP instead. NFC
Craig Topper [Mon, 14 Jan 2019 01:44:09 +0000 (01:44 +0000)]
[X86] Remove FPCLASS intrinsic handler. Use INTR_TYPE_2OP instead. NFC

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

5 years ago[X86] Remove mask parameter from vpshufbitqmb intrinsics. Change result to a vXi1...
Craig Topper [Mon, 14 Jan 2019 00:03:50 +0000 (00:03 +0000)]
[X86] Remove mask parameter from vpshufbitqmb intrinsics. Change result to a vXi1 vector.

The input mask can be represented with an AND in IR.

Fixes PR40258

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

5 years ago[DAGCombiner] If add_sat(x,y) can't overflow -> add(x,y)
Simon Pilgrim [Sun, 13 Jan 2019 22:08:26 +0000 (22:08 +0000)]
[DAGCombiner] If add_sat(x,y) can't overflow -> add(x,y)

NOTE: We need more powerful signed overflow detection in computeOverflowKind

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

5 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Sun, 13 Jan 2019 21:53:12 +0000 (21:53 +0000)]
Fix unused variable warning. NFCI.

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

5 years ago[DAGCombiner] Some very basic add/sub saturation combines.
Simon Pilgrim [Sun, 13 Jan 2019 21:50:24 +0000 (21:50 +0000)]
[DAGCombiner] Some very basic add/sub saturation combines.

Handle combines with zero and constant canonicalization for adds.

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

5 years ago[X86] Add some basic add/sub saturation combine tests.
Simon Pilgrim [Sun, 13 Jan 2019 21:21:46 +0000 (21:21 +0000)]
[X86] Add some basic add/sub saturation combine tests.

The actual combines will be added in a future commit.

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

5 years ago[LegalizeDAG] Remove 'NeedInvert' code from expansion of BR_CC. Replace with an assert.
Craig Topper [Sun, 13 Jan 2019 19:33:30 +0000 (19:33 +0000)]
[LegalizeDAG] Remove 'NeedInvert' code from expansion of BR_CC. Replace with an assert.

I accidentally triggered this code while doing some experiments and it doesn't look lke it could possibly work.

It calls 'getNOT' on a node that should be a CondCode.

I think to do this right we would need to swap the branch target and the fallthrough target. But that's not easy to do. Or we could create an explicit SetCC and feed that into a new BR_CC?

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

5 years ago[X86] Rename overly verbose method; NFC
Nikita Popov [Sun, 13 Jan 2019 16:41:26 +0000 (16:41 +0000)]
[X86] Rename overly verbose method; NFC

As suggested on D56636.

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

5 years agoRemove TypeBuilder.h, and fix the few locations using it.
James Y Knight [Sun, 13 Jan 2019 16:09:28 +0000 (16:09 +0000)]
Remove TypeBuilder.h, and fix the few locations using it.

This shortcut mechanism for creating types was added 10 years ago, but
has seen almost no uptake since then, neither internally nor in
external projects.

The very small number of characters saved by using it does not seem
worth the mental overhead of an additional type-creation API, so,
delete it.

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

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

5 years ago[X86] Add more ISD nodes to handle masked versions of VCVT(T)PD2DQZ128/VCVT(T)PD2UDQZ...
Craig Topper [Sun, 13 Jan 2019 02:59:59 +0000 (02:59 +0000)]
[X86] Add more ISD nodes to handle masked versions of VCVT(T)PD2DQZ128/VCVT(T)PD2UDQZ128 which only produce 2 result elements and zeroes the upper elements.

We can't represent this properly with vselect like we normally do. We also have to update the instruction definition to use a VK2WM mask instead of VK4WM to represent this.

Fixes another case from PR34877

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

5 years ago[X86] Add X86ISD::VMFPROUND to handle the masked case of VCVTPD2PSZ128 which only...
Craig Topper [Sun, 13 Jan 2019 02:59:57 +0000 (02:59 +0000)]
[X86] Add X86ISD::VMFPROUND to handle the masked case of VCVTPD2PSZ128 which only produces 2 result elements and zeroes the upper elements.

We can't represent this properly with vselect like we normally do. We also have to update the instruction definition to use a VK2WM mask instead of VK4WM to represent this.

Fixes another case from PR34877.

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

5 years agoGive helper classes/functions local linkage. NFC.
Benjamin Kramer [Sat, 12 Jan 2019 18:36:22 +0000 (18:36 +0000)]
Give helper classes/functions local linkage. NFC.

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

5 years ago[X86] More aggressive shuffle mask widening in combineExtractWithShuffle
Simon Pilgrim [Sat, 12 Jan 2019 16:38:56 +0000 (16:38 +0000)]
[X86] More aggressive shuffle mask widening in combineExtractWithShuffle

Use demanded extract index to set most of the shuffle mask to undef, making it easier to widen and peek through.

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

5 years ago[LoopVectorizer] give more advice in remark about failure to vectorize call
Sanjay Patel [Sat, 12 Jan 2019 15:27:15 +0000 (15:27 +0000)]
[LoopVectorizer] give more advice in remark about failure to vectorize call

Something like this is requested by:
https://bugs.llvm.org/show_bug.cgi?id=40265
...and it seems like a common enough case that we should acknowledge it.

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

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

5 years ago[Algorithm] Add make_const_ref corresponding to make_const_ptr
Stephen Kelly [Sat, 12 Jan 2019 15:23:30 +0000 (15:23 +0000)]
[Algorithm] Add make_const_ref corresponding to make_const_ptr

Reviewers: aaron.ballman

Subscribers: dexonsmith, kristina, llvm-commits

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

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

5 years ago[DAGCombiner] fold insert_subvector of insert_subvector
Sanjay Patel [Sat, 12 Jan 2019 15:12:28 +0000 (15:12 +0000)]
[DAGCombiner] fold insert_subvector of insert_subvector

This pattern:

    t33: v8i32 = insert_subvector undef:v8i32, t35, Constant:i64<0>
  t21: v16i32 = insert_subvector undef:v16i32, t33, Constant:i64<0>

...shows up in PR33758:
https://bugs.llvm.org/show_bug.cgi?id=33758
...although this patch doesn't make any difference to the final result on that yet.

In the affected tests here, it looks like it just makes RA wiggle. But we might
as well squash this to prevent it interfering with other pattern-matching.

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

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

5 years ago[llvm-objdump] - Change the output for --all-headers.
George Rimar [Sat, 12 Jan 2019 12:17:24 +0000 (12:17 +0000)]
[llvm-objdump] - Change the output for --all-headers.

This is for https://bugs.llvm.org/show_bug.cgi?id=40008,

it starts printing the file headers when --all-headers is given and
do a minor cosmetic change.

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

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

5 years agoUse getShiftAmountTy for shift amounts.
Simon Pilgrim [Sat, 12 Jan 2019 12:00:43 +0000 (12:00 +0000)]
Use getShiftAmountTy for shift amounts.

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

5 years agogn build: Unbreak Windows build
Nico Weber [Sat, 12 Jan 2019 11:56:47 +0000 (11:56 +0000)]
gn build: Unbreak Windows build

I didn't break all that much during upstreaming, just needs two small fixes:

- fix spelling of MCJITTests.def file
- make libLTO a shared_library to put it in bin/ on Windows where it is in the
  CMake build too

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

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

5 years ago[X86] Add more usub.sat vector tests; NFC
Nikita Popov [Sat, 12 Jan 2019 11:43:04 +0000 (11:43 +0000)]
[X86] Add more usub.sat vector tests; NFC

Add additional vXi32 and vXi64 tests.

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

5 years ago[ORC][MIPS] Fill delay-slot after `jr` instruction
Simon Atanasyan [Sat, 12 Jan 2019 11:12:08 +0000 (11:12 +0000)]
[ORC][MIPS] Fill delay-slot after `jr` instruction

MIPS `jr` instruction uses a delay-slot. To escape execution of
arbitrary instruction we should either fill the delay-slot by `nop`
instruction or swap `jr` instruction and logically preceding
instruction. This fix implements the second method to generate a bit
more effective code.

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

5 years ago[ORC][MIPS] Setup t9 register and call function through this register
Simon Atanasyan [Sat, 12 Jan 2019 11:12:04 +0000 (11:12 +0000)]
[ORC][MIPS] Setup t9 register and call function through this register

MIPS ABI states that every function must be called through jalr $t9. In
other words, a function expect that t9 register points to the beginning
of its code. A function uses this register to calculate offset to the
Global Offset Table and save it to the `gp` register.
```
lui   $gp, %hi(_gp_disp)
addiu $gp, %lo(_gp_disp)
addu  $gp, $gp, $t9
```

If `t9` and as a result `$gp` point to the wrong place the following code
loads incorrect value from GOT and passes control to invalid code.
```
lw    $v0,%call16(foo)($gp)
jalr  $t9
```

OrcMips32 and OrcMips64 writeResolverCode methods pass control to the
resolved address, but do not setup `$t9` before the call. The `t9` holds
value of the beginning of `resolver` code so any attempts to call
routines via GOT failed.

This change fixes the problem. The `OrcLazy/hidden-visibility.ll` test
starts to pass correctly. Before the change it fails on MIPS because the
`exitOnLazyCallThroughFailure` called from the resolver code could not
call libc routine `exit` via GOT.

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

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

5 years ago[X86] Improve vXi64 ISD::ABS codegen with SSE41+
Simon Pilgrim [Sat, 12 Jan 2019 10:28:12 +0000 (10:28 +0000)]
[X86] Improve vXi64 ISD::ABS codegen with SSE41+

Make use of vblendvpd to select on the signbit

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

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

5 years ago[X86][AARCH64] Improve ISD::ABS support
Simon Pilgrim [Sat, 12 Jan 2019 09:59:32 +0000 (09:59 +0000)]
[X86][AARCH64] Improve ISD::ABS support

This patch takes some of the code from D49837 to allow us to enable ISD::ABS support for all SSE vector types.

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

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

5 years agoReapply "[DemandedBits] Use SetVector for Worklist"
Nikita Popov [Sat, 12 Jan 2019 09:09:15 +0000 (09:09 +0000)]
Reapply "[DemandedBits] Use SetVector for Worklist"

DemandedBits currently uses a simple vector for the worklist, which
means that instructions may be inserted multiple times into it.
Especially in combination with the deep lattice, this may cause
instructions too be recomputed very often. To avoid this, switch
to a SetVector.

Reapplying with a smaller number of inline elements in the
SmallSetVector, to avoid running into the SmallDenseMap issue
described in D56455.

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

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

5 years ago[llvm-objcopy] [COFF] Remove pointless Reader/Writer base classes. NFC.
Martin Storsjo [Sat, 12 Jan 2019 08:30:09 +0000 (08:30 +0000)]
[llvm-objcopy] [COFF] Remove pointless Reader/Writer base classes. NFC.

These were copied as part of the original design from the ELF
backend, but aren't necessary at the moment.

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

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

5 years ago[X86] Remove X86ISD::SELECT as its no longer used by any of our intrinsic lowering.
Craig Topper [Sat, 12 Jan 2019 08:15:54 +0000 (08:15 +0000)]
[X86] Remove X86ISD::SELECT as its no longer used by any of our intrinsic lowering.

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

5 years ago[X86] Add ISD node for masked version of CVTPS2PH.
Craig Topper [Sat, 12 Jan 2019 08:05:12 +0000 (08:05 +0000)]
[X86] Add ISD node for masked version of CVTPS2PH.

The 128-bit input produces 64-bits of output and fills the upper 64-bits with 0. The mask only applies to the lower elements. But we can't represent this with a vselect like we normally do.

This also avoids the need to have a special X86ISD::SELECT when avx512bw isn't enabled since vselect v8i16 isn't legal there.

Fixes another instruction for PR34877.

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

5 years ago[RISCV] Introduce codegen patterns for RV64M-only instructions
Alex Bradbury [Sat, 12 Jan 2019 07:43:06 +0000 (07:43 +0000)]
[RISCV] Introduce codegen patterns for RV64M-only instructions

As discussed on llvm-dev
<http://lists.llvm.org/pipermail/llvm-dev/2018-December/128497.html>, we have
to be careful when trying to select the *w RV64M instructions. i32 is not a
legal type for RV64 in the RISC-V backend, so operations have been promoted by
the time they reach instruction selection. Information about whether the
operation was originally a 32-bit operations has been lost, and it's easy to
write incorrect patterns.

Similarly to the variable 32-bit shifts, a DAG combine on ANY_EXTEND will
produce a SIGN_EXTEND if this is likely to result in sdiv/udiv/urem being
selected (and so save instructions to sext/zext the input operands).

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

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

5 years ago[RISCV] Add patterns for RV64I SLLW/SRLW/SRAW instructions
Alex Bradbury [Sat, 12 Jan 2019 07:32:31 +0000 (07:32 +0000)]
[RISCV] Add patterns for RV64I SLLW/SRLW/SRAW instructions

This restores support for selecting the SLLW/SRLW/SRAW instructions, which was
removed in rL348067 as the previous patterns made some unsafe assumptions.
Also see the related llvm-dev discussion
<http://lists.llvm.org/pipermail/llvm-dev/2018-December/128497.html>

Ultimately I didn't introduce a custom SelectionDAG node, but instead added a
DAG combine that inserts an AssertZext i5 on the shift amount for an i32
variable-length shift and also added an ANY_EXTEND DAG-combine which will
instead produce a SIGN_EXTEND for an i32 variable-length shift, increasing the
opportunity to safely select SLLW/SRLW/SRAW.

There are obviously different ways of addressing this (a number discussed in
the llvm-dev thread), so I'd welcome further feedback and comments.

Note that there are now some cases in
test/CodeGen/RISCV/rv64i-exhaustive-w-insts.ll where sraw/srlw/sllw is
selected even though sra/srl/sll could be used without any extra instructions.
Given both are semantically equivalent, there doesn't seem a good reason to
prefer one vs the other. Given that would require more logic to still select
sra/srl/sll in those cases, I've left it preferring the *w variants.

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

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

5 years ago[X86] Remove unnecessary code from getMaskNode.
Craig Topper [Sat, 12 Jan 2019 06:13:44 +0000 (06:13 +0000)]
[X86] Remove unnecessary code from getMaskNode.

We no longer need to extend mask scalars before bitcasting them to vXi1. This was only needed for the truncate intrinsics. And was really a bug in our lowering of them.

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

5 years ago[X86] When lowering v1i1/v2i1/v4i1/v8i1 load/store with avx512f, but not avx512dq...
Craig Topper [Sat, 12 Jan 2019 02:22:10 +0000 (02:22 +0000)]
[X86] When lowering v1i1/v2i1/v4i1/v8i1 load/store with avx512f, but not avx512dq, use v16i1 as the intermediate mask type instead of v8i1.

We still use i8 for the load/store type. So we need to convert to/from i16 to around the mask type.

By doing this we get an i8->i16 extload which we can then pattern match to a KMOVW if the access is aligned.

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