OSDN Git Service

android-x86/external-llvm.git
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

5 years ago[X86] Change some patterns that select MOVZX16rm8 to instead select MOVZX32rm8 and...
Craig Topper [Sat, 12 Jan 2019 02:22:06 +0000 (02:22 +0000)]
[X86] Change some patterns that select MOVZX16rm8 to instead select MOVZX32rm8 and extract the subregister.

This should be a shorter encoding and is consistent with what we do for zext i8->i16

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

5 years ago[ARM] Fix typo
Evandro Menezes [Sat, 12 Jan 2019 01:06:43 +0000 (01:06 +0000)]
[ARM] Fix typo

Fix typo in r350952.

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

5 years ago[X86] Add ISD nodes for masked truncate so we can properly represent when the output...
Craig Topper [Sat, 12 Jan 2019 00:55:27 +0000 (00:55 +0000)]
[X86] Add ISD nodes for masked truncate so we can properly represent when the output has more elements than the input due to needing to be 128 bits.

We can't properly represent this with a vselect since the upper elements of the result are supposed to be zeroed regardless of the mask.

This also reuses the new nodes even when the result type fits in 128 bits if the input is q/d and the result is w/b since vselect w/b using k-register condition isn't legal without avx512bw. Currently we're doing this even when avx512bw is enabled, but I might change that.

This fixes some of PR34877

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

5 years agogn build: Add a stage2 toolchain for Android.
Peter Collingbourne [Fri, 11 Jan 2019 23:18:51 +0000 (23:18 +0000)]
gn build: Add a stage2 toolchain for Android.

This makes it possible to build llvm-symbolizer for Android, which
is one of the prerequisites for running the sanitizer tests on Android.

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

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

5 years agogn build: Create a template for unix toolchains.
Peter Collingbourne [Fri, 11 Jan 2019 22:57:57 +0000 (22:57 +0000)]
gn build: Create a template for unix toolchains.

Also change the toolchain description to use current_os instead of
host_os so that the template can be used for cross builds, and add
a current_os to the win toolchain to match the unix toolchain.

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

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

5 years ago[AArch64] Improve Exynos predicates
Evandro Menezes [Fri, 11 Jan 2019 22:39:47 +0000 (22:39 +0000)]
[AArch64] Improve Exynos predicates

Expand the predicate using shifted arithmetic and logic instructions to also
consider the respective not shifted instructions.

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

5 years agogn build: Merge r350958.
Peter Collingbourne [Fri, 11 Jan 2019 22:15:53 +0000 (22:15 +0000)]
gn build: Merge r350958.

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

5 years ago[ConstantFolding] Fold undef for integer intrinsics
Nikita Popov [Fri, 11 Jan 2019 21:18:00 +0000 (21:18 +0000)]
[ConstantFolding] Fold undef for integer intrinsics

This fixes https://bugs.llvm.org/show_bug.cgi?id=40110.

This implements handling of undef operands for integer intrinsics in
ConstantFolding, in particular for the bitcounting intrinsics (ctpop,
cttz, ctlz), the with.overflow intrinsics, the saturating math
intrinsics and the funnel shift intrinsics.

The undef behavior follows what InstSimplify does for the general cas
e of non-constant operands. For the bitcount intrinsics (where
InstSimplify doesn't do undef handling -- there cannot be a combination
of an undef + non-constant operand) I'm using a 0 result if the intrinsic
is defined for zero and undef otherwise.

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

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

5 years ago[SLP]Moved NVPTX test under NVPTX directory, NFC.
Alexey Bataev [Fri, 11 Jan 2019 20:42:48 +0000 (20:42 +0000)]
[SLP]Moved NVPTX test under NVPTX directory, NFC.

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

5 years ago[SLP]Update test checks for the SPL vectorizer, NFC.
Alexey Bataev [Fri, 11 Jan 2019 20:21:14 +0000 (20:21 +0000)]
[SLP]Update test checks for the SPL vectorizer, NFC.

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

