]> granicus.if.org Git - llvm/log
llvm
5 years ago[RISCV] Enable tail call opt for variadic function
Jim Lin [Wed, 4 Sep 2019 02:03:36 +0000 (02:03 +0000)]
[RISCV] Enable tail call opt for variadic function

Summary: Tail call opt can treat variadic function call the same as normal function call

Reviewers: mgrang, asb, lenary, lewis-revill

Reviewed By: lenary

Subscribers: luismarques, pzheng, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, s.egerton, llvm-commits

Tags: #llvm

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

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

5 years ago[MemorySSA] Move two verify calls under expensive checks.
Alina Sbirlea [Wed, 4 Sep 2019 00:44:54 +0000 (00:44 +0000)]
[MemorySSA] Move two verify calls under expensive checks.

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

5 years ago[NFC][llvm-ifs] Adding .ifs files to the test list for llvm-ifs tool.
Puyan Lotfi [Wed, 4 Sep 2019 00:07:49 +0000 (00:07 +0000)]
[NFC][llvm-ifs] Adding .ifs files to the test list for llvm-ifs tool.

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

5 years agoRevert [Windows] Disable TrapUnreachable for Win64, add SEH_NoReturn
Reid Kleckner [Tue, 3 Sep 2019 22:27:27 +0000 (22:27 +0000)]
Revert [Windows] Disable TrapUnreachable for Win64, add SEH_NoReturn

This reverts r370525 (git commit 0bb1630685fba255fa93def92603f064c2ffd203)
Also reverts r370543 (git commit 185ddc08eed6542781040b8499ef7ad15c8ae9f4)

The approach I took only works for functions marked `noreturn`. In
general, a call that is not known to be noreturn may be followed by
unreachable for other reasons. For example, there could be multiple call
sites to a function that throws sometimes, and at some call sites, it is
known to always throw, so it is followed by unreachable. We need to
insert an `int3` in these cases to pacify the Windows unwinder.

I think this probably deserves its own standalone, Win64-only fixup pass
that runs after block placement. Implementing that will take some time,
so let's revert to TrapUnreachable in the mean time.

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

5 years ago[WebAssembly] Compare functions by names in Emscripten Sjlj
Heejin Ahn [Tue, 3 Sep 2019 22:26:49 +0000 (22:26 +0000)]
[WebAssembly] Compare functions by names in Emscripten Sjlj

Summary:
This removes all string constants for function names and compares
functions by string directly when needed. Many of these constants are
used only once or twice so the benefit of defining them separately is
not very clear, and this actually fixes a bug.

When we already have a `malloc` declaration which is an alias to
something else within the module,
```
@malloc = weak hidden alias i8* (i32), i8* (i32)* @dlmalloc
```
(this happens compiling with emscripten with `-s WASM_OBJECT_FILES=0`
because all bc files are merged before being fed into `wasm-ld` which
runs the backend optimizations as LTO)

`Module::getFunction("malloc")` in `canLongjmp` returns `nullptr`
because `Module::getFunction` dyncasts pointer into `Function`, but the
alias is a `GlobalValue` but not a `Function`. This makes `canLongjmp`
return false for `malloc` in this case, and we end up adding a lot of
longjmp handling code around malloc. This is not only a code size
increase but actually a bug because `malloc` is used in the entry block
when preparing for setjmp tables for emscripten sjlj handling, and this
makes initial setjmp preparation, which has to happen in the entry
block, move to another split block, and this interferes with SSA update
later.

This also adds two more functions, `getTempRet0` and `setTempRet0`, in
the list of not longjmp-able functions.

Fixes https://github.com/emscripten-core/emscripten/issues/8935.

Reviewers: sbc100

Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, dexonsmith, dschuff, llvm-commits

Tags: #llvm

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

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

5 years ago[llvm-profdata] Add mode to recover from profile read failures
Vedant Kumar [Tue, 3 Sep 2019 22:23:16 +0000 (22:23 +0000)]
[llvm-profdata] Add mode to recover from profile read failures

Add a mode in which profile read errors are not immediately treated as
fatal. In this mode, merging makes forward progress and reports failure
only if no inputs can be read.

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

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

5 years ago[InstrProf] Tighten a check for malformed data records in raw profiles
Vedant Kumar [Tue, 3 Sep 2019 22:23:14 +0000 (22:23 +0000)]
[InstrProf] Tighten a check for malformed data records in raw profiles

The check needs to validate a counter offset before performing pointer
arithmetic with the (potentially corrupt) offset.

Found by UBSan's pointer overflow check.

rdar://54843625

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

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

5 years ago[GVN] Remove a todo introduced w/rL370791
Philip Reames [Tue, 3 Sep 2019 21:56:17 +0000 (21:56 +0000)]
[GVN] Remove a todo introduced w/rL370791

When I dug into this, it turns out to be *much* more involved than I'd realized and doesn't actually simplify anything.

The general purpose of the leader table is that we want to find the most-dominating definition quickly.  The problem for equivalance folding is slightly different; we want to find the most dominating *value* whose definition block dominates our use quickly.

To make this change, we'd end up having to restructure the leader table (either the sorting thereof, or maybe even introducing multiple leader tables per value) and that complexity is just not worth it.

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

5 years ago[AArch64][GlobalISel] Legalize 128 bit divisions to libcalls.
Amara Emerson [Tue, 3 Sep 2019 21:42:32 +0000 (21:42 +0000)]
[AArch64][GlobalISel] Legalize 128 bit divisions to libcalls.

Now that we have the infrastructure to support s128 types as parameters
we can expand these to libcalls.

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

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

5 years ago[GlobalISel][CallLowering] Add support for splitting types according to calling conve...
Amara Emerson [Tue, 3 Sep 2019 21:42:28 +0000 (21:42 +0000)]
[GlobalISel][CallLowering] Add support for splitting types according to calling conventions.

On AArch64, s128 types have to be split into s64 GPRs when passed as arguments.
This change adds the generic support in call lowering for dealing with multiple
registers, for incoming and outgoing args.

Support for splitting for return types not yet implemented.

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

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

5 years ago[MemorySSA] Disable MemorySSA use.
Alina Sbirlea [Tue, 3 Sep 2019 21:20:46 +0000 (21:20 +0000)]
[MemorySSA] Disable MemorySSA use.

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

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

