]> granicus.if.org Git - llvm/log
llvm
5 years agoFix -Wmisleading-indentation gcc7 warning. NFCI.
Simon Pilgrim [Thu, 21 Mar 2019 11:58:22 +0000 (11:58 +0000)]
Fix -Wmisleading-indentation gcc7 warning. NFCI.

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

5 years ago[AArch64] Allow -mattr=tpidr-el[1|2|3]
Oliver Stannard [Thu, 21 Mar 2019 11:30:17 +0000 (11:30 +0000)]
[AArch64] Allow -mattr=tpidr-el[1|2|3]

Added subtarget features for AArch64 to use TPIDR_EL[1|2|3] as the TLS base
register, rather than the default TPIDR_EL0.

Patch by Philip Derrin!

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

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

5 years ago[SelectionDAG] Add scalarization of ABS node (PR41149)
Simon Pilgrim [Thu, 21 Mar 2019 11:18:54 +0000 (11:18 +0000)]
[SelectionDAG] Add scalarization of ABS node (PR41149)

Patch by: @ikulagin (Ivan Kulagin)

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

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

5 years agoFix two more issues with r356652
Pavel Labath [Thu, 21 Mar 2019 10:21:55 +0000 (10:21 +0000)]
Fix two more issues with r356652

The first problem was a use-after-free in the tests (detected by asan
bots). The temporary array created for the "create" call is guaranteed
to live only until the end of the statement. The fix there is to store
the test data in a local variable to ensure it has the right lifetime

The second issue is broken BUILD_SHARED_LIBS build, which I fix by
adding the appropriate BinaryFormat dependency to the Object unit tests.

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

5 years ago[RISCV][NFC] Remove old CHECK lines from linker-relaxation.s test
Alex Bradbury [Thu, 21 Mar 2019 09:53:19 +0000 (09:53 +0000)]
[RISCV][NFC] Remove old CHECK lines from linker-relaxation.s test

The RELOC: check lines are no longer used.

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

5 years agoAttempt to fix modules build for r356652
Pavel Labath [Thu, 21 Mar 2019 09:44:07 +0000 (09:44 +0000)]
Attempt to fix modules build for r356652

The commit added a new .def file. This adds it to the list of textual
headers.

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

5 years ago[Object] Add basic minidump support
Pavel Labath [Thu, 21 Mar 2019 09:18:59 +0000 (09:18 +0000)]
[Object] Add basic minidump support

Summary:
This patch adds basic support for reading minidump files. It contains
the definitions of various important minidump data structures (header,
stream directory), and of one minidump stream (SystemInfo). The ability
to read other streams will be added in follow-up patches. However, all
streams can be read even now as raw data, which means lldb's minidump
support (where this code is taken from) can be immediately rebased on
top of this patch as soon as it lands.

As we don't have any support for generating minidump files (yet), this
tests the code via unit tests with some small handcrafted binaries in
the form of c char arrays.

Reviewers: Bigcheese, jhenderson, zturner

Subscribers: srhines, dschuff, mgorny, fedor.sergeev, lemo, clayborg, JDevlieghere, aprantl, lldb-commits, llvm-commits

Tags: #llvm

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

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

5 years ago[BasicAA] Use DenseMap::try_emplace after D59151. NFC
Fangrui Song [Thu, 21 Mar 2019 08:47:40 +0000 (08:47 +0000)]
[BasicAA] Use DenseMap::try_emplace after D59151. NFC

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

5 years agoSilence warning about unused variable in builds without asserts [NFC]
Mikael Holmen [Thu, 21 Mar 2019 07:54:44 +0000 (07:54 +0000)]
Silence warning about unused variable in builds without asserts [NFC]

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

5 years ago[ScalarizeMaskedMemIntrinsics] Reverse some if conditions to reduce indentations...
Craig Topper [Thu, 21 Mar 2019 05:54:37 +0000 (05:54 +0000)]
[ScalarizeMaskedMemIntrinsics] Reverse some if conditions to reduce indentations to remove curly braces.

Pre-commit for D59180

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

5 years ago[InstCombine] Add test case for PR41164. NFC
Craig Topper [Thu, 21 Mar 2019 05:33:10 +0000 (05:33 +0000)]
[InstCombine] Add test case for PR41164. NFC

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

5 years ago[BasicAA] Reduce no of map seaches [NFCI].
Alina Sbirlea [Thu, 21 Mar 2019 05:02:05 +0000 (05:02 +0000)]
[BasicAA] Reduce no of map seaches [NFCI].

Summary:
This is a refactoring patch.
- Reduce the number of map searches by reusing the iterator.
- Add asserts to check that the entry is in the cache, as this is something BasicAA relies on to avoid infinite recursion.

Reviewers: chandlerc, aschwaighofer

Subscribers: sanjoy, jlebar, llvm-commits

Tags: #llvm

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

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

5 years ago[instcombine] Add some todos, and arrange code for readibility
Philip Reames [Thu, 21 Mar 2019 03:23:40 +0000 (03:23 +0000)]
[instcombine] Add some todos, and arrange code for readibility

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

5 years ago[MSSA] Delete move ctor; remove dynamic never-moved verification
George Burgess IV [Thu, 21 Mar 2019 03:11:34 +0000 (03:11 +0000)]
[MSSA] Delete move ctor; remove dynamic never-moved verification

Code archaeology in D59315 revealed that MSSA should never be moved.
Rather than trying to check dynamically that this hasn't happened in the
verify() functions of Walkers, it's likely best to just delete its move
constructor.

Since all these verify() functions did is check that MSSA hasn't moved,
this allows us to remove these verify functions.

I can readd the verification checks if someone's super concerned about
us trying to `memcpy` MemorySSA or something somewhere, but I imagine we
have other problems if we're trying anything like that...

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

5 years ago[X86] Add CMPXCHG8B feature flag. Set it for all CPUs except i386/i486 including...
Craig Topper [Wed, 20 Mar 2019 23:35:49 +0000 (23:35 +0000)]
[X86] Add CMPXCHG8B feature flag. Set it for all CPUs except i386/i486 including 'generic'. Disable use of CMPXCHG8B when this flag isn't set.