5 years ago[X86] Fix incomplete handling of register-assigned variables in parsing.
Nirav Dave [Fri, 11 Jan 2019 20:17:36 +0000 (20:17 +0000)]
[X86] Fix incomplete handling of register-assigned variables in parsing.

Teach x86 assembly operand parsing to distinguish between assembler
variable assigned to named registers and those assigned to immediate
values.

Reviewers: rnk, nickdesaulniers, void

Subscribers: hiraditya, jyknight, llvm-commits

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

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

5 years agogn build: Create a variable for the host toolchain and start using it in the tblgen...
Peter Collingbourne [Fri, 11 Jan 2019 19:53:06 +0000 (19:53 +0000)]
gn build: Create a variable for the host toolchain and start using it in the tblgen template.

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

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

5 years agogn build: s/root_out_dir/root_build_dir/g in llvm/utils/gn/build/write_cmake_config...
Peter Collingbourne [Fri, 11 Jan 2019 19:51:49 +0000 (19:51 +0000)]
gn build: s/root_out_dir/root_build_dir/g in llvm/utils/gn/build/write_cmake_config.gni.

This makes the generated files go to the right place when using a non-default toolchain.

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

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

5 years ago[RISCV][NFC] Add CHECK lines for atomic operations on RV64I
Alex Bradbury [Fri, 11 Jan 2019 19:46:48 +0000 (19:46 +0000)]
[RISCV][NFC] Add CHECK lines for atomic operations on RV64I

As or RV32I, we include these for completeness. Committing now to make it
easier to review the RV64A patch.

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

5 years ago[llvm-mca] Update tests for Exynos (NFC)
Evandro Menezes [Fri, 11 Jan 2019 19:36:27 +0000 (19:36 +0000)]
[llvm-mca] Update tests for Exynos (NFC)

Update test cases for Exynos M4.

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

5 years ago[AArch64] Add pipeline model for Exynos M4
Evandro Menezes [Fri, 11 Jan 2019 19:36:25 +0000 (19:36 +0000)]
[AArch64] Add pipeline model for Exynos M4

Add the scheduling and cost model for Exynos M4.

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

5 years ago[CMake] Export utility targets to the build/install tree depending on LLVM_BUILD...
Stefan Granitz [Fri, 11 Jan 2019 19:34:34 +0000 (19:34 +0000)]
[CMake] Export utility targets to the build/install tree depending on LLVM_BUILD/INSTALL_UTILS

Summary:
Allow external projects to import test-related targets like FileCheck, count, not etc. and query binary paths, properties, etc.
This would be useful for LLDB, because it reduces the difference between in-tree vs. standalone builds and simplifies CMake logic.

Reviewers: chapuni, gottesmm, beanz

Reviewed By: beanz

Subscribers: mgorny, lldb-commits, llvm-commits, #lldb

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

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

5 years ago[AArch64] Create feature set for Exynos M4
Evandro Menezes [Fri, 11 Jan 2019 18:54:25 +0000 (18:54 +0000)]
[AArch64] Create feature set for Exynos M4

Complete the feature set for Exynos M4 and update test cases.

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

5 years ago[Legalizer] Use correct ValueType of SELECT_CC node during Float promotion
Pirama Arumuga Nainar [Fri, 11 Jan 2019 18:46:02 +0000 (18:46 +0000)]
[Legalizer] Use correct ValueType of SELECT_CC node during Float promotion

Summary:
When legalizing the result of a SELECT_CC node by promoting the
floating-point type, use the promoted-to type rather than the original
type.

Fix PR40273.

Reviewers: efriedma, majnemer

Subscribers: llvm-commits

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

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

5 years ago[LTO] Record whether LTOUnit splitting is enabled in index
Teresa Johnson [Fri, 11 Jan 2019 18:31:57 +0000 (18:31 +0000)]
[LTO] Record whether LTOUnit splitting is enabled in index