5 years ago[Attributor] Use the delete API for liveness
Johannes Doerfert [Tue, 3 Sep 2019 20:42:16 +0000 (20:42 +0000)]
[Attributor] Use the delete API for liveness

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[Attributor] Deduce "no-capture" argument attribute
Johannes Doerfert [Tue, 3 Sep 2019 20:37:24 +0000 (20:37 +0000)]
[Attributor] Deduce "no-capture" argument attribute

Add the no-capture argument attribute deduction to the Attributor
fixpoint framework.

The new string attributed "no-capture-maybe-returned" is introduced to
allow deduction of no-capture through functions that "capture" an
argument but only by "returning" it. It is only used by the Attributor
for testing.

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

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

5 years ago[CodeGen] Use FSHR in DAGTypeLegalizer::ExpandIntRes_MULFIX
Bjorn Pettersson [Tue, 3 Sep 2019 19:35:07 +0000 (19:35 +0000)]
[CodeGen] Use FSHR in DAGTypeLegalizer::ExpandIntRes_MULFIX

Summary:
Simplify the right shift of the intermediate result (given
in four parts) by using funnel shift.

There are some impact on lit tests, but that seems to be
related to register allocation differences due to how FSHR
is expanded on X86 (giving a slightly different operand order
for the OR operations compared to the old code).

Reviewers: leonardchan, RKSimon, spatel, lebedev.ri

Reviewed By: RKSimon

Subscribers: hiraditya, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, s.egerton, pzheng, bevinh, llvm-commits

Tags: #llvm

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

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

5 years agoSkip MCJIT unit tests if LLVM is not configured for native compilation
David Blaikie [Tue, 3 Sep 2019 19:30:45 +0000 (19:30 +0000)]
Skip MCJIT unit tests if LLVM is not configured for native compilation

Patch by Sergej Jaskiewicz!

Differential Revision: D67089

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

5 years ago[MemorySSA] Re-enable MemorySSA use.
Alina Sbirlea [Tue, 3 Sep 2019 19:28:37 +0000 (19:28 +0000)]
[MemorySSA] Re-enable MemorySSA use.

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

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

5 years ago[MC] Pass through .code16/32/64 and .syntax unified for COFF
Reid Kleckner [Tue, 3 Sep 2019 18:16:52 +0000 (18:16 +0000)]
[MC] Pass through .code16/32/64 and .syntax unified for COFF

These flags should simply be passed through to the target, which will do
the right thing. Add an MC/X86 test that uses these directives with the
three primary object file formats and shows that they disassemble the
same everywhere.

There is a missing test for .code32 on Windows ARM, since I'm not sure
exactly how to construct one.

Fixes PR43203

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

5 years ago[GVN] Propagate simple equalities from assumes within the tail of the block
Philip Reames [Tue, 3 Sep 2019 17:31:19 +0000 (17:31 +0000)]
[GVN] Propagate simple equalities from assumes within the tail of the block

This extends the existing logic for propagating constant expressions in an analogous manner for what we do across basic blocks. The core point is that we chose some order of operands, and canonicalize uses towards that one.

The heuristic used is inspired by the one used across blocks; in a follow up change, I'd plan to common them so that the cross block version uses the slightly stronger ordering herein.

As noted by the TODOs in the code, there's a good amount of room for improving the existing code and making it more powerful.  Some follow up work planned.

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

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

5 years ago[AArch64][GlobalISel] Don't import i64imm_32bit pattern at -O0
Jessica Paquette [Tue, 3 Sep 2019 17:21:12 +0000 (17:21 +0000)]
[AArch64][GlobalISel] Don't import i64imm_32bit pattern at -O0

This pattern, when imported at -O0 adds an extra copy via the SUBREG_TO_REG.

This is because the SUBREG_TO_REG is not eliminated. At all other opt levels,
it is eliminated.

This is a 1% geomean code size savings at -O0 on CTMark.

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

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

5 years agoRevert r370454 "[LoopIdiomRecognize] BCmp loop idiom recognition"
Roman Lebedev [Tue, 3 Sep 2019 17:14:56 +0000 (17:14 +0000)]
Revert r370454 "[LoopIdiomRecognize] BCmp loop idiom recognition"

https://bugs.llvm.org/show_bug.cgi?id=43206 was filed,
claiming that there is a miscompilation.
Reverting until i investigate.

This reverts commit r370454

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

5 years ago[Tests/GVN] Precommit requested test additions from D66977
Philip Reames [Tue, 3 Sep 2019 17:02:55 +0000 (17:02 +0000)]
[Tests/GVN] Precommit requested test additions from D66977

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

5 years ago[cmake] Improve comment describing the C4245 warning. NFCI.
Simon Pilgrim [Tue, 3 Sep 2019 16:11:37 +0000 (16:11 +0000)]
[cmake] Improve comment describing the C4245 warning. NFCI.

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

5 years ago[SVE][Inline-Asm] Fix -Wimplicit-fallthrough in AArch64ISelLowering.cpp
Kerry McLaughlin [Tue, 3 Sep 2019 15:45:42 +0000 (15:45 +0000)]
[SVE][Inline-Asm] Fix -Wimplicit-fallthrough in AArch64ISelLowering.cpp

Summary: Adds break to 'x' case in getRegForInlineAsmConstraint added by D66302, fixing the unintentional fallthrough.

Reviewers: sdesmalen, rovka, cameron.mcinally, greened, gribozavr, ruiu

Reviewed By: sdesmalen

Subscribers: bjope, javed.absar, tschuett, kristof.beyls, rkruppe, psnobl, llvm-commits, cfe-commits

Tags: #llvm

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

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

5 years ago[X86] Merge 2 consecutive HasInt256 branches. NFCI.
Simon Pilgrim [Tue, 3 Sep 2019 14:39:06 +0000 (14:39 +0000)]
[X86] Merge 2 consecutive HasInt256 branches. NFCI.

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

5 years ago[SystemZ] Recognize INLINEASM_BR in backend.
Jonas Paulsson [Tue, 3 Sep 2019 13:31:22 +0000 (13:31 +0000)]
[SystemZ]  Recognize INLINEASM_BR in backend.

SystemZInstrInfo::analyzeBranch() needs to check for INLINEASM_BR
instructions, or it will crash.

Review: Ulrich Weigand

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

5 years agogn build: (manually) merge r370499
Nico Weber [Tue, 3 Sep 2019 13:17:16 +0000 (13:17 +0000)]
gn build: (manually) merge r370499

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

5 years agogn build: Merge r370746
Nico Weber [Tue, 3 Sep 2019 13:01:17 +0000 (13:01 +0000)]
gn build: Merge r370746

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