CMPXCHG8B was introduced on i586/pentium generation.

If its not enabled, limit the atomic width to 32 bits so the AtomicExpandPass will expand to lib calls. Unclear if we should be using a different limit for other configs. The default is 1024 and experimentation shows that using an i256 atomic will cause a crash in SelectionDAG.

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

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

5 years agoFix Mach-O bind and rebase validation errors in libObject
Michael Trent [Wed, 20 Mar 2019 23:21:16 +0000 (23:21 +0000)]
Fix Mach-O bind and rebase validation errors in libObject

Summary:
llvm-objdump (via libObject) validates DYLD_INFO rebase and bind
entries against the basic structure found in the Mach-O file before
evaluating the contents of those entries. Certain malformed Mach-Os can
defeat the validation check and force llvm-objdump (libObject) to crash.

The previous logic verified a rebase or bind started in a valid Mach-O
section, but did not verify that the section wholely contained the
fixup. It also generally allows rebases or binds to start immediately
after a valid section even if that range is not itself part of a valid
section. Finally, bind and rebase opcodes that indicate more than one
fixup (apply N times...) are not completely validated: only the first
and final fixups are checked.

The previous logic also rejected certain binaries as false positives.
Some bind and rebase opcodes can modify the state machine such that the
next bind or rebase will fail. libObject will reject these opcodes as
invalid in order to be helpful and print an error message associated
with the instruction that caused the problem, even though the binary is
not actually illegal until it consumes the invalid state in the state
machine. In other words, libObject may reject a Mach-O binary that
Apple's dynamic linker may consider legal. The original version of
macho-rebase-add-addr-uleb-too-big is an example of such a binary.

I have replaced the existing checkSegAndOffset and checkCountAndSkip
functions with a single function, checkSegAndOffsets, which validates
all of the fixups realized by a DYLD_INFO opcode. checkSegAndOffsets
verifies that a Mach-O section fully contains each fixup. Every fixup
realized by an opcode is validated, and some (but not all!)
inconsistencies in the state machine are allowed until a fixup is
realized. This means that libObject may fail on an opcode that realizes
a fixup, not on the opcode that introduced the arithmetic error.

Existing test cases have been modified to reflect the changes in error
messages returned by libObject. What's more, the test case for
macho-rebase-add-addr-uleb-too-big has been modified so that it actually
triggers the error condition; the new code in libObject considers the
original test binary "legal".

rdar://47797757

Reviewers: lhames, pete, ab

Reviewed By: pete

Subscribers: rupprecht, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago[WebAssembly][NFC] Fix formatting error from rL356610
Thomas Lively [Wed, 20 Mar 2019 22:34:34 +0000 (22:34 +0000)]
[WebAssembly][NFC] Fix formatting error from rL356610

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

5 years ago[AMDGPU] Do not generate spurious PAL metadata
Tim Renouf [Wed, 20 Mar 2019 22:02:09 +0000 (22:02 +0000)]
[AMDGPU] Do not generate spurious PAL metadata

My previous fix rL356591 "[AMDGPU] Added MsgPack format PAL metadata"
accidentally caused a spurious PAL metadata .note record to be emitted
for any AMDGPU output. That caused failures in the lld test
amdgpu-relocs.s. Fixed.

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

Change-Id: Ie04a2aaae890dcd490f22c89edf9913a77ce070e

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

5 years ago[InstCombine] Add additional sub nsw inference tests; NFC
Nikita Popov [Wed, 20 Mar 2019 21:42:17 +0000 (21:42 +0000)]
[InstCombine] Add additional sub nsw inference tests; NFC

nsw can be determined based on known bits here, but currently
isn't.

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

5 years agoAllow machine dce to remove uses in the same instruction
Stanislav Mekhanoshin [Wed, 20 Mar 2019 21:42:05 +0000 (21:42 +0000)]
Allow machine dce to remove uses in the same instruction

Machine DCE cannot remove a dead definition if there are non-dbg uses.
A use however can be in the same instruction:

  dead %0 = INST %0

Such instructions sometimes created by Detect dead lanes pass.

Allow this instruction to be deleted despite the use if the only use
belongs to the same instruction.

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

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

5 years ago[X86] Call lowerShuffleAsBitMask for 512-bit vectors in lowerShuffleAsBlend.
Craig Topper [Wed, 20 Mar 2019 21:30:20 +0000 (21:30 +0000)]
[X86] Call lowerShuffleAsBitMask for 512-bit vectors in lowerShuffleAsBlend.

This patch enables the use of lowerShuffleAsBitMask for 512-bit blends before
falling back to move immedate, GPR to k-register, and masked op.

I had to make some changes to support v8i64 when i64 is not a legal type. And to
support floating point types.

This trades a load for the move immediate and GPR move which is higher latency.
But its probably better for register pressure not having to hop through other
register classes. The load+and should play better with LICM and
rematerialization I think.

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

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

5 years ago[AMDGPU] Fix dependency on `BinaryFormat`
Michael Liao [Wed, 20 Mar 2019 21:22:27 +0000 (21:22 +0000)]
[AMDGPU] Fix dependency on `BinaryFormat`

Summary: - The linking is broken when this library is built as shared one.

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

Tags: #llvm

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

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

5 years agoAMDGPU: Don't look for constant in insert/extract_vector_elt regbankselect
Matt Arsenault [Wed, 20 Mar 2019 20:41:34 +0000 (20:41 +0000)]
AMDGPU: Don't look for constant in insert/extract_vector_elt regbankselect

The constantness shouldn't change the register bank choice. We also
don't need to restrict this to only indexing VGPRs, since it's
possible to index SGPRs (but SelectionDAG made using this
difficult). Allow directly indexing SGPRs when appropriate.

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

5 years ago[WebAssembly] Target features section
Thomas Lively [Wed, 20 Mar 2019 20:26:45 +0000 (20:26 +0000)]
[WebAssembly] Target features section

Summary:
Implements a new target features section in assembly and object files
that records what features are used, required, and disallowed in
WebAssembly objects. The linker uses this information to ensure that
all objects participating in a link are feature-compatible and records
the set of used features in the output binary for use by optimizers
and other tools later in the toolchain.