Summary:
Records in the module summary index whether the bitcode was compiled
with the option necessary to enable splitting the LTO unit
(e.g. -fsanitize=cfi, -fwhole-program-vtables, or -fsplit-lto-unit).

The information is passed down to the ModuleSummaryIndex builder via a
new module flag "EnableSplitLTOUnit", which is propagated onto a flag
on the summary index.

This is then used during the LTO link to check whether all linked
summaries were built with the same value of this flag. If not, an error
is issued when we detect a situation requiring whole program visibility
of the class hierarchy. This is the case when both of the following
conditions are met:
1) We are performing LowerTypeTests or Whole Program Devirtualization.
2) There are type tests or type checked loads in the code.

Note I have also changed the ThinLTOBitcodeWriter to also gate the
module splitting on the value of this flag.

Reviewers: pcc

Subscribers: ormris, mehdi_amini, Prazek, inglorion, eraman, steven_wu, dexonsmith, arphaman, dang, llvm-commits

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

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

5 years ago[llvm-objcopy][NFC] Consistenly use two dashes for flags in tests.
Jordan Rupprecht [Fri, 11 Jan 2019 18:06:31 +0000 (18:06 +0000)]
[llvm-objcopy][NFC] Consistenly use two dashes for flags in tests.

Summary:
As pointed out in D53667, our use of hyphens in flags can be inconsistent, mixing `-` with `--`. This change makes all long style flags use `--`.

Automatically changed via:

```
find test/tools/llvm-objcopy/ELF -type f | xargs sed -i 's/ -\([a-zA-Z]\{3\}\)/ --\1/g'
```

Two false positives were manually fixed/reverted.

Reviewers: jhenderson, espindola, alexshap

Reviewed By: jhenderson

Subscribers: emaste, javed.absar, arichardson, fedor.sergeev, jakehehrlich, llvm-commits

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

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

5 years ago[MergeFunc] Erase unused duplicate functions if they are discardable
Vedant Kumar [Fri, 11 Jan 2019 17:56:35 +0000 (17:56 +0000)]
[MergeFunc] Erase unused duplicate functions if they are discardable

MergeFunc only deletes unused duplicate functions if they have local
linkage, but it should be safe to relax this to any "discardable if
unused" linkage type.

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

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

5 years ago[MergeFunc] Use Instruction::getFunction as a cleanup, NFC
Vedant Kumar [Fri, 11 Jan 2019 17:56:21 +0000 (17:56 +0000)]
[MergeFunc] Use Instruction::getFunction as a cleanup, NFC

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

5 years ago[Jump Threading] Unfold a select insn that feeds a switch via a phi node
Ehsan Amiri [Fri, 11 Jan 2019 15:52:57 +0000 (15:52 +0000)]
[Jump Threading] Unfold a select insn that feeds a switch via a phi node

Currently when a select has a constant value in one branch and the select feeds
a conditional branch (via a compare/ phi and compare) we unfold the select
statement. This results in threading the conditional branch later on. Similar
opportunity exists when a select (with a constant in one branch) feeds a
switch (via a phi node). The patch unfolds select under this condition.
A testcase is provided.

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

5 years ago[x86] allow insert/extract when matching horizontal ops
Sanjay Patel [Fri, 11 Jan 2019 14:27:59 +0000 (14:27 +0000)]
[x86] allow insert/extract when matching horizontal ops

Previously, we limited this transform to cases where the
extraction into the build vector happens from vectors of
the same type as the build vector, but that's not required.

There's a slight potential regression seen in the AVX512
result for phadd -- we're using the 256-bit flavor of the
instruction now even though the 128-bit subset is sufficient.
The same problem could already be seen in the AVX2 result.
Follow-up patches will attempt to narrow that back down.

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