5 years ago[ARM] Ignore Implicit CPSR regs when lowering from Machine to MC operands
David Green [Tue, 3 Sep 2019 11:30:54 +0000 (11:30 +0000)]
[ARM] Ignore Implicit CPSR regs when lowering from Machine to MC operands

The code here seems to date back to r134705, when tablegen lowering was first
being added. I don't believe that we need to include CPSR implicit operands on
the MCInst. This now works more like other backends (like AArch64), where all
implicit registers are skipped.

This allows the AliasInst for CSEL's to match correctly, as can be seen in the
test changes.

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

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

5 years ago[SystemZ] Add support for fentry.
Jonas Paulsson [Tue, 3 Sep 2019 11:21:12 +0000 (11:21 +0000)]
[SystemZ]  Add support for fentry.

SystemZAsmPrinter now properly emits function calls to __fentry__.

Review: Ulrich Weigand

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

5 years ago[ARM] Invert CSEL predicates if the opposite is a simpler constant to materialise
David Green [Tue, 3 Sep 2019 11:06:24 +0000 (11:06 +0000)]
[ARM] Invert CSEL predicates if the opposite is a simpler constant to materialise

This moves ConstantMaterializationCost into ARMBaseInstrInfo so that it can
also be used in ISel Lowering, adding codesize values to the computed costs, to
be able to compare either approximate instruction counts or codesize costs.

It also adds a HasLowerConstantMaterializationCost, which compares the
ConstantMaterializationCost of two values, returning true if the first is
smaller either in instruction count/codesize, or falling back to the other in
the case that they are equal.

This is used in constant CSEL lowering to invert the predicate if the opposite
is easier to materialise.

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

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

5 years ago[ARM] Generate 8.1-m CSINC, CSNEG and CSINV instructions.
David Green [Tue, 3 Sep 2019 10:53:07 +0000 (10:53 +0000)]
[ARM] Generate 8.1-m CSINC, CSNEG and CSINV instructions.

Arm 8.1-M adds a number of related CSEL instructions, including CSINC, CSNEG and CSINV. These choose between two values given the content in CPSR and a condition, performing an increment, negation or inverse of the false value.

This adds some selection for them, either from constant values or patterns. It does not include CSEL directly, which is currently not always making code better. It is still useful, but we will have to check more carefully where it should and shouldn't be used.

Code by Ranjeet Singh and Simon Tatham, with some modifications from me.

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

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

5 years ago[ARM] Add csel tests. NFC
David Green [Tue, 3 Sep 2019 10:32:46 +0000 (10:32 +0000)]
[ARM] Add csel tests. NFC

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

5 years ago[mips] Switch to the `.text` section after emitting asm file preamble
Simon Atanasyan [Tue, 3 Sep 2019 10:24:07 +0000 (10:24 +0000)]
[mips] Switch to the `.text` section after emitting asm file preamble

Now the last `.section` directive in the MIPS asm file preamble
is the `.section .mdebug.abi`. If assembler code injected for example
by the LLVM `module asm` or the C ` __asm` directives do not contain
explicit switching to the `.text` section it goes to the `.mdebug.abi`
section. It might be unexpected to the user and in fact for example
breaks building some existing code like FreeBSD libc [1].

The patch forces switching to the `.text` section after emitting MIPS
assembler file preamble.

[1] https://bugs.llvm.org/show_bug.cgi?id=43119

Fix PR43119.

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

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

5 years ago[ARM] Fix MVE ldst offset ranges
David Green [Tue, 3 Sep 2019 09:57:02 +0000 (09:57 +0000)]
[ARM] Fix MVE ldst offset ranges

We were using isShiftedInt<7, Shift>(RHSC) to detect the ranges of offsets to
fold into MVE loads/stores. The instructions actually take a 7 bit unsigned
integer which is either added or subtracted. So something more like
isShiftedUInt<7, Shift>(abs(RHSC)).

Instead I've changes this to use the isScaledConstantInRange method, same as in
SelectT2AddrModeImm7Offset used by pre/post inc, which seemed to already be
getting this correct.

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

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

5 years ago[ARM][MVE] Decoding of VMSR doesn't diagnose some unpredictable encodings
Oliver Stannard [Tue, 3 Sep 2019 09:55:30 +0000 (09:55 +0000)]
[ARM][MVE] Decoding of VMSR doesn't diagnose some unpredictable encodings

Decoding of VMSR doesn't diagnose some unpredictable encodings, as the unpredictable bits are not correctly set.

Diff-reduce this instruction's internals WRT VMRS so I can see the differences better. Mostly this is s/src/Rt/g.

Fill in the "should-be-(0)" bits.

Designate the Unpredictable{} bits for both VMRS and VMSR.

Patch by Mark Murray!

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

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

5 years agoBug fix on function epilog optimization (ARM backend)
Oliver Stannard [Tue, 3 Sep 2019 09:51:19 +0000 (09:51 +0000)]
Bug fix on function epilog optimization (ARM backend)

To save a 'add sp,#val' instruction by adding registers to the final pop instruction,
the first register transferred by this pop instruction need to be found.
If the function to be optimized has a non-void return value, the operand list contains
r0 (implicit) which prevents the optimization to take place.
Therefore implicit register references should be skipped in the search loop,
because this registers are never popped from the stack.

Patch by Rainer Herbertz (rOptimizer)!

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

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

5 years ago[ARM] More MVE load/store tests for offsets around the negative limit. NFC
David Green [Tue, 3 Sep 2019 09:42:16 +0000 (09:42 +0000)]
[ARM] More MVE load/store tests for offsets around the negative limit. NFC

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

5 years ago[LV] Fix miscompiles by adding non-header PHI nodes to AllowedExit
Bjorn Pettersson [Tue, 3 Sep 2019 09:33:55 +0000 (09:33 +0000)]
[LV] Fix miscompiles by adding non-header PHI nodes to AllowedExit

Summary:
Fold-tail currently supports reduction last-vector-value live-out's,
but has yet to support last-scalar-value live-outs, including
non-header phi's. As it relies on AllowedExit in order to detect
them and bail out we need to add the non-header PHI nodes to
AllowedExit, otherwise we end up with miscompiles.

Solves https://bugs.llvm.org/show_bug.cgi?id=43166

Reviewers: fhahn, Ayal

Reviewed By: fhahn, Ayal

Subscribers: anna, hiraditya, rkruppe, llvm-commits

Tags: #llvm

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

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

