OSDN Git Service

android-x86/external-llvm.git
6 years ago[TableGen] Combine two constructors by taking vectors by value instead of trying...
Craig Topper [Sun, 10 Jun 2018 23:15:48 +0000 (23:15 +0000)]
[TableGen] Combine two constructors by taking vectors by value instead of trying to support combininations for rvalue and lvalue references.

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

6 years ago[DAGCombiner] match vector compare and select sizes with extload operand (PR37427)
Sanjay Patel [Sun, 10 Jun 2018 23:09:50 +0000 (23:09 +0000)]
[DAGCombiner] match vector compare and select sizes with extload operand (PR37427)

This patch started off much more general and ambitious, but it's been a nightmare
seeing all the ways x86 vector codegen can go wrong.

So the code is still structured to allow extending easily, but it's currently
limited in several ways:

1. Only handle cases with an extending load.
2. Only handle cases with a zero constant compare.
3. Ignore setcc with vector bitmask (SetCCWidth != 1) - so AVX512 should be unaffected.

The motivating case from PR37427:
https://bugs.llvm.org/show_bug.cgi?id=37427
...is the 1st test, and that shows the expected win - we eliminated the unnecessary
intermediate cast.

There's a clear regression in the last test (sgt_zero_fp_select) because we longer
recognize a 'SHRUNKBLEND' opportunity. I think that general problem is also present
in sgt_zero, so I'll try to fix that in a follow-up. We need to match a sign-bit
setcc from a sign-extended operand and remove it.

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

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

6 years ago[X86] Miscellaneous fixes to get the load folding table generator to work again.
Craig Topper [Sun, 10 Jun 2018 21:48:24 +0000 (21:48 +0000)]
[X86] Miscellaneous fixes to get the load folding table generator to work again.

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

6 years agoRevert r334374 [TableGen] Move some shared_ptrs to avoid unnecessary copies (NFC).
Florian Hahn [Sun, 10 Jun 2018 21:06:24 +0000 (21:06 +0000)]
Revert r334374 [TableGen] Move some shared_ptrs to avoid unnecessary copies (NFC).

This breaks some builders.

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

6 years agoAttempt 3: Resubmit "[Support] Expose flattenWindowsCommandLine."
Zachary Turner [Sun, 10 Jun 2018 20:57:14 +0000 (20:57 +0000)]
Attempt 3: Resubmit "[Support] Expose flattenWindowsCommandLine."

I took some liberties and quoted fewer characters than before,
based on an article from MSDN which says that only certain characters
cause an arg to require quoting.  This seems to be incorrect, though,
and worse it seems to be a difference in Windows version.  The bot
that fails is Windows 7, and I can't reproduce the failure on Win
10.  But it's definitely related to quoting and special characters,
because both tests that fail have a * in the argument, which is one
of the special characters that would cause an argument to be quoted
before but not any longer after the new patch.

Since I don't have Win 7, all I can do is just guess that I need to
restore the old quoting rules.  So this patch does that in hopes that
it fixes the problem on Windows 7.

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

6 years ago[TableGen] Move some shared_ptrs to avoid unnecessary copies (NFC).
Florian Hahn [Sun, 10 Jun 2018 20:38:52 +0000 (20:38 +0000)]
[TableGen] Move some shared_ptrs to avoid unnecessary copies (NFC).

Those changes were suggested post-commit for D47463.

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

6 years agoRevert rL334371 / D47980: "[InstCombine] Fold (x << y) >> y -> x & (-1 >> y)"
Roman Lebedev [Sun, 10 Jun 2018 20:32:03 +0000 (20:32 +0000)]
Revert rL334371 / D47980: "[InstCombine] Fold (x << y) >> y  ->  x & (-1 >> y)"

test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll broke,
and i did not notice because i did not build that backend.

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

6 years ago[InstCombine] Fold (x >> y) << y -> x & (-1 << y)
Roman Lebedev [Sun, 10 Jun 2018 20:10:13 +0000 (20:10 +0000)]
[InstCombine] Fold (x >> y) << y  ->  x & (-1 << y)

Summary:
We already do it for matching splat constants, but not just values.

Further improvements for non-matching splat constants, as noted in
https://reviews.llvm.org/D46760#1123713 will be needed,
but i'd prefer to do that as a follow-up.

https://bugs.llvm.org/show_bug.cgi?id=37603
https://rise4fun.com/Alive/cplX
https://rise4fun.com/Alive/0HF

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

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

6 years ago[InstCombine] Fold (x << y) >> y -> x & (-1 >> y)
Roman Lebedev [Sun, 10 Jun 2018 20:10:06 +0000 (20:10 +0000)]
[InstCombine] Fold (x << y) >> y  ->  x & (-1 >> y)

Summary:
We already do it for splat constants, but not just values.
Also, undef cases are mostly non-functional.

https://bugs.llvm.org/show_bug.cgi?id=37603
https://rise4fun.com/Alive/cplX

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

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

6 years ago[NFC][InstCombine] Revisit tests for D47980 / D47981 once more.
Roman Lebedev [Sun, 10 Jun 2018 20:10:00 +0000 (20:10 +0000)]
[NFC][InstCombine] Revisit tests for D47980 / D47981 once more.

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

6 years ago[X86] Add expandload and compresstore fast-isel tests for avx512f and avx512vl. Updat...
Craig Topper [Sun, 10 Jun 2018 18:55:37 +0000 (18:55 +0000)]
[X86] Add expandload and compresstore fast-isel tests for avx512f and avx512vl. Update existing tests for avx512vbmi2 to use target independent intrinsics.

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

6 years ago[x86] add tests for potentially miscompiling cvttp2si (PR37751); NFC
Sanjay Patel [Sun, 10 Jun 2018 17:42:12 +0000 (17:42 +0000)]
[x86] add tests for potentially miscompiling cvttp2si (PR37751); NFC

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