5 years ago[llvm-objcopy] [COFF] Implmement --strip-unneeded and -x/--discard-all for symbols
Martin Storsjo [Fri, 11 Jan 2019 14:13:04 +0000 (14:13 +0000)]
[llvm-objcopy] [COFF] Implmement --strip-unneeded and -x/--discard-all for symbols

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

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

5 years ago[llvm-objcopy] [COFF] Fix writing object files without symbols/string table
Martin Storsjo [Fri, 11 Jan 2019 13:47:37 +0000 (13:47 +0000)]
[llvm-objcopy] [COFF] Fix writing object files without symbols/string table

Previously, this was broken - by setting PointerToSymbolTable to zero
but still actually writing the string table length, the object file
header was corrupted.

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

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

5 years ago[llvm-symbolizer] Add -exe, -e as aliases to -obj
Dmitry Venikov [Fri, 11 Jan 2019 11:51:52 +0000 (11:51 +0000)]
[llvm-symbolizer] Add -exe, -e as aliases to -obj

Summary: Provides -exe, -e as aliases to -obj. Motivation: https://bugs.llvm.org/show_bug.cgi?id=40071

Reviewers: ruiu, rnk, fjricci, jhenderson

Reviewed By: jhenderson

Subscribers: llvm-commits

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

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

5 years agoRevert "[SelectionDAGBuilder] Refactor GetRegistersForValue. NFCI."
Martin Storsjo [Fri, 11 Jan 2019 07:31:17 +0000 (07:31 +0000)]
Revert "[SelectionDAGBuilder] Refactor GetRegistersForValue. NFCI."

This reverts commit r350841, as it actually had functional changes
and broke compilation. See PR40290.

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

5 years ago[X86] Change vXi1 extract_vector_elt lowering to be legal if the index is 0. Add...
Craig Topper [Fri, 11 Jan 2019 05:44:56 +0000 (05:44 +0000)]
[X86] Change vXi1 extract_vector_elt lowering to be legal if the index is 0. Add DAG combine to turn scalar_to_vector+extract_vector_elt into extract_subvector.

We were lowering the last step extract_vector_elt to a bitcast+truncate. Change it to use an extract_vector_elt of index 0 instead. Add isel patterns to do the equivalent of what the bitcast would have done. Plus an isel pattern for an any_extend+extract to prevent some regressions.

Finally add a DAG combine to turn v1i1 scalar_to_vector+extract_vector_elt of 0 into an extract_subvector.

This fixes some of the regressions from D350800.

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

5 years ago[llvm-objdump][MachO] Disable some invalid input tests
Francis Visoiu Mistrih [Thu, 10 Jan 2019 23:46:31 +0000 (23:46 +0000)]
[llvm-objdump][MachO] Disable some invalid input tests

It causes some (but not all) bots to fail. I'll look into it tomorrow
morning. Remove the tests for now to make the bots green.

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

5 years ago[WebAssembly] Fix stack pointer store check in RegStackify
Heejin Ahn [Thu, 10 Jan 2019 23:12:07 +0000 (23:12 +0000)]
[WebAssembly] Fix stack pointer store check in RegStackify

Summary:
We now use __stack_pointer global and global.get/global.set instruction.
This fixes the checking routine for stack_pointer writes accordingly.

This also fixes the existing __stack_pointer test in reg-stackify.ll:
That test used to pass not because of __stack_pointer clashes but
because the function `stackpointer_callee` was not marked as `readnone`,
so it was assumed to possibly write to memory arbitraily, and
`global.set` instruction was marked as `mayStore` in the .td definition,
so they were identified as intervening writes. After we added `readnone`
to its attribute, this test fails without this patch.

Reviewers: dschuff, sunfish

Subscribers: jgravelle-google, sbc100, llvm-commits

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

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

5 years agogn build: Add a template for calling write_cmake_config.py
Nico Weber [Thu, 10 Jan 2019 23:10:04 +0000 (23:10 +0000)]
gn build: Add a template for calling write_cmake_config.py