5 years ago[LV] Precommit test case showing miscompile from PR43166. NFC
Bjorn Pettersson [Tue, 3 Sep 2019 09:33:40 +0000 (09:33 +0000)]
[LV] Precommit test case showing miscompile from PR43166. NFC

Summary:  Precommit test case showing miscompile from PR43166.

Reviewers: fhahn, Ayal

Reviewed By: fhahn

Subscribers: rkruppe, llvm-commits

Tags: #llvm

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

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

5 years ago[LV] Tail-folding, runtime scev checks
Sjoerd Meijer [Tue, 3 Sep 2019 08:53:02 +0000 (08:53 +0000)]
[LV] Tail-folding, runtime scev checks

Now that we allow tail-folding, not only when we optimise for size, make
sure we do not run in this assert.

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

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

5 years ago[LV] Tail-folding with runtime memory checks
Sjoerd Meijer [Tue, 3 Sep 2019 08:38:24 +0000 (08:38 +0000)]
[LV] Tail-folding with runtime memory checks

The loop vectorizer was running in an assert when it tried to fold the tail and
had to emit runtime memory disambiguation checks.

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

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

5 years ago[MachinePipeliner] Add a way to unit-test the schedule emitter
James Molloy [Tue, 3 Sep 2019 08:20:31 +0000 (08:20 +0000)]
[MachinePipeliner] Add a way to unit-test the schedule emitter

Emitting a schedule is really hard. There are lots of corner cases to take care of; in fact, of the 60+ SWP-specific testcases in the Hexagon backend most of those are testing codegen rather than the schedule creation itself.

One issue is that to test an emission corner case we must craft an input such that the generated schedule uses that corner case; sometimes this is very hard and convolutes testcases. Other times it is impossible but we want to test it anyway.

This patch adds a simple test pass that will consume a module containing a loop and generate pipelined code from it. We use post-instr-symbols as a way to annotate instructions with the stage and cycle that we want to schedule them at.

We also provide a flag that causes the MachinePipeliner to generate these annotations instead of actually emitting code; this allows us to generate an input testcase with:

  llc < %s -stop-after=pipeliner -pipeliner-annotate-for-testing -o test.mir

And run the emission in isolation with:

  llc < test.mir -run-pass=modulo-schedule-test

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

5 years ago[ARM] Select vmla
Sam Tebbs [Tue, 3 Sep 2019 08:17:46 +0000 (08:17 +0000)]
[ARM] Select vmla

This patch adds vmla selection.

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

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

5 years ago[X86] Simplify the setOperationAction handling for fp_to_uint by improving the Custom...
Craig Topper [Tue, 3 Sep 2019 05:57:22 +0000 (05:57 +0000)]
[X86] Simplify the setOperationAction handling for fp_to_uint by improving the Custom handler a bit.

This merges the 32-bit and 64-bit mode code to just use Custom
for both i32 and i64. We already had most of the handling in
the custom handling due to the AVX512 having legal fp_to_uint.
Just needed to add the i32->i64 promotion handling. Refactor
the fp_to_uint code in the custom handler to simplify the
number of times we check things.

Tweak cost model tables to match the default handling we were
getting due to Expand before.

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

5 years ago[X86] Don't use Expand for i32 fp_to_uint on SSE1/2 targets on 32-bit target.
Craig Topper [Tue, 3 Sep 2019 05:57:18 +0000 (05:57 +0000)]
[X86] Don't use Expand for i32 fp_to_uint on SSE1/2 targets on 32-bit target.

Use Custom lowering instead. Fall back to default expansion only
when the scalar FP type belongs in an XMM register. This improves
lowering for i32 to fp80, and also i32 to double on SSE1 only.

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

5 years ago[X86] Add an exhaustive test for i32 fptosi/fptoui across different triples and features.
Craig Topper [Tue, 3 Sep 2019 05:57:14 +0000 (05:57 +0000)]
[X86] Add an exhaustive test for i32 fptosi/fptoui across different triples and features.

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

5 years ago[LegalizeDAG] Pass DAG to two calls to SDNode::dump in debug prints so that they...
Craig Topper [Tue, 3 Sep 2019 02:51:14 +0000 (02:51 +0000)]
[LegalizeDAG] Pass DAG to two calls to SDNode::dump in debug prints so that they will print target specific nodes correctly.

The dump methods can only print target node names correctly if
they can get access to the TLI object.

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

5 years ago[X86] Custom promote i32->f80 uint_to_fp on AVX512 64-bit targets.
Craig Topper [Tue, 3 Sep 2019 02:51:10 +0000 (02:51 +0000)]
[X86] Custom promote i32->f80 uint_to_fp on AVX512 64-bit targets.

Reuse the same code to promote all i32 uint_to_fp on 64-bit targets
to simplify the X86ISelLowering constructor.

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

5 years ago[CostModel][X86] Add scalar sext/zext cost tests
Simon Pilgrim [Mon, 2 Sep 2019 21:02:51 +0000 (21:02 +0000)]
[CostModel][X86] Add scalar sext/zext cost tests

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

5 years ago[X86] Enable fp128 as a legal type with SSE1 rather than with MMX.
Craig Topper [Mon, 2 Sep 2019 20:16:30 +0000 (20:16 +0000)]
[X86] Enable fp128 as a legal type with SSE1 rather than with MMX.

FP128 values are passed in xmm registers so should be asssociated
with an SSE feature rather than MMX which uses a different set
of registers.

llc enables sse1 and sse2 by default with x86_64. But does not
enable mmx. Clang enables all 3 features by default.

I've tried to add command lines to test with -sse
where possible, but any test that returns a value in an xmm
register fails with a fatal error with -sse since we have no
defined ABI for that scenario.

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

5 years ago[ARM] MVE predicate bitcast test and VPSEL adjustment. NFC
David Green [Mon, 2 Sep 2019 19:03:35 +0000 (19:03 +0000)]
[ARM] MVE predicate bitcast test and VPSEL adjustment. NFC

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

5 years ago[ARM] Use MQPR not QPR for MVE registers
David Green [Mon, 2 Sep 2019 17:18:23 +0000 (17:18 +0000)]
[ARM] Use MQPR not QPR for MVE registers

We should be using MQPR, and if we don't we can get COPYs and PHIs created for
QPR. These get folded into instructions, failing verification checks.

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

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

5 years ago[TargetLowering][PS4] Add sincos(f) lib functions when target is PS4
Robert Lougher [Mon, 2 Sep 2019 16:53:32 +0000 (16:53 +0000)]
[TargetLowering][PS4] Add sincos(f) lib functions when target is PS4