6 years ago[X86] Remove GCCBuiltin from some intrinsics so we can custom handle them in clang.
Craig Topper [Sun, 10 Jun 2018 17:27:00 +0000 (17:27 +0000)]
[X86] Remove GCCBuiltin from some intrinsics so we can custom handle them in clang.

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

6 years ago[NEON] Support VST1xN intrinsics in AArch32 mode (LLVM part)
Ivan A. Kosarev [Sun, 10 Jun 2018 09:27:27 +0000 (09:27 +0000)]
[NEON] Support VST1xN intrinsics in AArch32 mode (LLVM part)

We currently support them only in AArch64. The NEON Reference,
however, says they are 'ARMv7, ARMv8' intrinsics.

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

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

6 years ago[X86] Fix forward declaration in a test case that was messed up in r334358
Craig Topper [Sun, 10 Jun 2018 06:43:48 +0000 (06:43 +0000)]
[X86] Fix forward declaration in a test case that was messed up in r334358

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

6 years ago[X86] Remove masking from the 512-bit masked floating point add/sub/mul/div intrinsic...
Craig Topper [Sun, 10 Jun 2018 06:01:36 +0000 (06:01 +0000)]
[X86] Remove masking from the 512-bit masked floating point add/sub/mul/div intrinsics. Use a select in IR instead.

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

6 years agoCleanup. NFC
Fangrui Song [Sun, 10 Jun 2018 04:53:14 +0000 (04:53 +0000)]
Cleanup. NFC

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

6 years agoRevert "Resubmit "[Support] Expose flattenWindowsCommandLine.""
Zachary Turner [Sun, 10 Jun 2018 03:16:25 +0000 (03:16 +0000)]
Revert "Resubmit "[Support] Expose flattenWindowsCommandLine.""

This reverts commit 65243b6d19143cb7a03f68df0169dcb63e8b4632.

Seems like it's not a flake.  It might have something to do with
the '*' character being in a command line.

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

6 years agoResubmit "[Support] Expose flattenWindowsCommandLine."
Zachary Turner [Sun, 10 Jun 2018 02:46:11 +0000 (02:46 +0000)]
Resubmit "[Support] Expose flattenWindowsCommandLine."

There were a few linux compilation failures, but other than that
I think this was just a flake that caused the tests to fail.  I'm
going to resubmit and see if the failures go away, if not I'll
revert again.

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

6 years agoRevert "[Support] Expose flattenWindowsCommandLine."
Zachary Turner [Sat, 9 Jun 2018 23:07:39 +0000 (23:07 +0000)]
Revert "[Support] Expose flattenWindowsCommandLine."

This reverts commit 10d2e88e87150a35dc367ba30716189d2af26774.

This is causing some test failures for some reason, reverting
while I investigate.

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

6 years ago[Support] Expose flattenWindowsCommandLine.
Zachary Turner [Sat, 9 Jun 2018 22:44:44 +0000 (22:44 +0000)]
[Support] Expose flattenWindowsCommandLine.

This function was internal to Program.inc, but I've needed this
on several occasions when I've had to use CreateProcess without
llvm's sys::Execute functions.  In doing so, I noticed that the
function was written using unsafe C-string access and was pretty
hard to understand / make sense of, so I've also re-written the
functions to use more modern LLVM constructs.

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

6 years ago[CostModel][X86] Add 'select' style shuffle costs tests (PR33744)
Simon Pilgrim [Sat, 9 Jun 2018 16:08:25 +0000 (16:08 +0000)]
[CostModel][X86] Add 'select' style shuffle costs tests (PR33744)

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

6 years ago[NFC][InstCombine] More tests for (x >> y) << y -> x & (-1 << y) fold.
Roman Lebedev [Sat, 9 Jun 2018 14:01:46 +0000 (14:01 +0000)]
[NFC][InstCombine] More tests for  (x >> y) << y  ->  x & (-1 << y)  fold.

Followup for rL334347.
The fold is also valid for ashr.
https://rise4fun.com/Alive/0HF

https://bugs.llvm.org/show_bug.cgi?id=37603
https://reviews.llvm.org/D46760#1123713
https://rise4fun.com/Alive/cplX

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

6 years ago[NFC][InstCombine] Tests for (x >> y) << y -> x & (-1 << y) fold.
Roman Lebedev [Sat, 9 Jun 2018 09:27:43 +0000 (09:27 +0000)]
[NFC][InstCombine] Tests for  (x >> y) << y  ->  x & (-1 << y)  fold.

We already do it for splat constants, but not just values.
Also, undef cases are mostly non-functional.

https://bugs.llvm.org/show_bug.cgi?id=37603
https://reviews.llvm.org/D46760#1123713
https://rise4fun.com/Alive/cplX

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

6 years ago[NFC][InstCombine] Tests for (x << y) >> y -> x & (-1 >> y) fold.
Roman Lebedev [Sat, 9 Jun 2018 09:27:39 +0000 (09:27 +0000)]
[NFC][InstCombine] Tests for  (x << y) >> y  ->  x & (-1 >> y)  fold.

We already do it for splat constants, but not just values.
Also, undef cases are mostly non-functional.

https://bugs.llvm.org/show_bug.cgi?id=37603
https://rise4fun.com/Alive/cplX

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

6 years ago[X86] NFC Use member initialization in X86Subtarget
Gabor Buella [Sat, 9 Jun 2018 09:19:40 +0000 (09:19 +0000)]
[X86] NFC Use member initialization in X86Subtarget

The separate initializeEnvironment function was sort of
useless since r217071.
ARM did this move already with r273556.

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

6 years agoUse uniform mechanism for OOM errors handling
Serge Pavlov [Sat, 9 Jun 2018 05:19:45 +0000 (05:19 +0000)]
Use uniform mechanism for OOM errors handling

This is a recommit of r333506, which was reverted in r333518.
The original commit message is below.