No behavior change.

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

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

5 years agogn build: Merge r350852
Nico Weber [Thu, 10 Jan 2019 23:05:39 +0000 (23:05 +0000)]
gn build: Merge r350852

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

5 years ago[MSP430] Minor fixes/improvements for assembler/disassembler
Anton Korobeynikov [Thu, 10 Jan 2019 22:59:50 +0000 (22:59 +0000)]
[MSP430] Minor fixes/improvements for assembler/disassembler

* Teach AsmParser to recognize @rn in distination operand as 0(rn).
* Do not allow Disassembler decoding instructions that have size more
  than a number of input bytes.
* Fix UB in MSP430MCCodeEmitter.

Patch by Kristina Bessonova!

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

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

5 years ago[MSP430] Add missing instruction forms
Anton Korobeynikov [Thu, 10 Jan 2019 22:54:53 +0000 (22:54 +0000)]
[MSP430] Add missing instruction forms

* Add missing mm, [r|m]n, [r|m]p instruction forms.
* Fix bit16mc instruction.

Patch by Kristina Bessonova!

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

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

5 years ago[WebAssembly] Add unimplemented-simd128 subtarget feature
Thomas Lively [Thu, 10 Jan 2019 22:32:11 +0000 (22:32 +0000)]
[WebAssembly] Add unimplemented-simd128 subtarget feature

Summary:
This is a third attempt, but this time we have vetted it on Windows
first. The previous errors were due to an uninitialized class member.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, jfb, llvm-commits

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

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

5 years ago[llvm-objcopy] [COFF] Fix a test matching pathnames for Windows. NFC.
Martin Storsjo [Thu, 10 Jan 2019 22:05:21 +0000 (22:05 +0000)]
[llvm-objcopy] [COFF] Fix a test matching pathnames for Windows. NFC.

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

5 years ago[llvm-objcopy] [COFF] Fix warnings abuilt missing field initialization. NFC.
Martin Storsjo [Thu, 10 Jan 2019 21:59:41 +0000 (21:59 +0000)]
[llvm-objcopy] [COFF] Fix warnings abuilt missing field initialization. NFC.

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

5 years agogn build: Use "git rev-parse --git-dir" to discover the path to the .git directory.
Peter Collingbourne [Thu, 10 Jan 2019 21:57:07 +0000 (21:57 +0000)]
gn build: Use "git rev-parse --git-dir" to discover the path to the .git directory.

This makes it compatible with worktrees.

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

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

5 years ago[MachineCombiner][NFC] Prevent dereferencing past-the-end object in an MRI container
Gerolf Hoflehner [Thu, 10 Jan 2019 21:53:13 +0000 (21:53 +0000)]
[MachineCombiner][NFC] Prevent dereferencing past-the-end object in an MRI container

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

5 years ago[MemorySSA] Disable checkClobberSanity for SkipSelfWalker.
Alina Sbirlea [Thu, 10 Jan 2019 21:47:15 +0000 (21:47 +0000)]
[MemorySSA] Disable checkClobberSanity for SkipSelfWalker.

Sanity will fail for this, since we're exploring getting a clobber
further than the sanity check expects.
Ideally we need to teach the sanity check to differentiate between the
two walkers based on the SkipSelf bool in the query.

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

5 years agogn build: Merge r350893
Nico Weber [Thu, 10 Jan 2019 21:47:10 +0000 (21:47 +0000)]
gn build: Merge r350893

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

5 years ago[llvm-objcopy] [COFF] Add support for removing symbols
Martin Storsjo [Thu, 10 Jan 2019 21:28:24 +0000 (21:28 +0000)]
[llvm-objcopy] [COFF] Add support for removing symbols

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

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