PS4 supports sincosf and sincos. Adding the library functions enables
the sin(f)+cos(f) -> sincos(f) optimization.

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

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

5 years ago[SystemZ] Support constrained fpto[su]i intrinsics
Ulrich Weigand [Mon, 2 Sep 2019 16:49:29 +0000 (16:49 +0000)]
[SystemZ] Support constrained fpto[su]i intrinsics

Now that constrained fpto[su]i intrinsic are available,
add codegen support to the SystemZ backend.

In addition to pure back-end changes, I've also needed
to add the strict_fp_to_[su]int and any_fp_to_[su]int
pattern fragments in the obvious way.

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

5 years ago[SVE][Inline-Asm] Support for SVE asm operands
Kerry McLaughlin [Mon, 2 Sep 2019 16:12:31 +0000 (16:12 +0000)]
[SVE][Inline-Asm] Support for SVE asm operands

Summary:
Adds the following inline asm constraints for SVE:
  - w: SVE vector register with full range, Z0 to Z31
  - x: Restricted to registers Z0 to Z15 inclusive.
  - y: Restricted to registers Z0 to Z7 inclusive.

This change also adds the "z" modifier to interpret a register as an SVE register.

Not all of the bitconvert patterns added by this patch are used, but they have been included here for completeness.

Reviewers: t.p.northover, sdesmalen, rovka, momchil.velikov, rengolin, cameron.mcinally, greened

Reviewed By: sdesmalen

Subscribers: javed.absar, tschuett, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] getPMOVMSKB - add MVT::v64i8 handling and remove from combineBitcastvxi1. NFCI.
Simon Pilgrim [Mon, 2 Sep 2019 15:10:35 +0000 (15:10 +0000)]
[X86] getPMOVMSKB - add MVT::v64i8 handling and remove from combineBitcastvxi1. NFCI.

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

5 years agoRecommit r370661 "[llvm-nm] - Add a test case for case when we dump a symbol that...
George Rimar [Mon, 2 Sep 2019 14:57:35 +0000 (14:57 +0000)]
Recommit r370661 "[llvm-nm] - Add a test case for case when we dump a symbol that belongs to a section with a broken sh_name."

Fix: add a 'consumeError()' call to ObjectFile.cpp.
This error was never checked.

Original commit message:

It adds a test case for a problem fixed by D66976 <https://reviews.llvm.org/D66976>.

It was introduced by me in D66089 <https://reviews.llvm.org/D66089>.
The error reported was never consumed because of a wrong variable name used,
so it could fail when LLVM_ENABLE_ABI_BREAKING_CHECKS is used.

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

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

5 years ago[DAGCombiner] try to form test+set out of shift+mask patterns
Sanjay Patel [Mon, 2 Sep 2019 14:52:09 +0000 (14:52 +0000)]
[DAGCombiner] try to form test+set out of shift+mask patterns

The motivating bugs are:
https://bugs.llvm.org/show_bug.cgi?id=41340
https://bugs.llvm.org/show_bug.cgi?id=42697

As discussed there, we could view this as a failure of IR canonicalization,
but then we would need to implement a backend fixup with target overrides
to get this right in all cases. Instead, we can just view this as a codegen
opportunity. It's not even clear for x86 exactly when we should favor
test+set; some CPUs have better theoretical throughput for the ALU ops than
bt/test.

This patch is made more complicated than I expected because there's an early
DAGCombine for 'and' that can change types of the intermediate ops via
trunc+anyext.

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

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

5 years agoPartially revert D61491 "AMDGPU: Be explicit about whether the high-word in SI_PC_ADD...
Jay Foad [Mon, 2 Sep 2019 14:40:57 +0000 (14:40 +0000)]
Partially revert D61491 "AMDGPU: Be explicit about whether the high-word in SI_PC_ADD_REL_OFFSET is 0"

Summary:
D61491 caused us to use relocs when they're not strictly necessary, to
refer to symbols in the text section. This is a pessimization and it's a
problem for some loaders that don't support relocs yet.

Reviewers: nhaehnle, arsenm, tpr

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU][MC][GFX10] Corrected constant bus checks to exclude null
Dmitry Preobrazhensky [Mon, 2 Sep 2019 14:19:52 +0000 (14:19 +0000)]
[AMDGPU][MC][GFX10] Corrected constant bus checks to exclude null

See AMD SWDEV-157286

Reviewers: atamazov, arsenm

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

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

5 years ago[FileCheck] Make NumericVariable ctor explicit
Thomas Preud'homme [Mon, 2 Sep 2019 14:04:05 +0000 (14:04 +0000)]
[FileCheck] Make NumericVariable ctor explicit

Summary:
Make FileCheckNumericVariable constructor explicit to avoid implicit
conversions from StringRef.

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[FileCheck] Forbid using var defined on same line
Thomas Preud'homme [Mon, 2 Sep 2019 14:04:00 +0000 (14:04 +0000)]
[FileCheck] Forbid using var defined on same line