In r325551 many calls of malloc/calloc/realloc were replaces with calls of
their safe counterparts defined in the namespace llvm. There functions
generate crash if memory cannot be allocated, such behavior facilitates
handling of out of memory errors on Windows.

If the result of *alloc function were checked for success, the function was
not replaced with the safe variant. In these cases the calling function made
the error handling, like:

    T *NewElts = static_cast<T*>(malloc(NewCapacity*sizeof(T)));
    if (NewElts == nullptr)
      report_bad_alloc_error("Allocation of SmallVector element failed.");

Actually knowledge about the function where OOM occurred is useless. Moreover
having a single entry point for OOM handling is convenient for investigation
of memory problems. This change removes custom OOM errors handling and
replaces them with calls to functions `llvm::safe_*alloc`.

Declarations of `safe_*alloc` are moved to a separate include file, to avoid
cyclic dependency in SmallVector.h

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

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

6 years agoUse SmallPtrSet instead of SmallSet in places where we iterate over the set.
Craig Topper [Sat, 9 Jun 2018 05:04:20 +0000 (05:04 +0000)]
Use SmallPtrSet instead of SmallSet in places where we iterate over the set.

SmallSet forwards to SmallPtrSet for pointer types. SmallPtrSet supports iteration, but a normal SmallSet doesn't. So if it wasn't for the forwarding, this wouldn't work.

These places were found by hiding the begin/end methods in the SmallSet forwarding

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

6 years ago[tablegen] Improve performance on *GenRegisterInfo.inc by replacing SparseVector...
Daniel Sanders [Fri, 8 Jun 2018 23:12:29 +0000 (23:12 +0000)]
[tablegen] Improve performance on *GenRegisterInfo.inc by replacing SparseVector with BitVector. NFC

Summary: Generating X86GenRegisterInfo.inc and AArch64GenRegisterInfo.inc is 8-9% faster on my build.

Reviewers: bogner, javed.absar

Reviewed By: bogner

Subscribers: llvm-commits, kristof.beyls

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

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

6 years ago[X86] Remove GCCBuiltin from some intrinsics so we can do custom IR generation from...
Craig Topper [Fri, 8 Jun 2018 21:49:09 +0000 (21:49 +0000)]
[X86] Remove GCCBuiltin from some intrinsics so we can do custom IR generation from clang.

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

6 years ago[LangRef] fptosi and fptoui return poison on overflow.
Eli Friedman [Fri, 8 Jun 2018 21:33:33 +0000 (21:33 +0000)]
[LangRef] fptosi and fptoui return poison on overflow.

I think we assume poison, not undef, for certain transforms we
currently do. In any case, we should clarify the language here.

(This sort of conversion is undefined behavior according to the C
and C++ standards. And in practice, hardware implementations handle
overflow inconsistently, so it would be difficult to define the
result here.)

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

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

6 years ago[LangRef] insertelement/extractelement return poison for out of range.
Eli Friedman [Fri, 8 Jun 2018 21:23:09 +0000 (21:23 +0000)]
[LangRef] insertelement/extractelement return poison for out of range.

We need to clarify the language here. I think poison makes more sense
than undef, since it's an undefined operation rather than uninitialized
memory. I don't think anything depends on the difference at the moment,
though.

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

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

6 years agoTest commit: remove a blank line
Ryan Prichard [Fri, 8 Jun 2018 21:21:55 +0000 (21:21 +0000)]
Test commit: remove a blank line

Test commit access

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

6 years ago[ARM] Allow CMPZ transforms even if the input has multiple uses.
Eli Friedman [Fri, 8 Jun 2018 21:16:56 +0000 (21:16 +0000)]
[ARM] Allow CMPZ transforms even if the input has multiple uses.

It looks like this got left in by accident in r289794; I can't think of
any reason this check would be necessary.  (Maybe it was meant to be a
check that the AND has one use? But we check that a few lines earlier.)

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

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

6 years ago[SmallSet] Add some simple unit tests.
Florian Hahn [Fri, 8 Jun 2018 21:14:49 +0000 (21:14 +0000)]
[SmallSet] Add some simple unit tests.

Reviewers: craig.topper, dblaikie

Reviewed By: dblaikie

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

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

6 years ago[SCEV] Look through zero-extends in howFarToZero
Krzysztof Parzyszek [Fri, 8 Jun 2018 20:43:07 +0000 (20:43 +0000)]
[SCEV] Look through zero-extends in howFarToZero

An expression like
  (zext i2 {(trunc i32 (1 + %B) to i2),+,1}<%while.body> to i32)
will become zero exactly when the nested value becomes zero in its type.
Strip injective operations from the input value in howFarToZero to make
the value simpler.

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

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

6 years ago[InstCombine] Skip dbg.value(s) when looking at stack{save,restore}.
Davide Italiano [Fri, 8 Jun 2018 20:42:36 +0000 (20:42 +0000)]
[InstCombine] Skip dbg.value(s) when looking at stack{save,restore}.

Fixes PR37713.

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

6 years ago[InstCombine] add llvm.assume + debuginfo test (PR37726); NFC
Sanjay Patel [Fri, 8 Jun 2018 18:47:33 +0000 (18:47 +0000)]
[InstCombine] add llvm.assume + debuginfo test (PR37726); NFC

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

6 years ago[asan] Instrument comdat globals on COFF targets
Reid Kleckner [Fri, 8 Jun 2018 18:33:16 +0000 (18:33 +0000)]
[asan] Instrument comdat globals on COFF targets

Summary:
If we can use comdats, then we can make it so that the global metadata
is thrown away if the prevailing definition of the global was
uninstrumented. I have only tested this on COFF targets, but in theory,
there is no reason that we cannot also do this for ELF.

This will allow us to re-enable string merging with ASan on Windows,
reducing the binary size cost of ASan on Windows.

Reviewers: eugenis, vitalybuka

Subscribers: hiraditya, llvm-commits

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

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