5 years agoAvoid use-after-free in ~LegacyRTDyldObjectLinkingLayer
Sanjoy Das [Thu, 10 Jan 2019 20:12:09 +0000 (20:12 +0000)]
Avoid use-after-free in ~LegacyRTDyldObjectLinkingLayer

Reviewers: lhames

Subscribers: mcrosier, jlebar, bixia, llvm-commits

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

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

5 years ago[GVN] Update BlockRPONumber prior to use.
Matt Davis [Thu, 10 Jan 2019 19:56:03 +0000 (19:56 +0000)]
[GVN] Update BlockRPONumber prior to use.

Summary:
The original patch addressed the use of BlockRPONumber by forcing a sequence point when accessing that map in a conditional.  In short we found cases where that map was being accessed with blocks that had not yet been added to that structure.  For context, I've kept the wall of text below,  to what we are trying to fix, by always ensuring a updated BlockRPONumber.

== Backstory ==

I was investigating an ICE (segfault accessing a DenseMap item).  This failure happened non-deterministically, with no apparent reason and only on a Windows build of LLVM (from October 2018).

After looking into the crashes (multiple core files) and running DynamoRio, the cores and DynamoRio (DR) log pointed to the same code in `GVN::performScalarPRE()`. The values in the map are unsigned integers, the keys are `llvm::BasicBlock*`.  Our test case that triggered this warning and periodic crash is rather involved.  But the problematic line looks to be:

GVN.cpp: Line 2197

```
     if (BlockRPONumber[P] >= BlockRPONumber[CurrentBlock] &&
```

To test things out, I cooked up a patch that accessed the items in the map outside of the condition, by forcing a sequence point between accesses. DynamoRio stopped warning of the issue, and the test didn't seem to crash after 1000+ runs.

My investigation was on an older version of LLVM, (source from October this year). What it looks like was occurring is the following, and the assembly from the latest pull of llvm in December seems to confirm this might still be an issue; however, I have not witnessed the crash on more recent builds. Of course the asm in question is generated from the host compiler on that Windows box (not clang), but it hints that we might want to consider how we access the BlockRPONumber map in this conditional (line 2197, listed above).  In any case, I don't think the host compiler is wrong, rather I think it is pointing out a possibly latent bug in llvm.

1) There is no sequence point for the `>=` operation.

2) A call to a `DenseMapBase::operator[]` can have the side effect of the map reallocating a larger store (more Buckets, via a call to `DenseMap::grow`).