The "atomics" feature is always required or disallowed to prevent
linking code with stripped atomics into multithreaded binaries. Other
features are marked used if they are enabled globally or on any
function in a module.

Future CLs will add linker flags for ignoring feature compatibility
checks and for specifying the set of allowed features, implement using
the presence of the "atomics" feature to control the type of memory
and segments in the linked binary, and add front-end flags for
relaxing the linkage policy for atomics.

Reviewers: aheejin, sbc100, dschuff

Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Fix clamp bit DAG operand
Michael Liao [Wed, 20 Mar 2019 20:18:56 +0000 (20:18 +0000)]
[AMDGPU] Fix clamp bit DAG operand

Summary:
- Should use `targetconstant` instead of `constant` operand for clamp
  bit, which is expected as an immediate operand. Under certain
  conditions, such as a common `i1 false` constant is used in other
  place and selected before the instruction with clamp bit, register
  operand may be added instead of immediate one. Use `targetcosntant` to
  enforce that.

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

Tags: #llvm

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

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

5 years ago[ARC] Add ARCOptAddrMode pass to generate postincrement loads/stores.
Pete Couperus [Wed, 20 Mar 2019 20:06:21 +0000 (20:06 +0000)]
[ARC] Add ARCOptAddrMode pass to generate postincrement loads/stores.

Build on newly introduced ARC postincrement loads/stores from r356200.

Patch By Denis Antrushin! <denis@synopsys.com>

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

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

5 years ago[AArch64] Fix formatting (NFC)
Evandro Menezes [Wed, 20 Mar 2019 19:57:59 +0000 (19:57 +0000)]
[AArch64] Fix formatting (NFC)

Indent macro instances properly.

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

5 years agoAMDHSA: Fix COMPUTE_PGM_RSRC2.USER_SGPR calculation when parsing ISA assembly
Konstantin Zhuravlyov [Wed, 20 Mar 2019 19:44:47 +0000 (19:44 +0000)]
AMDHSA: Fix COMPUTE_PGM_RSRC2.USER_SGPR calculation when parsing ISA assembly

It must match https://llvm.org/docs/AMDGPUUsage.html#initial-kernel-execution-state

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

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

5 years ago[ARM] Eliminate redundant "mov rN, sp" instructions in Thumb1.
Eli Friedman [Wed, 20 Mar 2019 19:40:45 +0000 (19:40 +0000)]
[ARM] Eliminate redundant "mov rN, sp" instructions in Thumb1.

This takes sequences like "mov r4, sp; str r0, [r4]", and optimizes them
to something like "str r0, [sp]".

For regular stack variables, this optimization was already implemented:
we lower loads and stores using frame indexes, which are expanded later.
However, when constructing a call frame for a call with more than four
arguments, the existing optimization doesn't apply.  We need to use
stores which are actually relative to the current value of sp, and don't
have an associated frame index.

This patch adds a special case to handle that construct.  At the DAG
level, this is an ISD::STORE where the address is a CopyFromReg from SP
(plus a small constant offset).

This applies only to Thumb1: in Thumb2 or ARM mode, a regular store
instruction can access SP directly, so the COPY gets eliminated by
existing code.

The change to ARMDAGToDAGISel::SelectThumbAddrModeSP is a related
cleanup: we shouldn't pretend that it can select anything other than
frame indexes.

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

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

5 years ago[Linker] Fix crash handling appending linkage
Rafael Auler [Wed, 20 Mar 2019 19:20:07 +0000 (19:20 +0000)]
[Linker] Fix crash handling appending linkage

Summary:
When linking two llvm.used arrays, if the resulting merged
array ends up with duplicated elements (with the same name) but with
different types, the IRLinker was crashing. This was supposed to be
legal, as the IRLinker bitcasts elements to match types in these
situations.

This bug was exposed by D56928 in clang to support attribute used
in member functions of class templates. Crash happened when self-hosting
with LTO. Since LLVM depends on attribute used to generate code
for the dump() method, ubiquitous in the code base, many input bc
had a definition of this method referenced in their llvm.used array.
Some of these classes got optimized, changing the type of the first
parameter (this) in the dump method, leading to a scenario with a
pool of valid definitions but some with a different type, triggering
this bug.

This is a memory bug: ValueMapper depends on (calls) the materializer
provided by IRLinker, and this materializer was freely calling RAUW
methods whenever a global definition was updated in the temporary merged
output file. However, replaceAllUsesWith may or may not destroy
constants that use this global. If the linked definition has a type
mismatch regarding the new def and the old def, the materializer would
bitcast the old type to the new type and the elements of the llvm.used
array, which already uses bitcast to i8*, would end up with elements
cascading two bitcasts. RAUW would then indirectly call the
constantfolder to update the constant to the new ref, which would,
instead of updating the constant, destroy it to be able to create
a new constant that folds the two bitcasts into one. The problem is that
ValueMapper works with pointers to the same constants that may be
getting destroyed by RAUW. Obviously, RAUW can update references in the
Module to do not use the old destroyed constant, but it can't update
ValueMapper's internal pointers to these constants, which are now
invalid.

The approach here is to move the task of RAUWing old definitions
outside of the materializer.

Test Plan:
Added LIT test case, tested clang self-hosting with D56928 and
verified it works

Reviewed By: efriedma

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

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

5 years ago[NFC] Fix brace indentation.
Alina Sbirlea [Wed, 20 Mar 2019 19:18:55 +0000 (19:18 +0000)]
[NFC] Fix brace indentation.

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

5 years agoResubmit r356511 "[TailCallElim] Add tailcall elimination pass to LTO pipelines"
Robert Lougher [Wed, 20 Mar 2019 19:08:18 +0000 (19:08 +0000)]
Resubmit r356511 "[TailCallElim] Add tailcall elimination pass to LTO pipelines"

Failing LLD tests have been fixed in r356593.

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

5 years ago[AMDGPU] Added MsgPack format PAL metadata
Tim Renouf [Wed, 20 Mar 2019 18:47:21 +0000 (18:47 +0000)]
[AMDGPU] Added MsgPack format PAL metadata

Summary:
PAL metadata now supports both the old linear reg=val pairs format and
the new MsgPack format.