6 years ago[DAGCombiner] clean up comments; NFC
Sanjay Patel [Fri, 8 Jun 2018 18:00:46 +0000 (18:00 +0000)]
[DAGCombiner] clean up comments; NFC

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

6 years ago[X86][SSE] Support v8i16/v16i16 rotations
Simon Pilgrim [Fri, 8 Jun 2018 17:58:42 +0000 (17:58 +0000)]
[X86][SSE] Support v8i16/v16i16 rotations

Extension to D46954 (PR37426), this patch adds support for v8i16/v16i16 rotations in a similar manner - the conversion of the shift/rotate amount to a multiplication factor and the use of PMULLW to shift left and PMULHUW (ISD::MULHU) to shift the wrapped bits back around to be ORd together.

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

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

6 years ago[x86] add tests for node-level FMF; NFC
Sanjay Patel [Fri, 8 Jun 2018 17:54:28 +0000 (17:54 +0000)]
[x86] add tests for node-level FMF; NFC

These cases should be optimized using the change from D47911.

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

6 years ago[x86] regenerate test checks; NFC
Sanjay Patel [Fri, 8 Jun 2018 17:42:35 +0000 (17:42 +0000)]
[x86] regenerate test checks; NFC

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

6 years agoUtilize new SDNode flag functionality to expand current support for fsub
Michael Berg [Fri, 8 Jun 2018 17:39:50 +0000 (17:39 +0000)]
Utilize new SDNode flag functionality to expand current support for fsub

Summary: This patch originated from D46562 and is a proper subset, with some issues addressed for fsub.

Reviewers: spatel, hfinkel, wristow, arsenm

Reviewed By: spatel

Subscribers: wdng

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

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

6 years ago[VPlan] Move recipe construction to VPRecipeBuilder.
Florian Hahn [Fri, 8 Jun 2018 17:30:45 +0000 (17:30 +0000)]
[VPlan] Move recipe construction to VPRecipeBuilder.

This patch moves the recipe-creation functions out of
LoopVectorizationPlanner, which should do the high-level
orchestration of the transformations.

Reviewers: dcaballe, rengolin, hsaito, Ayal

Reviewed By: dcaballe

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

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

6 years ago[X86][BtVer2] Add support for all SUB/XOR 32/64 scalar instructions that should match...
Simon Pilgrim [Fri, 8 Jun 2018 17:00:45 +0000 (17:00 +0000)]
[X86][BtVer2] Add support for all SUB/XOR 32/64 scalar instructions that should match the dependency-breaking 'zero-idiom'

As detailed on Agner's Microarchitecture doc (21.8 AMD Bobcat and Jaguar pipeline - Dependency-breaking instructions), these instructions are dependency breaking and fast-path zero the destination register (and appropriate EFLAGS bits).

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

6 years ago[X86] Fix schedule-x86_64.s tests to use different registers in reg-reg cases
Simon Pilgrim [Fri, 8 Jun 2018 16:40:15 +0000 (16:40 +0000)]
[X86] Fix schedule-x86_64.s tests to use different registers in reg-reg cases

Same fix as rL334110: I noticed while working on zero-idiom + dependency-breaking support (PR36671) that most of our binary instruction schedule tests were reusing the same src registers, which would cause the tests to fail once we enable scalar zero-idiom support on btver2.

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

6 years ago[AMDGPU] Inline asm - added i16, half and i128 types support
Daniil Fukalov [Fri, 8 Jun 2018 16:29:04 +0000 (16:29 +0000)]
[AMDGPU] Inline asm - added i16, half and i128 types support

AMDGPU inline assembler support i16, half and i128 typed variables in constraints, but they were reported as error.
Needed to fix https://github.com/RadeonOpenCompute/ROCm/issues/341,
e.g. to be able to load with global_load_dwordx4 to a 128bit integer variable

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

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

6 years agoreapply r334209 with fixes for harfbuzz in Chromium
Daniil Fukalov [Fri, 8 Jun 2018 16:22:52 +0000 (16:22 +0000)]
reapply r334209 with fixes for harfbuzz in Chromium

r334209 description:
[LSR] Check yet more intrinsic pointer operands

the patch fixes another assertion in isLegalUse()

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

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

6 years ago[NFC][InstSimplify] SimplifyAddInst(): coding style: variable names.
Roman Lebedev [Fri, 8 Jun 2018 15:44:53 +0000 (15:44 +0000)]
[NFC][InstSimplify] SimplifyAddInst(): coding style: variable names.

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

6 years ago[InstSimplify] add nuw %x, -1 -> -1 fold.
Roman Lebedev [Fri, 8 Jun 2018 15:44:47 +0000 (15:44 +0000)]
[InstSimplify] add nuw %x, -1 -> -1 fold.