Summary:
Commit r366897 introduced the possibility to set a variable from an
expression, such as [[#VAR2:VAR1+3]]. While introducing this feature, it
introduced extra logic to allow using such a variable on the same line
later on. Unfortunately that extra logic is flawed as it relies on a
mapping from variable to expression defining it when the mapping is from
variable definition to expression. This flaw causes among other issues
PR42896.

This commit avoids the problem by forbidding all use of a variable
defined on the same line, and removes the now useless logic. Redesign
will be done in a later commit because it will require some amount of
refactoring first for the solution to be clean. One example is the need
for some sort of transaction mechanism to set a variable temporarily and
from an expression and rollback if the CHECK pattern does not match so
that diagnostics show the right variable values.

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: JonChesterfield, rogfer01, hfinkel, kristina, rnk, tra, arichardson, grimar, dblaikie, probinson, llvm-commits, hiraditya

Tags: #llvm

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

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

5 years agoRevert r370661 "[llvm-nm] - Add a test case for case when we dump a symbol that belon...
George Rimar [Mon, 2 Sep 2019 14:03:50 +0000 (14:03 +0000)]
Revert r370661 "[llvm-nm] - Add a test case for case when we dump a symbol that belongs to a section with a broken sh_name"

It broke BB:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/16955/steps/test/logs/stdio

Expected<T> must be checked before access or destruction.
Unchecked Expected<T> contained error:
a section [index 1] has an invalid sh_name (0xffff) offset which goes past the end of the section name string tableStack dump:
0. Program arguments: /srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm /srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/test/tools/llvm-nm/Output/format-sysv-section.test.tmp2.o --format=sysv
 #0 0x00000000008af7c4 PrintStackTraceSignalHandler(void*) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x8af7c4)
 #1 0x00000000008ad8be llvm::sys::RunSignalHandlers() (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x8ad8be)
 #2 0x00000000008afbd8 SignalHandler(int) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x8afbd8)
 #3 0x00007f0a6b989730 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
 #4 0x00007f0a6b48d7bb raise (/lib/x86_64-linux-gnu/libc.so.6+0x377bb)
 #5 0x00007f0a6b478535 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22535)
 #6 0x000000000042004b llvm::Expected<llvm::StringRef>::fatalUncheckedExpected() const (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x42004b)
 #7 0x00000000008367f5 (/sv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x8367f5)
 #8 0x0000000000817b80 llvm::object::IRObjectFile::findBitcodeInObject(llvm::object::ObjectFile const&) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x817b80)
 #9 0x0000000000838416 llvm::object::SymbolicFile::createSymbolicFile(llvm::MemoryBufferRef, llvm::file_magic, llvm::LLVMContext*) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x838416)
#10 0x00000000007f36cb llvm::object::createBinary(llvm::MemoryBufferRef, llvm::LLVMContext*) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x7f36cb)
#11 0x0000000000413123 dumpSymbolNamesFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x413123)
#12 0x0000000000412e38 main (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x412e38)
#13 0x00007f0a6b47a09b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#14 0x00000000004120da _start (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x4120da)
FileCheck error: '-' is empty.
FileCheck command line:  /srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/test/tools/llvm-nm/format-sysv-section.test --check-prefix=ERR

--

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

5 years ago[llvm-nm] - Add a test case for case when we dump a symbol that belongs to a section...
George Rimar [Mon, 2 Sep 2019 13:54:45 +0000 (13:54 +0000)]
[llvm-nm] - Add a test case for case when we dump a symbol that belongs to a section with a broken sh_name.

It adds a test case for a problem fixed by D66976.

It was introduced by me in D66089.
The error reported was never consumed because of a wrong variable name used,
so it could fail when LLVM_ENABLE_ABI_BREAKING_CHECKS is used.

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

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

5 years ago[AMDGPU][MC][GFX10] Enabled null with 64-bit operands
Dmitry Preobrazhensky [Mon, 2 Sep 2019 13:42:25 +0000 (13:42 +0000)]
[AMDGPU][MC][GFX10] Enabled null with 64-bit operands

See Bug 42745: https://bugs.llvm.org/show_bug.cgi?id=42745

Reviewers: atamazov, arsenm

https://reviews.llvm.org/D65231

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

5 years ago[InstCombine] recognize bswap disguised as shufflevector
Sanjay Patel [Mon, 2 Sep 2019 13:33:20 +0000 (13:33 +0000)]
[InstCombine] recognize bswap disguised as shufflevector

bitcast <N x i8> (shuf X, undef, <N, N-1,...0>) to i{N*8} --> bswap (bitcast X to i{N*8})

In PR43146:
https://bugs.llvm.org/show_bug.cgi?id=43146
...we have a more complicated case where SLP is making a mess of bswap. This patch won't
do anything for that currently, but we need to improve bswap recognition in instcombine,
SLP, and/or a standalone pass to avoid that problem.

This is limited using the data-layout so we don't try to do this transform with actual
vector types. The backend does not appear to have folds to convert in either direction,
so we don't want to mess up something that is actually better lowered as a shuffle.

On x86, we're trading something like this:

  vmovd %edi, %xmm0
  vpshufb LCPI0_0(%rip), %xmm0, %xmm0 ## xmm0 = xmm0[3,2,1,0,u,u,u,u,u,u,u,u,u,u,u,u]
  vmovd %xmm0, %eax

For:

  movl %edi, %eax
  bswapl %eax

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

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

5 years ago[test] [llvm-dlltool] Improve test strictness a little. NFC.
Martin Storsjo [Mon, 2 Sep 2019 13:28:21 +0000 (13:28 +0000)]
[test] [llvm-dlltool] Improve test strictness a little. NFC.

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

5 years ago[llvm-dlltool] Handle external and internal names with differing decoration
Martin Storsjo [Mon, 2 Sep 2019 13:28:16 +0000 (13:28 +0000)]
[llvm-dlltool] Handle external and internal names with differing decoration

Also add a missed part of the test from SVN r369747.

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

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

5 years ago[llvm-dlltool] Remove support for implying output name
Martin Storsjo [Mon, 2 Sep 2019 13:28:07 +0000 (13:28 +0000)]
[llvm-dlltool] Remove support for implying output name

I don't see GNU dlltool supporting doing this; with only a -d option
and no -l option, GNU dlltool runs successfully but doesn't write any
output file.

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

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

5 years ago[AMDGPU][MC][GFX10] Corrected constant bus limit for 64-bit shift instructions
Dmitry Preobrazhensky [Mon, 2 Sep 2019 12:50:05 +0000 (12:50 +0000)]
[AMDGPU][MC][GFX10] Corrected constant bus limit for 64-bit shift instructions

See bug 42744: https://bugs.llvm.org/show_bug.cgi?id=42744

Reviewers: atamazov, arsenm

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

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

5 years ago[X86][BtVer2] Fix latency and throughput of conditional SIMD store instructions.
Andrea Di Biagio [Mon, 2 Sep 2019 12:32:28 +0000 (12:32 +0000)]
[X86][BtVer2] Fix latency and throughput of conditional SIMD store instructions.

On BtVer2 conditional SIMD stores are heavily microcoded.
The latency is directly proportional to the number of packed elements extracted
from the input vector. Also, according to micro-benchmarks, most of the
computation seems to be done in the integer unit.

Only a minority of the uOPs is executed by the FPU. The observed behaviour on
the FPU looks similar to this:
 - The input MASK value is moved to the Integer Unit
   -- [ a VMOVMSK-like uOP-executed on JFPU0].
 - In parallel, each element of the input XMM/YMM is extracted and then sent to
   the IntegerUnit through JFPU1.

As expected, a (conditional) store is executed for every extracted element.
Interestingly, a (speculative) load is executed for every extracted element too.
It is as-if a "LOAD - BIT_EXTRACT- CMOV" sequence of uOPs is repeated by the
integer unit for every contionally stored element.
VMASKMOVDQU is a special case: the number of speculative loads is always 2
(presumably, one load per quadword). That means, extra shifts and masking is
performed on (one of) the loaded quadwords before each conditional store (that
also explains the big number of non-FP uOPs retired).

This patch replaces the existing writes for conditional SIMD stores (i.e.
WriteFMaskedStore, and WriteFMaskedStoreY) with the following new writes:

  WriteFMaskedStore32  [ XMM Packed Single ]
  WriteFMaskedStore32Y [ YMM Packed Single ]
  WriteFMaskedStore64  [ XMM Packed Double ]
  WriteFMaskedStore64Y [ YMM Packed Double ]

Added a wrapper class named X86SchedWriteMaskMove in X86Schedule.td to describe
both RM and MR variants for conditional SIMD moves in a single tablegen
definition.
Instances of that class are then passed in input to multiclass avx_movmask_rm
when constructing MASKMOVPS/PD definitions.

Since this patch introduces new writes, I had to update all the X86 scheduling
models.

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

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

5 years ago[DebugInfo] LiveDebugValues: correctly discriminate kinds of variable locations
Jeremy Morse [Mon, 2 Sep 2019 12:28:36 +0000 (12:28 +0000)]
[DebugInfo] LiveDebugValues: correctly discriminate kinds of variable locations

The missing line added by this patch ensures that only spilt variable
locations are candidates for being restored from the stack. Otherwise,
register or constant-value information can be interpreted as a spill
location, through a union.

The added regression test replicates a scenario where this occurs: the
stack load from [rsp] causes the register-location DBG_VALUE to be
"restored" to rsi, when it should be left alone. See PR43058 for details.

Un x-fail a test that was suffering from this from a previous patch.

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

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

5 years ago[llvm-strings][test] Merge two closely related tests
James Henderson [Mon, 2 Sep 2019 11:42:30 +0000 (11:42 +0000)]
[llvm-strings][test] Merge two closely related tests

This is a follow-up to feedback on D66015.

Reviewed by: grimar

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

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Mon, 2 Sep 2019 11:34:47 +0000 (11:34 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370636 (git commit 8327fed9475a14c3376b4860c75370c730e08f33)

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

5 years ago[X86] combineHorizontalPredicateResult - pull out repeated getTargetLoweringInfo...
Simon Pilgrim [Mon, 2 Sep 2019 10:42:48 +0000 (10:42 +0000)]
[X86] combineHorizontalPredicateResult - pull out repeated getTargetLoweringInfo() calls. NFCI.

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Mon, 2 Sep 2019 10:38:08 +0000 (10:38 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[AMDGPU] Add test
Piotr Sobczak [Mon, 2 Sep 2019 10:02:54 +0000 (10:02 +0000)]
[AMDGPU] Add test

Summary:
Add test checking that the redundant immediate MOV instruction
(by-product of handling phi nodes) is not found in the generated code.

Reviewers: arsenm, anton-afanasyev, craig.topper, rtereshin, bogner

Reviewed By: arsenm

Subscribers: kzhuravl, yaxunl, dstuttard, tpr, t-tye, wdng, jvesely, nhaehnle, llvm-commits

Tags: #llvm

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

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

5 years ago[yaml2obj] - Allow overriding sh_name fields of the sections.
George Rimar [Mon, 2 Sep 2019 09:47:17 +0000 (09:47 +0000)]
[yaml2obj] - Allow overriding sh_name fields of the sections.

This is in line with the previous changes which allowed to
override the sh_offset/sh_size and useful for writing test cases.

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

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

5 years ago[DWARFVerifier] Verify GNU extensions of call site DWARF symbols
Djordje Todorovic [Mon, 2 Sep 2019 09:20:46 +0000 (09:20 +0000)]
[DWARFVerifier] Verify GNU extensions of call site DWARF symbols

Verify that the call site DWARF symbols (added during the implementation
of the debug entry values feature) are generated properly.

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

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

5 years ago[AArch64][GlobalISel] Fix zext narrowScalar to use the right type when creating
Amara Emerson [Mon, 2 Sep 2019 08:18:55 +0000 (08:18 +0000)]
[AArch64][GlobalISel] Fix zext narrowScalar to use the right type when creating
the merges.

Fixes PR43171.

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

5 years ago[X86] Add initial support for unfolding broadcast loads from arithmetic instructions...
Craig Topper [Sun, 1 Sep 2019 22:14:36 +0000 (22:14 +0000)]
[X86] Add initial support for unfolding broadcast loads from arithmetic instructions to enable LICM hoisting of the load

MachineLICM can hoist an invariant load, but if that load is folded it needs to be unfolded. On AVX512 sometimes this load is an broadcast load which we were previously unable to unfold. This patch adds initial support for that with a very basic list of supported instructions as a starting point.

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

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

5 years ago[DAGCombiner] improve throughput of shift+logic+shift
Sanjay Patel [Sun, 1 Sep 2019 18:38:15 +0000 (18:38 +0000)]
[DAGCombiner] improve throughput of shift+logic+shift

The motivating case for this is a long way from here:
https://bugs.llvm.org/show_bug.cgi?id=43146
...but I think this is where we have to start.

We need to canonicalize/optimize sequences of shift and logic to ease
pattern matching for things like bswap and improve perf in general.
But without the artificial limit of '!LegalTypes' (early combining),
there are a lot of test diffs, and not all are good.

In the minimal tests added for this proposal, x86 should have better
throughput in all cases. AArch64 is neutral for scalar tests because
it can fold shifts into bitwise logic ops.

There are 3 shift opcodes and 3 logic opcodes for a total of 9 possible patterns:
https://rise4fun.com/Alive/VlI
https://rise4fun.com/Alive/n1m
https://rise4fun.com/Alive/1Vn

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

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

5 years agoFix MSVC unreferenced formal parameter warning. NFCI.
Simon Pilgrim [Sun, 1 Sep 2019 16:04:51 +0000 (16:04 +0000)]
Fix MSVC unreferenced formal parameter warning. NFCI.

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

5 years agoFix MSVC unreferenced formal parameter warning. NFCI.
Simon Pilgrim [Sun, 1 Sep 2019 16:04:38 +0000 (16:04 +0000)]
Fix MSVC unreferenced formal parameter warning. NFCI.

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

5 years ago[X86][AVX] Rename + cleanup lowerShuffleAsLanePermuteAndBlend. NFCI.
Simon Pilgrim [Sun, 1 Sep 2019 16:04:28 +0000 (16:04 +0000)]
[X86][AVX] Rename + cleanup lowerShuffleAsLanePermuteAndBlend. NFCI.

Rename to lowerShuffleAsLanePermuteAndShuffle to make it clear that not just blends are performed.

Cleanup the in-lane shuffle mask generation to make it more obvious what's going on.

Some prep work noticed while investigating the poor shuffle code mentioned in D66004.

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

5 years agoFix shadow variable warning. NFCI.
Simon Pilgrim [Sun, 1 Sep 2019 13:10:18 +0000 (13:10 +0000)]
Fix shadow variable warning. NFCI.

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

5 years ago[ConstantFolding] Fix 'undef' folding for @llvm.[us]{add,sub}.with.overflow ops ...
Roman Lebedev [Sun, 1 Sep 2019 11:56:52 +0000 (11:56 +0000)]
[ConstantFolding] Fix 'undef' folding for @llvm.[us]{add,sub}.with.overflow ops (PR43188)

As we have already established/fixed in
  https://bugs.llvm.org/show_bug.cgi?id=42209
  https://reviews.llvm.org/D63065
  https://reviews.llvm.org/rL363522
the InstSimplify handling for @llvm.with.overflow ops with undefs
is correct. Therefore if ConstantFolding produces different results,
then it is wrong.

This duplication of code hints at the need for some refactoring,
but for now address the brokenness of ConstantFolding by
copying the known-good handling from rL363522.

Fixes https://bugs.llvm.org/show_bug.cgi?id=43188

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

5 years ago[ARM] Remove MVE masked loads/stores
David Green [Sun, 1 Sep 2019 10:11:40 +0000 (10:11 +0000)]
[ARM] Remove MVE masked loads/stores

These were never enabled correctly and are causing other problems. Taking them
out for the moment, whilst we work on the issues.

This reverts r370329.

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

5 years ago[TargetLowering] Fix Bugzilla ID 43183 to avoid soften comparison broken with constan...
Shiva Chen [Sun, 1 Sep 2019 04:52:54 +0000 (04:52 +0000)]
[TargetLowering] Fix Bugzilla ID 43183 to avoid soften comparison broken with constant inputs

Summary:
  This fixes the bugzilla id 43183 which triggerd by the following commit:
  [RISCV] Avoid generating AssertZext for LP64 ABI when lowering floating LibCall

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

5 years agoAMDGPU: Remove unused custom node definition
Matt Arsenault [Sun, 1 Sep 2019 02:00:08 +0000 (02:00 +0000)]
AMDGPU: Remove unused custom node definition

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

5 years ago[GlobalISel][NFC] Regression test cases for aarch64 legalizer (s128 sext+icmp).
Puyan Lotfi [Sun, 1 Sep 2019 00:45:28 +0000 (00:45 +0000)]
[GlobalISel][NFC] Regression test cases for aarch64 legalizer (s128 sext+icmp).

There were legalizer asserts in aarch64 globalisel (in debug mode) with s128
sext+icmp before r367060 and r366943 landed. These are just a couple reduced
mir and ir regression tests that came from a build where these were encountered.

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

5 years ago[X86] Replace some COPY_TO_REGCLASS from GR32/GR64 to VR128 in isel patterns with...
Craig Topper [Sat, 31 Aug 2019 23:52:25 +0000 (23:52 +0000)]
[X86] Replace some COPY_TO_REGCLASS from GR32/GR64 to VR128 in isel patterns with VMOVDI2PDIrr/VMOV64toPQIrr.

This is what the copies will eventually be turned into. We don't
use COPY_TO_REGCLASS for scalar_to_vector patterns. So we should
use the real instruction here too.

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

5 years ago[X86] Compress the flag bits in the folding tables to make room for more bits in...
Craig Topper [Sat, 31 Aug 2019 23:52:21 +0000 (23:52 +0000)]
[X86] Compress the flag bits in the folding tables to make room for more bits in an upcoming patch.

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

5 years ago[NFC] Fixed -Wdocumentation warning
David Bolvansky [Sat, 31 Aug 2019 18:44:57 +0000 (18:44 +0000)]
[NFC] Fixed -Wdocumentation warning

/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def:98:1: warning: not a Doxygen trailing comment [-Wdocumentation]
1 warning generated.

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

5 years ago[InstCombine] mempcpy(d,s,n) to memcpy(d,s,n) + n
David Bolvansky [Sat, 31 Aug 2019 18:19:05 +0000 (18:19 +0000)]
[InstCombine] mempcpy(d,s,n) to memcpy(d,s,n) + n

Summary:
Back-end currently expands mempcpy, but middle-end should work with memcpy instead of mempcpy to enable more memcpy-optimization.

GCC backend emits mempcpy, so LLVM backend could form it too, if we know mempcpy libcall is better than memcpy + n.
https://godbolt.org/z/dOCG96

Reviewers: efriedma, spatel, craig.topper, RKSimon, jdoerfert

Reviewed By: efriedma

Subscribers: hjl.tools, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] EltsFromConsecutiveLoads - Don't confuse elt count with vector element count...
Simon Pilgrim [Sat, 31 Aug 2019 16:21:31 +0000 (16:21 +0000)]
[X86] EltsFromConsecutiveLoads - Don't confuse elt count with vector element count (PR43170)

EltsFromConsecutiveLoads was assuming that the number of input elts was the same as the number of elements in the output vector type when creating a zeroing shuffle, causing an assert when subvectors were being combined instead of just scalars.

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

5 years ago[X86][AVX512] Regenerate tests with common prefixes
Simon Pilgrim [Sat, 31 Aug 2019 16:04:39 +0000 (16:04 +0000)]
[X86][AVX512] Regenerate tests with common prefixes

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

5 years ago[AArch64][x86] increase value type coverage in tests; NFC
Sanjay Patel [Sat, 31 Aug 2019 15:49:16 +0000 (15:49 +0000)]
[AArch64][x86] increase value type coverage in tests; NFC
This goes with D67021.

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

5 years agoFix shadow variable warning by making CondCodes names more explicit. NFCI.
Simon Pilgrim [Sat, 31 Aug 2019 15:19:59 +0000 (15:19 +0000)]
Fix shadow variable warning by making CondCodes names more explicit. NFCI.

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Sat, 31 Aug 2019 15:15:39 +0000 (15:15 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370584 (git commit afcb3de117265a69d21e5673356e925a454d7d02)

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