The MsgPack format uses YAML as its textual representation. On output to
YAML, a mnemonic name is provided for some hardware registers.

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

Change-Id: I2bbaabaaca4b3574f7e03b80fbef7c7a69d06a94

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

5 years agoSimplify operands of masked stores and scatters based on demanded elements
Philip Reames [Wed, 20 Mar 2019 18:44:58 +0000 (18:44 +0000)]
Simplify operands of masked stores and scatters based on demanded elements

If we know we're not storing a lane, we don't need to compute the lane. This could be improved by using the undef element result to further prune the mask, but I want to separate that into its own change since it's relatively likely to expose other problems.

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

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

5 years ago[LICM & MemorySSA] Don't sink/hoist stores in the presence of ordered loads.
Alina Sbirlea [Wed, 20 Mar 2019 18:33:37 +0000 (18:33 +0000)]
[LICM & MemorySSA] Don't sink/hoist stores in the presence of ordered loads.

Summary:
Before this patch, if any Use existed in the loop, with a defining
access in the loop, we conservatively decide to not move the store.
What this approach was missing, is that ordered loads are not Uses, they're Defs
in MemorySSA. So, even when the clobbering walker does not find that
volatile load to interfere, we still cannot hoist a store past a
volatile load.
Resolves PR41140.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

Tags: #llvm

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

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

5 years ago[ValueTracking] Compute range for abs without nsw
Nikita Popov [Wed, 20 Mar 2019 18:16:02 +0000 (18:16 +0000)]
[ValueTracking] Compute range for abs without nsw

This is a small followup to D59511. The code that was moved into
computeConstantRange() there is a bit overly conversative: If the
abs is not nsw, it does not compute any range. However, abs without
nsw still has a well-defined contiguous unsigned range from 0 to
SIGNED_MIN. This is a lot less useful than the usual 0 to SIGNED_MAX
range, but if we're already here we might as well specify it...

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

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

5 years ago[InstCombine] Fold add nuw + uadd.with.overflow
Nikita Popov [Wed, 20 Mar 2019 18:00:27 +0000 (18:00 +0000)]
[InstCombine] Fold add nuw + uadd.with.overflow

Fold add nuw and uadd.with.overflow with constants if the
addition does not overflow.

Part of https://bugs.llvm.org/show_bug.cgi?id=38146.

Patch by Dan Robertson.

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

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

5 years ago[Remarks] Fix mismatched delete due to missing virtual destructor
Jordan Rupprecht [Wed, 20 Mar 2019 17:44:24 +0000 (17:44 +0000)]
[Remarks] Fix mismatched delete due to missing virtual destructor

This fixes an asan failure introduced in r356519.

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

5 years ago[AMDGPU] Factored PAL metadata handling out into its own class
Tim Renouf [Wed, 20 Mar 2019 17:42:00 +0000 (17:42 +0000)]
[AMDGPU] Factored PAL metadata handling out into its own class

Summary:
This commit introduces a new AMDGPUPALMetadata class that:
* is inside the AMDGPU target;
* keeps an in-memory representation of PAL metadata;
* provides a method to read the frontend-supplied metadata from LLVM IR;
* provides methods for the asm printer to set metadata items;
* provides methods to write the metadata as a binary blob to put in a
  .note record or as an asm directive;
* provides a method to read the metadata as a binary blob from a .note
  record.

Because llvm-readobj cannot call directly into a target, I had to remove
llvm-readobj's ability to dump PAL metadata, pending a resolution to
https://reviews.llvm.org/D52821

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

Change-Id: I756dc830894fcb6850324cdcfa87c0120eb2cf64

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

5 years agoRemove HAVE_REALPATH from config.h
Nico Weber [Wed, 20 Mar 2019 17:26:11 +0000 (17:26 +0000)]
Remove HAVE_REALPATH from config.h

Its last use was removed in r352916.
No behavior change.

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

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

5 years ago[AMDGPU][MC] Corrected checks for DS offset0 range
Dmitry Preobrazhensky [Wed, 20 Mar 2019 17:13:58 +0000 (17:13 +0000)]
[AMDGPU][MC] Corrected checks for DS offset0 range

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

Reviewers: artem.tamazov, arsenm

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

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

5 years ago[CGP] fix formatting; NFC
Sanjay Patel [Wed, 20 Mar 2019 16:47:53 +0000 (16:47 +0000)]
[CGP] fix formatting; NFC

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

5 years agoFix sanitizer failures for 356550.
Clement Courbet [Wed, 20 Mar 2019 16:14:59 +0000 (16:14 +0000)]
Fix sanitizer failures for 356550.

Mark bcmp as having optimized codegen, so that asan can detect it and
mark users as nobuiltin.

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

5 years agogn build: Add build files for some clang-tools-extra
Nico Weber [Wed, 20 Mar 2019 16:14:16 +0000 (16:14 +0000)]
gn build: Add build files for some clang-tools-extra

Adds clang-change-namespace, clang-move, clang-query,
clang-reorder-fields.

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

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

5 years ago[CGP] convert chain of 'if' to 'switch'; NFC
Sanjay Patel [Wed, 20 Mar 2019 15:53:06 +0000 (15:53 +0000)]
[CGP] convert chain of 'if' to 'switch'; NFC

This should be extended, but CGP does some strange things,
so I'm intentionally not changing the potential order of
any transforms yet.

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

5 years agogn build: Merge r356508
Nico Weber [Wed, 20 Mar 2019 15:41:25 +0000 (15:41 +0000)]
gn build: Merge r356508

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

5 years ago[AMDGPU][MC][GFX9] Added support of operands shared_base, shared_limit, private_base...
Dmitry Preobrazhensky [Wed, 20 Mar 2019 15:40:52 +0000 (15:40 +0000)]
[AMDGPU][MC][GFX9] Added support of operands shared_base, shared_limit, private_base, private_limit, pops_exiting_wave_id

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

Reviewers: artem.tamazov, arsenm, rampitec

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

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

5 years agogn build: Merge r356519
Nico Weber [Wed, 20 Mar 2019 15:36:11 +0000 (15:36 +0000)]
gn build: Merge r356519

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