3) It seems perfectly legal for a host compiler to generate assembly that stores the result of a call to `operator[]` on the stack (that's what my host compile of GVN.cpp is doing) .  A second call to `operator[]` //might// encourage the map to 'grow' thus making any pointers to the map's store invalid.  The `>=` compares the first and second values. If the first happens to be a pointer produced from operator[], it could be invalid when dereferenced at the time of comparison.

The assembly generated from the Window's host compiler does show the result of the first access to the map via `operator[]` produces a pointer to an unsigned int.  And that pointer is being stored on  the stack.  If a second call to the map (which does occur) causes the map to grow, that address (on the stack) is now invalid.

Reviewers: t.p.northover, efriedma

Reviewed By: efriedma

Subscribers: efriedma, llvm-commits

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

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

5 years agoUse MemorySSA in LICM to do sinking and hoisting.
Alina Sbirlea [Thu, 10 Jan 2019 19:29:04 +0000 (19:29 +0000)]
Use MemorySSA in LICM to do sinking and hoisting.

Summary:
Step 2 in using MemorySSA in LICM:
Use MemorySSA in LICM to do sinking and hoisting, all under "EnableMSSALoopDependency" flag.
Promotion is disabled.

Enable flag in LICM sink/hoist tests to test correctness of this change. Moved one test which
relied on promotion, in order to test all sinking tests.

Reviewers: sanjoy, davide, gberry, george.burgess.iv

Subscribers: llvm-commits, Prazek

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

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

5 years ago[X86] Call SimplifyDemandedBits on conditions of X86ISD::SHRUNKBLEND
Craig Topper [Thu, 10 Jan 2019 19:05:34 +0000 (19:05 +0000)]
[X86] Call SimplifyDemandedBits on conditions of X86ISD::SHRUNKBLEND

This extends to combineVSelectToShrunkBlend to be able to resimplify SHRUNKBLENDS that have already been created.

This should help some of the regressions from D56387

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

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

5 years ago[X86] Simplify the BRCOND handling for FCMP_UNE.
Craig Topper [Thu, 10 Jan 2019 19:02:14 +0000 (19:02 +0000)]
[X86] Simplify the BRCOND handling for FCMP_UNE.

Despite what the comment says, FCMP_UNE would be an OR not an AND. In the lowering code the first branch created still goes to the original destination. The second branch was exchanged to go to where the subsequent unconditional branch went. This is different than what we do for FCMP_OEQ where both branches that we create go to the original unconditional branch.

As far as I can tell, I think this means we don't need to exchange the branch target with the unconditional branch for FCMP_UNE at all.

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

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

5 years ago[llvm-objdump][MachO] Fix test to work on Windows
Francis Visoiu Mistrih [Thu, 10 Jan 2019 18:32:30 +0000 (18:32 +0000)]
[llvm-objdump][MachO] Fix test to work on Windows

This fails in http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/3208/steps/stage%201%20check/logs/stdio.

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

5 years ago[lit] Make it possible for the lit test suite to pass with
Dan Liew [Thu, 10 Jan 2019 17:47:44 +0000 (17:47 +0000)]
[lit] Make it possible for the lit test suite to pass with
`FILECHECK_OPTS=-v` set in the environment.

Follow up to r350850 as requested by Joel E. Denny in
https://reviews.llvm.org/D56541 .

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

5 years ago[llvm-objdump][MachO] Fix error reporting after r350848 and r350849
Francis Visoiu Mistrih [Thu, 10 Jan 2019 17:36:54 +0000 (17:36 +0000)]
[llvm-objdump][MachO] Fix error reporting after r350848 and r350849

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

5 years ago[FileCheck] Don't propagate `FILECHECK_DUMP_INPUT_ON_FAILURE` and
Dan Liew [Thu, 10 Jan 2019 17:24:06 +0000 (17:24 +0000)]
[FileCheck] Don't propagate `FILECHECK_DUMP_INPUT_ON_FAILURE` and
`FILECHECK_OPTS` into environment for FileCheck tests.

Summary:

This fixes the following FileCheck tests:

* FileCheck/dump-input-enable.txt
* FileCheck/match-full-lines.txt

when `FILECHECK_DUMP_INPUT_ON_FAILURE` is set in the environment.

By default llvm-lit propagates `FILECHECK_DUMP_INPUT_ON_FAILURE` and
`FILECHECK_OPTS` from llvm-lit's environment into the test environment.
Unfortunately this can break FileCheck's tests because they expect that
these environment variables not to be set.

rdar://problem/47176262

Reviewers: jdenny, probinson, george.karpenkov

Subscribers: llvm-commits

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

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

5 years ago[llvm-objdump][MachO] Use the -dsym file name when reporting errors
Francis Visoiu Mistrih [Thu, 10 Jan 2019 17:16:42 +0000 (17:16 +0000)]
[llvm-objdump][MachO] Use the -dsym file name when reporting errors

Instead of using the binary filename.

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

5 years ago[llvm-objdump][MachO] Correctly handle the llvm::Error when -dsym has errors
Francis Visoiu Mistrih [Thu, 10 Jan 2019 17:16:37 +0000 (17:16 +0000)]
[llvm-objdump][MachO] Correctly handle the llvm::Error when -dsym has errors

In an assert build, the Error gets destroyed and we get "Program aborted
due to an unhandled Error:".

In release, we get an empty message.

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