Summary:
`%ret = add nuw i8 %x, C`
From [[ https://llvm.org/docs/LangRef.html#add-instruction | langref ]]:
    nuw and nsw stand for “No Unsigned Wrap” and “No Signed Wrap”,
    respectively. If the nuw and/or nsw keywords are present,
    the result value of the add is a poison value if unsigned
    and/or signed overflow, respectively, occurs.

So if `C` is `-1`, `%x` can only be `0`, and the result is always `-1`.

I'm not sure we want to use `KnownBits`/`LVI` here, because there is
exactly one possible value (all bits set, `-1`), so some other pass
should take care of replacing the known-all-ones with constant `-1`.

The `test/Transforms/InstCombine/set-lowbits-mask-canonicalize.ll` change *is* confusing.
What happening is, before this: (omitting `nuw` for simplicity)
1. First, InstCombine D47428/rL334127 folds `shl i32 1, %NBits`) to `shl nuw i32 -1, %NBits`
2. Then, InstSimplify D47883/rL334222 folds `shl nuw i32 -1, %NBits` to `-1`,
3. `-1` is inverted to `0`.
But now:
1. *This* InstSimplify fold `%ret = add nuw i32 %setbit, -1` -> `-1` happens first,
   before InstCombine D47428/rL334127 fold could happen.
Thus we now end up with the opposite constant,
and it is all good: https://rise4fun.com/Alive/OA9

https://rise4fun.com/Alive/sldC
Was mentioned in D47428 review.
Follow-up for D47883.

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

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

6 years ago[X86][BtVer2] Remove SBB tests that were accidentally added in rL334296
Simon Pilgrim [Fri, 8 Jun 2018 15:43:00 +0000 (15:43 +0000)]
[X86][BtVer2] Remove SBB tests that were accidentally added in rL334296

These aren't true zero-idiom instructions (just dependency breaking).

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

6 years ago[X86][BtVer2] Add tests for scalar SUB/XOR instructions that should match the depende...
Simon Pilgrim [Fri, 8 Jun 2018 15:28:43 +0000 (15:28 +0000)]
[X86][BtVer2] Add tests for scalar SUB/XOR instructions that should match the dependency-breaking 'zero-idiom'

As detailed on Agner's Microarchitecture doc (21.8 AMD Bobcat and Jaguar pipeline - Dependency-breaking instructions).

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

6 years agocommandLineFitsWithinSystemLimits Overestimates System Limits
Alexander Kornienko [Fri, 8 Jun 2018 15:19:16 +0000 (15:19 +0000)]
commandLineFitsWithinSystemLimits Overestimates System Limits

Summary:
The function `llvm::sys::commandLineFitsWithinSystemLimits` appears to be overestimating the system limits. This issue was discovered while attempting to enable response files in the Swift compiler. When the compiler submits its frontend jobs, those jobs are subjected to the system limits on command line length. `commandLineFitsWithinSystemLimits` is used to determine if the job's arguments need to be wrapped in a response file. There are some cases where the argument size for the job passes `commandLineFitsWithinSystemLimits`, but actually exceeds the real system limit, and the job fails.

`clang` also uses this function to decide whether or not to wrap it's job arguments in response files. See: https://github.com/llvm-mirror/clang/blob/master/lib/Driver/Driver.cpp#L1341. Clang will also fail for response files who's size falls within a certain range. I wrote a script that should find a failure point for `clang++`. All that is needed to run it is Python 2.7, and a simple "hello world" program for `test.cc`. It should run on Linux and on macOS. The script is available here: https://gist.github.com/dabelknap/71bd083cd06b91c5b3cef6a7f4d3d427. When it hits a failure point, you should see a `clang: error: unable to execute command: posix_spawn failed: Argument list too long`.

The proposed solution is to mirror the behavior of `xargs` in `commandLinefitsWithinSystemLimits`. `xargs` defaults to 128k for the command line length size (See: https://fossies.org/dox/findutils-4.6.0/buildcmd_8c_source.html#l00551). It adjusts this depending on the value of `ARG_MAX`.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: llvm-commits

Tags: #clang

Patch by Austin Belknap!

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

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

6 years agoClean up some code in Program.
Zachary Turner [Fri, 8 Jun 2018 15:16:25 +0000 (15:16 +0000)]
Clean up some code in Program.

NFC here, this just raises some platform specific ifdef hackery
out of a class and creates proper platform-independent typedefs
for the relevant things.  This allows these typedefs to be
reused in other places without having to reinvent this preprocessor
logic.

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

6 years agoAdd a file open flag that disables O_CLOEXEC.
Zachary Turner [Fri, 8 Jun 2018 15:15:56 +0000 (15:15 +0000)]
Add a file open flag that disables O_CLOEXEC.

O_CLOEXEC is the right default, but occasionally you don't
want this.  This is especially true for tools like debuggers
where you might need to spawn the child process with specific
files already open, but it's occasionally useful in other
scenarios as well, like when you want to do some IPC between
parent and child.

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

6 years ago[X86][BtVer2] Limit zero idiom tests to a single iteration.
Simon Pilgrim [Fri, 8 Jun 2018 15:01:40 +0000 (15:01 +0000)]
[X86][BtVer2] Limit zero idiom tests to a single iteration.

Reduces output size and we're only wanting to check that the instructions are fast-path'd (just Dispatch+Retire) anyhow

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

6 years agoFix Wdocumentation warning for unknown param. NFCI.
Simon Pilgrim [Fri, 8 Jun 2018 14:53:52 +0000 (14:53 +0000)]
Fix Wdocumentation warning for unknown param. NFCI.

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

6 years ago[X86][SSE] Add SSE2/AVX2 vector rotate tests
Simon Pilgrim [Fri, 8 Jun 2018 14:07:21 +0000 (14:07 +0000)]
[X86][SSE] Add SSE2/AVX2 vector rotate tests

Now that we're custom lowering vector rotates for SSE in general we should be testing the combines with them as well.

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

6 years ago[X86][SSE] Simplify combineVectorTruncationWithPACKUS to reduce code duplication
Simon Pilgrim [Fri, 8 Jun 2018 13:59:11 +0000 (13:59 +0000)]
[X86][SSE] Simplify combineVectorTruncationWithPACKUS to reduce code duplication

Simplify combineVectorTruncationWithPACKUS to mask the upper bits followed by calling truncateVectorWithPACK instead of duplicating with similar code.

This results in the codegen using (V)PACKUSDW on SSE41+ targets for vXi64/vXi32 inputs where before it always used PACKUSWB (along with a lot more bitcasting).

I've raised PR37749 as until we avoid unnecessary concats back to 256-bit for bitwise ops, we can't avoid splitting the input value into 128-bit subvectors for masking.

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

6 years ago[x86] restore test comment; NFC
Sanjay Patel [Fri, 8 Jun 2018 13:53:13 +0000 (13:53 +0000)]
[x86] restore test comment; NFC

The description got deleted along with the FIXME note in
rL334268.

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

6 years ago[BPI] Apply invoke heuristic before loop branch heuristic
Artur Pilipenko [Fri, 8 Jun 2018 13:03:21 +0000 (13:03 +0000)]
[BPI] Apply invoke heuristic before loop branch heuristic

Currently the loop branch heuristic is applied before the invoke heuristic which makes us overestimate the probability of the unwind destination of invokes inside loops. This in turn makes us grossly underestimate the frequencies of loops with invokes.

Reviewed By: skatkov, vsk

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

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

6 years ago[VPlan] Move recipe based VPlan generation to separate function.
Florian Hahn [Fri, 8 Jun 2018 12:53:51 +0000 (12:53 +0000)]
[VPlan] Move recipe based VPlan generation to separate function.

This first step separates VPInstruction-based and VPRecipe-based
VPlan creation, which should make it easier to migrate to VPInstruction
based code-gen step by step.

Reviewers: Ayal, rengolin, dcaballe, hsaito, mkuper, mzolotukhin

Reviewed By: dcaballe

Subscribers: bollu, tschuett, rkruppe, llvm-commits

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

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

6 years ago[ADT] Add `StringRef::rsplit(StringRef Separator)`.
Henry Wong [Fri, 8 Jun 2018 12:42:12 +0000 (12:42 +0000)]
[ADT] Add `StringRef::rsplit(StringRef Separator)`.

Summary: Add `StringRef::rsplit(StringRef Separator)` to achieve the function of getting the tail substring according to the separator. A typical usage is to get `data` in `std::basic_string::data`.

Reviewers: mehdi_amini, zturner, beanz, xbolva00, vsk

Reviewed By: zturner, xbolva00, vsk

Subscribers: vsk, xbolva00, llvm-commits, MTC

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

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

6 years ago[mips] Correct the predicates for a number of codegen only instructions
Simon Dardis [Fri, 8 Jun 2018 10:55:34 +0000 (10:55 +0000)]
[mips] Correct the predicates for a number of codegen only instructions

Reviewers: smaksimovic, atanasyan, abeserminji

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

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

6 years ago[RISCV] Implement MC layer support for the fence.tso instruction
Alex Bradbury [Fri, 8 Jun 2018 10:39:05 +0000 (10:39 +0000)]
[RISCV] Implement MC layer support for the fence.tso instruction

The instruction makes use of a previously ignored field in the fence
instruction. It is introduced in the version 2.3 draft of the RISC-V
specification after much work by the Memory Model Task Group.

As clarified here <https://github.com/riscv/riscv-isa-manual/issues/186>,
the fence.tso assembler mnemonic does not have operands.

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

6 years ago[X86][SSE] Consistently prefer lowering to PACKUS over PACKSS
Simon Pilgrim [Fri, 8 Jun 2018 10:29:00 +0000 (10:29 +0000)]
[X86][SSE] Consistently prefer lowering to PACKUS over PACKSS

We have some combines/lowerings that attempt to use PACKSS-then-PACKUS and others that use PACKUS-then-PACKSS.

PACKUS is much easier to combine with if we know the upper bits are zero as ComputeKnownBits can easily see through BITCASTs etc. especially now that rL333995 and rL334007 have landed. It also effectively works at byte level which further simplifies shuffle combines.

The only (minor) annoyances are that ComputeKnownBits can sometimes take longer as it doesn't fail as quickly as ComputeNumSignBits (but I'm not seeing any actual regressions in tests) and PACKUSDW only became available after SSE41 so we have more codegen diffs between targets.

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

6 years ago[TableGen] Make DAGInstruction own Pattern to avoid leaking it.
Florian Hahn [Fri, 8 Jun 2018 09:54:04 +0000 (09:54 +0000)]
[TableGen] Make DAGInstruction own Pattern to avoid leaking it.

Reviewers: dsanders, craig.topper, stoklund, nhaehnle

Reviewed By: craig.topper

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

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

6 years ago[LV] Fix PR36983. For a given recurrence, fix all phis in exit block
Roman Shirokiy [Fri, 8 Jun 2018 08:21:20 +0000 (08:21 +0000)]
[LV] Fix PR36983. For a given recurrence, fix all phis in exit block
There could be more than one PHIs in exit block using same loop recurrence.
Don't assume there is only one and fix each user.

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

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

6 years agoAMDGPU: Error on LDS global address in functions
Matt Arsenault [Fri, 8 Jun 2018 08:05:54 +0000 (08:05 +0000)]
AMDGPU: Error on LDS global address in functions

These won't work as expected now, so error on them to avoid
wasting time debugging this in the future.

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

6 years ago[DAGCombine] Fix for PR37667
Sam Parker [Fri, 8 Jun 2018 07:49:04 +0000 (07:49 +0000)]
[DAGCombine] Fix for PR37667

While trying to propagate AND masks back to loads, we currently allow
one non-load node to be included as a leaf in chain. This fix now
limits that node to produce only a single data value.

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

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

6 years ago[NFC] fix formatting
Hiroshi Inoue [Fri, 8 Jun 2018 04:00:54 +0000 (04:00 +0000)]
[NFC] fix formatting

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

6 years ago[X86] Improve some shuffle decoding code to remove a conditional from a loop and...
Craig Topper [Fri, 8 Jun 2018 01:09:31 +0000 (01:09 +0000)]
[X86] Improve some shuffle decoding code to remove a conditional from a loop and reduce the number of temporary variables. NFCI

The NumControlBits variable was definitely sketchy. I think that only worked because the expected value was 1 or 2 and the number of lanes was 2 or 4. Had their been 8 lanes the number of bits should have been 3 not 4 as the previous code would have given.

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

6 years ago[AMDGPU] Simplify memory legalizer (add missing virtual descructor)
Tony Tye [Fri, 8 Jun 2018 01:00:11 +0000 (01:00 +0000)]
[AMDGPU] Simplify memory legalizer (add missing virtual descructor)

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

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

6 years agoRevert r334209 "[LSR] Check yet more intrinsic pointer operands"
Reid Kleckner [Fri, 8 Jun 2018 00:43:27 +0000 (00:43 +0000)]
Revert r334209 "[LSR] Check yet more intrinsic pointer operands"

This causes cast failures when compiling harfbuzz in Chromium.
Reproducer on the way.

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

6 years agoNFC Fix a comment in ValueTypes.td
Gabor Buella [Thu, 7 Jun 2018 23:32:18 +0000 (23:32 +0000)]
NFC Fix a comment in ValueTypes.td

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

6 years agoExpose a single global file open function.
Zachary Turner [Thu, 7 Jun 2018 23:25:13 +0000 (23:25 +0000)]
Expose a single global file open function.

This one allows much more flexibility than the standard
openFileForRead / openFileForWrite functions.  Since there is now
just one "real" function that does the work, all other implementations
simply delegate to this one.

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

6 years agopropagate fast math flags via IR on fma and sub expressions
Michael Berg [Thu, 7 Jun 2018 22:49:09 +0000 (22:49 +0000)]
propagate fast math flags via IR on fma and sub expressions

Summary: This change uses fmf subflags to guard fma optimizations as well as unsafe. These changes originated from D46483 and have been simplified via getNode.

Reviewers: spatel, arsenm, hfinkel, javed.absar

Reviewed By: spatel

Subscribers: nemanjai, wdng

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

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

6 years ago[AMDGPU] Simplify memory legalizer
Tony Tye [Thu, 7 Jun 2018 22:28:32 +0000 (22:28 +0000)]
[AMDGPU] Simplify memory legalizer

- Make code easier to maintain.
- Avoid generating waitcnts for VMEM if the address sppace does not involve VMEM.
- Add support to generate waitcnts for LDS and GDS memory.

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

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

6 years ago[NFC][InstSimplify] Add tests for add nuw %x, -1 -> -1 fold.
Roman Lebedev [Thu, 7 Jun 2018 21:19:50 +0000 (21:19 +0000)]
[NFC][InstSimplify] Add tests for add nuw %x, -1 -> -1 fold.

%ret = add nuw i8 %x, C
From langref:
nuw and nsw stand for “No Unsigned Wrap” and “No Signed Wrap”,
respectively. If the nuw and/or nsw keywords are present,
the result value of the add is a poison value if unsigned
and/or signed overflow, respectively, occurs.

So if C is -1, %x can only be 0, and the result is always -1.

https://rise4fun.com/Alive/sldC
Was mentioned in D47428 review.

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

6 years ago[NFC][InstSimplify] One more negative test for shl nuw C, %x -> C fold.
Roman Lebedev [Thu, 7 Jun 2018 21:19:45 +0000 (21:19 +0000)]
[NFC][InstSimplify] One more negative test for shl nuw C, %x -> C fold.

Follow-up for rL334200, rL334206.

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

6 years ago[Support] Link libzircon.so when building LLVM for Fuchsia
Petr Hosek [Thu, 7 Jun 2018 21:01:32 +0000 (21:01 +0000)]
[Support] Link libzircon.so when building LLVM for Fuchsia

This is necessary for zx_* symbols.

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

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

6 years agoTry to fix build.
Zachary Turner [Thu, 7 Jun 2018 20:37:22 +0000 (20:37 +0000)]
Try to fix build.

I don't know how to build this code, but based on the failing
buildbot error message it looks like this change should get
the buildbot up and running again.

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

6 years agoFix unused private variable.
Zachary Turner [Thu, 7 Jun 2018 20:07:08 +0000 (20:07 +0000)]
Fix unused private variable.

This parameter got lost in the refactor.  Add it back.

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

6 years ago[InstSimplify] shl nuw C, %x -> C iff signbit is set on C.
Roman Lebedev [Thu, 7 Jun 2018 20:03:45 +0000 (20:03 +0000)]
[InstSimplify] shl nuw C, %x -> C iff signbit is set on C.

Summary:
`%r = shl nuw i8 C, %x`

As per langref:
```
If the nuw keyword is present, then the shift produces
a poison value if it shifts out any non-zero bits.
```
Thus, if the sign bit is set on `C`, then `%x` can only be `0`,
which means that `%r` can only be `C`.
Or in other words, set sign bit means that the signed value
is negative, so the constant is `<= 0`.

https://rise4fun.com/Alive/WMk
https://rise4fun.com/Alive/udv

Was mentioned in D47428 review.

We already handle the `0` constant, https://godbolt.org/g/UZq1sJ, so this only handles negative constants.

Could use computeKnownBits() / LazyValueInfo,
but the cost-benefit analysis (https://reviews.llvm.org/D47891)
suggests it isn't worth it.

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

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

6 years ago[FileSystem] Split up the OpenFlags enumeration.
Zachary Turner [Thu, 7 Jun 2018 19:58:58 +0000 (19:58 +0000)]
[FileSystem] Split up the OpenFlags enumeration.

This breaks the OpenFlags enumeration into two separate
enumerations: OpenFlags and CreationDisposition.  The first
controls the behavior of the API depending on whether or not
the target file already exists, and is not a flags-based
enum.  The second controls more flags-like values.

This yields a more easy to understand API, while also allowing
flags to be passed to the openForRead api, where most of the
values didn't make sense before.  This also makes the apis more
testable as it becomes easy to enumerate all the configurations
which make sense, so I've added many new tests to exercise all
the different values.

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

6 years agoDAG: Avoid bitcast/ext/build_vector combine
Matt Arsenault [Thu, 7 Jun 2018 19:42:27 +0000 (19:42 +0000)]
DAG: Avoid bitcast/ext/build_vector combine

This avoids regressions in a future AMDGPU change
to make v4i16/v4f16 legal. For these types, build_vector
is implemented as bitcasted operations on v2i32. This
combine was creating v4i16s out of what would have been
already been a v2i32 build_vector, creating a mess
of nodes that never get cleaned up.

I'm not sure this is the right condition to check.
I initially tried just checking for the legality of the
new build_vector. This works for my case, but breaks dozens
of x86 tests. A Mips test seems to show some improvement
or at least a neutral change. I don't want to think
about how long it would take to analyze the set of
different x86 vector operations impacted.

Test included in future commit.

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

6 years ago[llvm-objcopy] Remove unused field from Object
Alexander Shaposhnikov [Thu, 7 Jun 2018 19:41:42 +0000 (19:41 +0000)]
[llvm-objcopy] Remove unused field from Object

The class Object contains std::shared_ptr<MemoryBuffer> OwnedData
which is not used anywhere. Besides avoiding two stage initialization
the motivation to remove it comes from the plan to add (currently missing) support
for static libraries.
NFC.

Test plan: make check-all

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

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

6 years ago[TargetLibraryInfo] add mappings from LLVM sin/cos intrinsics to SVML calls
Sanjay Patel [Thu, 7 Jun 2018 18:21:24 +0000 (18:21 +0000)]
[TargetLibraryInfo] add mappings from LLVM sin/cos intrinsics to SVML calls

These weren't included in D19544 - probably just an oversight.
D40044 made it more likely that we'll have LLVM math intrinsics rather
than libcalls, so this bug was more easily exposed.
As the tests/code show, we already have the complete mappings for pow/exp/log.

I don't have any experience with SVML, so I don't know if anything else is
missing. It's also not clear to me that we should be doing this transform in
IR rather than DAG/isel, but that's a separate issue.

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

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

6 years ago[LSR] Check yet more intrinsic pointer operands
Daniil Fukalov [Thu, 7 Jun 2018 17:30:58 +0000 (17:30 +0000)]
[LSR] Check yet more intrinsic pointer operands

the patch fixes another assertion in isLegalUse()

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

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

6 years ago[docs] add various sanitisers support for FreeBSD/OpenBSD
David Carlier [Thu, 7 Jun 2018 16:33:48 +0000 (16:33 +0000)]
[docs] add various sanitisers support for FreeBSD/OpenBSD

since couple of months, supports had been enabled for FreeBSD and OpenBSD.

Reviewers: thakis, spatel, dim

Reviewed By: dim

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

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

6 years ago[NFC][InstSimplify] Add more tests for shl nuw C, %x -> C fold.
Roman Lebedev [Thu, 7 Jun 2018 16:18:26 +0000 (16:18 +0000)]
[NFC][InstSimplify] Add more tests for shl nuw C, %x -> C fold.

Follow-up for rL334200.
For these, KnownBits will be needed.

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

6 years ago[X86][SSE] Updated comment - combineVectorSignBitsTruncation handles PACKSS and PACKU...
Simon Pilgrim [Thu, 7 Jun 2018 16:08:40 +0000 (16:08 +0000)]
[X86][SSE] Updated comment - combineVectorSignBitsTruncation handles PACKSS and PACKUS. NFCI.

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

6 years ago[RISCV] AsmParser support for the li pseudo instruction
Alex Bradbury [Thu, 7 Jun 2018 15:35:47 +0000 (15:35 +0000)]
[RISCV] AsmParser support for the li pseudo instruction

The implementation follows the MIPS backend and expands the pseudo instruction
directly during asm parsing. As the result, only real MC instructions are
emitted to the MCStreamer. The actual expansion to real instructions is
similar to the expansion performed by the GNU Assembler.

This patch supersedes D41949.

Differential Revision: https://reviews.llvm.org/D46118
Patch by Mario Werner.

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

6 years ago[AVR] Fix build after r334078
Alex Bradbury [Thu, 7 Jun 2018 15:29:09 +0000 (15:29 +0000)]
[AVR] Fix build after r334078

r334078 added MCSubtargetInfo to fixupNeedsRelaxation and applyFixup. This
patch makes the necessary adjustment for the AVR target.

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

6 years ago[X86][SSE] Simplify combineVectorTruncationWithPACKUS. NFCI.
Simon Pilgrim [Thu, 7 Jun 2018 14:53:32 +0000 (14:53 +0000)]
[X86][SSE] Simplify combineVectorTruncationWithPACKUS. NFCI.

Move code only used by combineVectorTruncationWithPACKUS out of combineVectorTruncation.

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

6 years ago[NFC][InstSimplify] Add tests for shl nuw C, %x -> C fold.
Roman Lebedev [Thu, 7 Jun 2018 14:18:38 +0000 (14:18 +0000)]
[NFC][InstSimplify] Add tests for shl nuw C, %x -> C fold.

%r = shl nuw i8 C, %x

As per langref: If the nuw keyword is present, then the shift produces
                a poison value if it shifts out any non-zero bits.
Thus, if the sign bit is set on C, then %x can only be 0,
which means that %r can only be C.

https://rise4fun.com/Alive/WMk
Was mentioned in D47428 review.

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

6 years ago[x86] add tests for backwards propagate mask bug (PR37060, PR37667); NFC
Sanjay Patel [Thu, 7 Jun 2018 14:11:18 +0000 (14:11 +0000)]
[x86] add tests for backwards propagate mask bug (PR37060, PR37667); NFC

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

6 years ago[llvm-exegesis] Make BenchmarkRunner handle multiple configurations.
Guillaume Chatelet [Thu, 7 Jun 2018 14:00:29 +0000 (14:00 +0000)]
[llvm-exegesis] Make BenchmarkRunner handle multiple configurations.

Summary: BenchmarkRunner subclasses can now create many configurations - although this patch still generates one.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

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

6 years ago[llvm-objdump] Add -R option
Paul Semel [Thu, 7 Jun 2018 13:30:55 +0000 (13:30 +0000)]
[llvm-objdump] Add -R option

This option prints dynamic relocation entries of the given file

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

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