5 years ago[CGP][x86] add tests for usubo regression (PR41129); NFC
Sanjay Patel [Wed, 20 Mar 2019 15:02:35 +0000 (15:02 +0000)]
[CGP][x86] add tests for usubo regression (PR41129); NFC

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

5 years agoFollow up of rL356555
Sjoerd Meijer [Wed, 20 Mar 2019 14:33:39 +0000 (14:33 +0000)]
Follow up of rL356555

Pacify buildbot that complained about a member function not marked with
override.

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

5 years ago[TTI] getMemcpyCost
Sjoerd Meijer [Wed, 20 Mar 2019 14:15:46 +0000 (14:15 +0000)]
[TTI] getMemcpyCost

This adds new function getMemcpyCost to TTI so that the cost of a memcpy can be
modeled and queried. The default implementation returns Expensive, but targets
can override this function to model the cost more accurately.

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

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

5 years ago[llvm-objcopy] - Use replaceSectionReferences to update the sections for symbols...
George Rimar [Wed, 20 Mar 2019 13:57:47 +0000 (13:57 +0000)]
[llvm-objcopy] - Use replaceSectionReferences to update the sections for symbols in symbol table.

If the compression was used and we had a symbol not involved in relocation,
we never updated its section and it was silently removed from the output.

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

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

5 years agoRemove out of date comment. NFCI.
Simon Pilgrim [Wed, 20 Mar 2019 12:24:15 +0000 (12:24 +0000)]
Remove out of date comment. NFCI.

DAGCombiner::convertBuildVecZextToZext just requires the extractions to be sequential, they don't have to start from 0'th index.

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

5 years ago[ExpandMemCmp] Trigger on bcmp too.
Clement Courbet [Wed, 20 Mar 2019 11:51:11 +0000 (11:51 +0000)]
[ExpandMemCmp] Trigger on bcmp too.

Summary: Fixes 41150.

Reviewers: gchatelet

Subscribers: hiraditya, llvm-commits, ckennelly, sbenza, jyknight

Tags: #llvm

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

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

5 years ago[X86] Use getConstantOperandAPInt to detect out-of-range shifts.
Simon Pilgrim [Wed, 20 Mar 2019 11:41:52 +0000 (11:41 +0000)]
[X86] Use getConstantOperandAPInt to detect out-of-range shifts.

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

5 years ago[X86] Remove X86 specific dag nodes for RDTSC/RDTSCP/RDPMC. NFCI
Andrea Di Biagio [Wed, 20 Mar 2019 11:21:15 +0000 (11:21 +0000)]
[X86] Remove X86 specific dag nodes for RDTSC/RDTSCP/RDPMC. NFCI

This patch removes the following dag node opcodes from namespace X86ISD:

RDTSC_DAG,
RDTSCP_DAG,
RDPMC_DAG

The logic that expands RDTSC/RDPMC/XGETBV intrinsics is basically the same. The
only differences are:

    RDTSC/RDTSCP don't implicitly read ECX.
    RDTSCP also implicitly writes ECX.

I moved the common expansion logic into a helper function with the goal to get
rid of code repetition. That helper is now used for the expansion of
RDTSC/RDTSCP/RDPMC/XGETBV intrinsics.

No functional change intended.

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

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

5 years ago[perf][DebugInfo] follow up for "add SectionedAddress to DebugInfo interfaces"
Sylvestre Ledru [Wed, 20 Mar 2019 10:02:18 +0000 (10:02 +0000)]
[perf][DebugInfo] follow up for "add SectionedAddress to DebugInfo interfaces"

Summary: Fix the build failure when perf jit is enabled

Reviewers: avl, dblaikie

Reviewed By: avl

Subscribers: modocache, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Allow MIMG with no uses in adjustWritemask in isel
David Stuttard [Wed, 20 Mar 2019 09:29:55 +0000 (09:29 +0000)]
[AMDGPU] Allow MIMG with no uses in adjustWritemask in isel

Summary:
If an MIMG instruction has managed to get through to adjustWritemask in isel but
has no uses (and doesn't enable TFC) then prevent an assertion by not attempting
to adjust the writemask.

The instruction will be removed anyway.

Change-Id: I9a5dba6bafe1f35ac99c1b73df390936e2ac27a7

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

Tags: #llvm

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

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

5 years ago[instcombine] Add todos describing missing transforms for masked.* intrinsics
Philip Reames [Wed, 20 Mar 2019 03:36:05 +0000 (03:36 +0000)]
[instcombine] Add todos describing missing transforms for masked.* intrinsics

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

5 years ago[X86] Remove X32 check lines from a test that doesn't have an X32 FileCheck prefix...
Craig Topper [Wed, 20 Mar 2019 03:13:28 +0000 (03:13 +0000)]
[X86] Remove X32 check lines from a test that doesn't have an X32 FileCheck prefix. Regenerate the test using update_llc_test_checks. NFC

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

5 years agoRetry to add workaround to build scoped enums with VS2015. NFCI.
Douglas Yung [Wed, 20 Mar 2019 01:52:40 +0000 (01:52 +0000)]
Retry to add workaround to build scoped enums with VS2015. NFCI.

We need this as we still have internal build bots on VS2015.

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

5 years agoRevert "Add workaround to build scoped enums with VS2015. NFCI."
Douglas Yung [Wed, 20 Mar 2019 00:41:12 +0000 (00:41 +0000)]
Revert "Add workaround to build scoped enums with VS2015. NFCI."

This reverts commit 6080a6fb1949a2bdf053245d6062c7bf58dae7a6 (r356532).

Clang does not accept this syntax, so reverting this until I can find something that works across all compilers.

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

5 years agoAdd workaround to build scoped enums with VS2015. NFCI.
Douglas Yung [Wed, 20 Mar 2019 00:26:56 +0000 (00:26 +0000)]
Add workaround to build scoped enums with VS2015. NFCI.

We need this as we still have internal build bots on VS2015.

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

5 years ago[X86] Re-disable cmpxchg16b for 32-bit mode assembly parsing.
Craig Topper [Tue, 19 Mar 2019 23:57:16 +0000 (23:57 +0000)]
[X86] Re-disable cmpxchg16b for 32-bit mode assembly parsing.

This was broken recently when I factored the 64 bit mode check into hasCmpxchg16 without thinking about the AssemblerPredicate.

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

5 years ago[ARM] Make sure to save/restore LR when we use tBfar.
Eli Friedman [Tue, 19 Mar 2019 21:48:08 +0000 (21:48 +0000)]
[ARM] Make sure to save/restore LR when we use tBfar.

This change does two things. One, it ensures compilation will abort
instead of miscompiling if ARMFrameLowering::determineCalleeSaves
chooses not to save LR in a case where it's necessary.  Two, it changes
the way we estimate the size of a function to be more conservative in
the presence of constant pool entries and jump tables.

EstimateFunctionSizeInBytes probably still isn't really conservative
enough, but I'm not sure how we can come up with a reliable estimate
before constant islands runs.

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

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

5 years ago[AArch64][GlobalISel] Add an optimization to select vector DUP instructions.
Amara Emerson [Tue, 19 Mar 2019 21:43:05 +0000 (21:43 +0000)]
[AArch64][GlobalISel] Add an optimization to select vector DUP instructions.

This adds pattern matching for the insert+shufflevector sequence so we can
generate dup instructions instead of the current TBL sequence.

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

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

5 years ago[AArch64][GlobalISel] Make v4s32 G_IMPLICIT_DEF legal.
Amara Emerson [Tue, 19 Mar 2019 21:43:02 +0000 (21:43 +0000)]
[AArch64][GlobalISel] Make v4s32 G_IMPLICIT_DEF legal.

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

5 years agoRemove MSVC compat hack since the inline keyword was added in 2015
Reid Kleckner [Tue, 19 Mar 2019 21:40:59 +0000 (21:40 +0000)]
Remove MSVC compat hack since the inline keyword was added in 2015

Our minimum MSVC toolchain requirement is greater than 2015, so we don't
need this conditional macro anymore.  New versions of MSVC apparently
have a header, xkeycheck.h, to check that keywords haven't been
redefined.

Fixes PR41144

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

5 years ago[Remarks] Fix gcc build for r356519
Francis Visoiu Mistrih [Tue, 19 Mar 2019 21:32:03 +0000 (21:32 +0000)]
[Remarks] Fix gcc build for r356519

Fails here:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/20046/steps/build%20stage%201/logs/stdio

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

5 years ago[DwarfDebug] Add triple to test.
Florian Hahn [Tue, 19 Mar 2019 21:18:59 +0000 (21:18 +0000)]
[DwarfDebug] Add triple to test.

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

5 years ago[InstSimplify] Add additional cmp of abs without nsw tests; NFC
Nikita Popov [Tue, 19 Mar 2019 21:12:21 +0000 (21:12 +0000)]
[InstSimplify] Add additional cmp of abs without nsw tests; NFC

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

5 years agoReland "[Remarks] Add a new Remark / RemarkParser abstraction"
Francis Visoiu Mistrih [Tue, 19 Mar 2019 21:11:07 +0000 (21:11 +0000)]
Reland "[Remarks] Add a new Remark / RemarkParser abstraction"

This adds a Remark class that allows us to share code when working with
remarks.

The C API has been updated to reflect this. Instead of the parser
generating C structs, it's now using a C++ object that is used through
opaque pointers in C. This gives us much more flexibility on what
changes we can make to the internal state of the object and interacts
much better with scenarios where the library is used through dlopen.

* C API updates:
  * move from C structs to opaque pointers and functions
  * the remark type is now an enum instead of a string
* unit tests updates:
  * use mostly the C++ API
  * keep one test for the C API
  * rename to YAMLRemarksParsingTest
* a typo was fixed: AnalysisFPCompute -> AnalysisFPCommute.
* a new error message was added: "expected a remark tag."
* llvm-opt-report has been updated to use the C++ parser instead of the
C API

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

Original llvm-svn: 356491

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

5 years agoRevert r356511 "[TailCallElim] Add tailcall elimination pass to LTO pipelines"
Robert Lougher [Tue, 19 Mar 2019 20:54:20 +0000 (20:54 +0000)]
Revert r356511 "[TailCallElim] Add tailcall elimination pass to LTO pipelines"

Due to buildbot failures (LLD tests).

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

5 years ago[DwarfDebug] Skip entries to big for 16 bit size field in Dwarf < 5.
Florian Hahn [Tue, 19 Mar 2019 20:37:06 +0000 (20:37 +0000)]
[DwarfDebug] Skip entries to big for 16 bit size field in Dwarf < 5.

Nothing prevents entries from being bigger than the 16 bit size field in
Dwarf < 5. For entries that are too big, just emit an empty entry
instead of crashing.

This fixes PR41038.

Reviewers: probinson, aprantl, davide

Reviewed By: probinson

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

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

5 years ago[TailCallElim] Add tailcall elimination pass to LTO pipelines
Robert Lougher [Tue, 19 Mar 2019 20:24:28 +0000 (20:24 +0000)]
[TailCallElim] Add tailcall elimination pass to LTO pipelines

LTO provides additional opportunities for tailcall elimination due to
link-time inlining and visibility of nocapture attribute. Testing showed
negligible impact on compilation times.

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

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

5 years agoDemanded elements support for masked.load and masked.gather
Philip Reames [Tue, 19 Mar 2019 20:10:00 +0000 (20:10 +0000)]
Demanded elements support for masked.load and masked.gather

Teach instcombine to propagate demanded elements through a masked load or masked gather instruction. This is in the broader context of improving vector pointer instcombine under https://reviews.llvm.org/D57140.

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

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

5 years agoCodeGen: Refactor regallocator command line and target selection
Matt Arsenault [Tue, 19 Mar 2019 19:33:12 +0000 (19:33 +0000)]
CodeGen: Refactor regallocator command line and target selection

This will allow targets more flexibility to replace the
register allocator core passes. In a future commit,
AMDGPU will run the core register assignment passes
twice, and will also want to disallow using the
standard -regalloc option.

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

5 years agoRegAllocFast: Do not allocate registers for undef uses
Matt Arsenault [Tue, 19 Mar 2019 19:16:04 +0000 (19:16 +0000)]
RegAllocFast: Do not allocate registers for undef uses

Do not actually allocate a register for an undef use. Previously we we
would create unnecessary reload instruction for undef uses where the
register wasn't live.

Patch by Matthias Braun

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

5 years agoRegAllocFast: Remove early selection loop, the spill calculation will report cost...
Matt Arsenault [Tue, 19 Mar 2019 19:01:34 +0000 (19:01 +0000)]
RegAllocFast: Remove early selection loop, the spill calculation will report cost 0 anyway for free regs

The 2nd loop calculates spill costs but reports free registers as cost
0 anyway, so there is little benefit from having a separate early
loop.

Surprisingly this is not NFC, as many register are marked regDisabled
so the first loop often picks up later registers unnecessarily instead
of the first one available in the allocation order...

Patch by Matthias Braun

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

5 years agoFix for ABS legalization on PPC buildbot.
Simon Pilgrim [Tue, 19 Mar 2019 18:55:46 +0000 (18:55 +0000)]
Fix for ABS legalization on PPC buildbot.

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

5 years agoAllow unordered loads to be considered invariant in CodeGen
Philip Reames [Tue, 19 Mar 2019 18:27:18 +0000 (18:27 +0000)]
Allow unordered loads to be considered invariant in CodeGen

The actual code change is fairly straight forward, but exercising it isn't. First, it turned out we weren't adding the appropriate flags in SelectionDAG. Second, it turned out that we've got some optimization gaps, so obvious test cases don't work.

My first attempt (in atomic-unordered.ll) points out a deficiency in our peephole-opt folding logic which I plan to fix separately. Instead, I'm exercising this through MachineLICM.

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

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

5 years agoRevert "[Remarks] Add a new Remark / RemarkParser abstraction"
Francis Visoiu Mistrih [Tue, 19 Mar 2019 18:21:43 +0000 (18:21 +0000)]
Revert "[Remarks] Add a new Remark / RemarkParser abstraction"

This reverts commit 51dc6a8c84cd6a58562e320e1828a0158dbbf750.

Breaks
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/20034/steps/build%20stage%201/logs/stdio.

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

5 years ago[Remarks] Add a new Remark / RemarkParser abstraction
Francis Visoiu Mistrih [Tue, 19 Mar 2019 18:09:51 +0000 (18:09 +0000)]
[Remarks] Add a new Remark / RemarkParser abstraction

This adds a Remark class that allows us to share code when working with
remarks.

The C API has been updated to reflect this. Instead of the parser
generating C structs, it's now using a C++ object that is used through
opaque pointers in C. This gives us much more flexibility on what
changes we can make to the internal state of the object and interacts
much better with scenarios where the library is used through dlopen.

* C API updates:
  * move from C structs to opaque pointers and functions
  * the remark type is now an enum instead of a string
* unit tests updates:
  * use mostly the C++ API
  * keep one test for the C API
  * rename to YAMLRemarksParsingTest
* a typo was fixed: AnalysisFPCompute -> AnalysisFPCommute.
* a new error message was added: "expected a remark tag."
* llvm-opt-report has been updated to use the C++ parser instead of the
C API

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

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

5 years ago[ValueTracking] Use computeConstantRange() for unsigned add/sub overflow
Nikita Popov [Tue, 19 Mar 2019 17:53:56 +0000 (17:53 +0000)]
[ValueTracking] Use computeConstantRange() for unsigned add/sub overflow

Improve computeOverflowForUnsignedAdd/Sub in ValueTracking by
intersecting the computeConstantRange() result into the ConstantRange
created from computeKnownBits(). This allows us to detect some
additional never/always overflows conditions that can't be determined
from known bits.

This revision also adds basic handling for constants to
computeConstantRange(). Non-splat vectors will be handled in a followup.

The signed case will also be handled in a followup, as it needs some
more groundwork.

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

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

5 years agogn build: Merge r356387.
Peter Collingbourne [Tue, 19 Mar 2019 17:30:59 +0000 (17:30 +0000)]
gn build: Merge r356387.

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

5 years agogn build: Merge r356451.
Peter Collingbourne [Tue, 19 Mar 2019 17:30:50 +0000 (17:30 +0000)]
gn build: Merge r356451.

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

5 years ago[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - handle repeated shift amounts
Simon Pilgrim [Tue, 19 Mar 2019 17:23:25 +0000 (17:23 +0000)]
[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - handle repeated shift amounts

If a value with multiple uses is only ever used for SSE shift amounts then we know that only the bottom 64-bits are needed.

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

5 years ago[AtomicExpand] Fix a crash bug when lowering unordered loads to cmpxchg
Philip Reames [Tue, 19 Mar 2019 17:20:49 +0000 (17:20 +0000)]
[AtomicExpand] Fix a crash bug when lowering unordered loads to cmpxchg

Add tests for wider atomic loads and stores.  In the process, fix a crasher where we appearently handled unorder stores, but not loads, when lowering to cmpxchg idioms.

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

5 years ago[MIPS][microMIPS] Enable dynamic stack realignment
Simon Atanasyan [Tue, 19 Mar 2019 17:01:24 +0000 (17:01 +0000)]
[MIPS][microMIPS] Enable dynamic stack realignment

Dynamic stack realignment was disabled on micromips by checking if
target has standard encoding. We simply change the condition to skip
Mips16 only.

Patch by Mirko Brkusanin.

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

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

5 years ago[NFC] Fix unused variable in release builds
Jordan Rupprecht [Tue, 19 Mar 2019 16:52:40 +0000 (16:52 +0000)]
[NFC] Fix unused variable in release builds

This was introduced in rL356468.

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

5 years ago[DAGCombine] Fix a miscompile when reducing BUILD_VECTORs to a shuffle
Justin Bogner [Tue, 19 Mar 2019 16:52:00 +0000 (16:52 +0000)]
[DAGCombine] Fix a miscompile when reducing BUILD_VECTORs to a shuffle

In r311255 we added a case where we split vectors whose elements are
all derived from the same input vector so that we could shuffle it
more efficiently. In doing so, createBuildVecShuffle was taught to
adjust for the fact that all indices would be based off of the first
vector when this happens, but it's possible for the code that checked
that to fire incorrectly if we happen to have a BUILD_VECTOR of
extracts from subvectors and don't hit this new optimization.

Instead of trying to detect if we've split the vector by checking if
we have extracts from the same base vector, we can just pass that
information into createBuildVecShuffle, avoiding the miscompile.

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

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

5 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Tue, 19 Mar 2019 16:49:59 +0000 (16:49 +0000)]
Fix unused variable warning. NFCI.

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

5 years ago[Tests] Update to newer ISA
Philip Reames [Tue, 19 Mar 2019 16:46:56 +0000 (16:46 +0000)]
[Tests] Update to newer ISA

There are some issues w/missed opts on older platforms, but that's not the purpose of this test.  Using a newer API points out that some TODOs are already handled, and allows addition of tests to exercise other issues (future patch.)

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

5 years ago[InstCombine] fold logic-of-nan-fcmps (PR41069)
Sanjay Patel [Tue, 19 Mar 2019 16:39:17 +0000 (16:39 +0000)]
[InstCombine] fold logic-of-nan-fcmps (PR41069)

Combine 2 fcmps that are checking for nan-ness:
   and (fcmp ord X, 0), (and (fcmp ord Y, 0), Z) --> and (fcmp ord X, Y), Z
   or  (fcmp uno X, 0), (or  (fcmp uno Y, 0), Z) --> or  (fcmp uno X, Y), Z

This is an exact match for a minimal reassociation pattern.
If we want to handle this more generally that should go in
the reassociate pass and allow removing this code.

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=41069

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

5 years ago[AMDGPU] Add convergent attribute to WWM.
Neil Henning [Tue, 19 Mar 2019 16:32:24 +0000 (16:32 +0000)]
[AMDGPU] Add convergent attribute to WWM.

Add the convergent attribute to the WWM intrinsic to stop it ever being
sunk out of cfg.

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

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

5 years ago[SelectionDAG] Handle unary SelectPatternFlavor for ABS case in SelectionDAGBuilder...
Simon Pilgrim [Tue, 19 Mar 2019 16:24:55 +0000 (16:24 +0000)]
[SelectionDAG] Handle unary SelectPatternFlavor for ABS case in SelectionDAGBuilder::visitSelect

These changes are related to PR37743 and include:

    SelectionDAGBuilder::visitSelect handles the unary SelectPatternFlavor::SPF_ABS case to build ABS node.

    Delete the redundant recognizer of the integer ABS pattern from the DAGCombiner.

    Add promoting the integer ABS node in the LegalizeIntegerType.

    Expand-based legalization of integer result for the ABS nodes.

    Expand-based legalization of ABS vector operations.

    Add some integer abs testcases for different typesizes for Thumb arch

    Add the custom ABS expanding and change the SAD pattern recognizer for X86 arch: The i64 result of the ABS is expanded to:
        tmp = (SRA, Hi, 31)
        Lo = (UADDO tmp, Lo)
        Hi = (XOR tmp, (ADDCARRY tmp, hi, Lo:1))
        Lo = (XOR tmp, Lo)

    The "detectZextAbsDiff" function is changed for the recognition of pattern with the ABS node. Given a ABS node, detect the following pattern:
        (ABS (SUB (ZERO_EXTEND a), (ZERO_EXTEND b))).

    Change integer abs testcases for codegen with the ABS node support for AArch64.
        Indicate that the ABS is legal for the i64 type when the NEON is supported.
        Change the integer abs testcases to show changing of codegen.

    Add combine and legalization of ABS nodes for Thumb arch.

    Extend 'matchSelectPattern' to recognize the ABS patterns with ICMP_SGE condition.

For discussion, see https://bugs.llvm.org/show_bug.cgi?id=37743

Patch by: @ikulagin (Ivan Kulagin)

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

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

5 years ago[llvm-ar] Support N [count] modifier
Jordan Rupprecht [Tue, 19 Mar 2019 16:09:54 +0000 (16:09 +0000)]
[llvm-ar] Support N [count] modifier

Summary:
GNU ar supports the 'N' count modifier for the extract (x) and delete (d) operations. When an archive contains multiple members with the same name, this can be used to extract (or delete) them individually. For example:

```
$ llvm-ar t archive.a
foo
foo
$ llvm-ar x archive.a
-> Writes foo twice, overwriting it the second time :( :(
$ llvm-ar xN 1 archive.a foo && mv foo foo.1
$ llvm-ar xN 2 archive.a foo && mv foo foo.2
-> Write foo twice, renaming it in between invocations to preserve all versions
```

Reviewers: ruiu, MaskRay

Reviewed By: ruiu, MaskRay

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Add buffer/load 8/16 bit overloaded intrinsics
Ryan Taylor [Tue, 19 Mar 2019 16:07:00 +0000 (16:07 +0000)]
[AMDGPU] Add buffer/load 8/16 bit overloaded intrinsics

Summary:
Add buffer store/load 8/16 overloaded intrinsics for buffer, raw_buffer and struct_buffer

Change-Id: I166a29f071b2ff4e4683fb0392564b1f223ac61d

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

Tags: #llvm

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

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

5 years ago[AMDGPU] Ban i8 min3 promotion.
Neil Henning [Tue, 19 Mar 2019 15:50:24 +0000 (15:50 +0000)]
[AMDGPU] Ban i8 min3 promotion.

I found this really weird WWM-related case whereby through the WWM
transformations our isel lowering was trying to promote 2 min's into a
min3 for the i8 type, which our hardware doesn't support.

The new min3_i8.ll test case would previously spew the error:

PromoteIntegerResult #0: t69: i8 = SMIN3 t70, Constant:i8<0>, t68

Before the simple fix to our isel lowering to not do it for i8 MVT's.

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

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

5 years ago[InstCombine] Add missing test for icmp transformation (NFC)
Teresa Johnson [Tue, 19 Mar 2019 15:43:56 +0000 (15:43 +0000)]
[InstCombine] Add missing test for icmp transformation (NFC)

This was split out of D59378. There was no testing for the EQ case in
foldICmpWithDominatingICmp, add one here.

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