OSDN Git Service

android-x86/external-llvm.git
5 years ago[Object] Fix reading objects created with -fembed-bitcode-marker
Steven Wu [Thu, 21 Mar 2019 21:01:31 +0000 (21:01 +0000)]
[Object] Fix reading objects created with -fembed-bitcode-marker

Currently, this fails with many tools, e.g.

$ clang -fembed-bitcode-marker -c -o test.o test.c
$ nm test.o
nm: test.o The file was not recognized as a valid object file

-fembed-bitcode-marker creates a LLVM,bitcode section consisting of a single
byte. When reading the object file, IRObjectFile::findBitcodeInObject succeeds,
causing SymbolicFile::createSymbolicFile to try to read the "bitcode" rather
than using the outer Mach-O data - when then fails.

Fix this by making findBitcodeInObject return an error if the section size <= 1.

Patched by: Nicholas Allegra

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

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

5 years agoMips: Fix typo in assert message
Matt Arsenault [Thu, 21 Mar 2019 20:56:06 +0000 (20:56 +0000)]
Mips: Fix typo in assert message

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

5 years agoMips: Don't create copy of nothing
Matt Arsenault [Thu, 21 Mar 2019 20:56:05 +0000 (20:56 +0000)]
Mips: Don't create copy of nothing

This was creating a copy of the register the pseudo itself was
def'ing, leaving a copy of an undefined register. I'm not sure how
the verifier is not catching this, but this avoids asserting in a
future change to RegAllocFast

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

5 years agoGlobalISel: Fix RegBankSelect for REG_SEQUENCE
Matt Arsenault [Thu, 21 Mar 2019 20:45:36 +0000 (20:45 +0000)]
GlobalISel: Fix RegBankSelect for REG_SEQUENCE

The AArch64 test was broken since the result register already had a
set register class, so this test was a no-op. The mapping verify call
would fail because the result size is not the same as the inputs like
in a copy or phi.

The AMDGPU testcases are half broken and introduce illegal VGPR->SGPR
copies which need much more work to handle correctly (same for phis),
but add them as a baseline.

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

5 years agoDon't add a tail keyword to calls to ObjC runtime functions if the calls
Akira Hatanaka [Thu, 21 Mar 2019 20:16:09 +0000 (20:16 +0000)]
Don't add a tail keyword to calls to ObjC runtime functions if the calls
are annotated with notail.

r356705 annotated calls to objc_retainAutoreleasedReturnValue with
notail on x86-64. This commit teaches ARC optimizer to check the notail
marker on the call before turning it into a tail call.

rdar://problem/38675807

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

5 years ago[AArch64] Update for Exynos
Evandro Menezes [Thu, 21 Mar 2019 18:54:58 +0000 (18:54 +0000)]
[AArch64] Update for Exynos

Fix the feature set for Exynos M4 by removing support for `+fp16fml` and fix test case.

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

5 years ago[llvm-objdump] Support arg grouping for -j and -M (e.g. llvm-objdump -sj.foo -dMreg...
Jordan Rupprecht [Thu, 21 Mar 2019 18:45:44 +0000 (18:45 +0000)]
[llvm-objdump] Support arg grouping for -j and -M (e.g. llvm-objdump -sj.foo -dMreg-names-raw)

Summary:
r354375 added support for most objdump groupings, but didn't add support for -j|--sections, because that wasn't possible.
r354870 added --disassembler options, but grouping still wasn't available.
r355185 supported values for grouped options.

This just puts the three of them together. This supports -j in modes like `-s -j .foo`, `-sj .foo`, `-sj=.foo`, or `-sj.foo`, and similar for `-M`.

Reviewers: ormris, jhenderson, ikudrin

Reviewed By: jhenderson, ikudrin

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] canonicalizeBitSelect - don't attempt to canonicalize mask registers
Simon Pilgrim [Thu, 21 Mar 2019 18:32:38 +0000 (18:32 +0000)]
[X86] canonicalizeBitSelect - don't attempt to canonicalize mask registers

We don't use X86ISD::ANDNP for mask registers.

Test case from @craig.topper (Craig Topper)

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

5 years ago[llvm-pdbutil] Add -type-ref-stats to help find unused type info
Reid Kleckner [Thu, 21 Mar 2019 18:02:34 +0000 (18:02 +0000)]
[llvm-pdbutil] Add -type-ref-stats to help find unused type info

Summary:
This considers module symbol streams and the global symbol stream to be
roots. Most types that this considers "unreferenced" are referenced by
LF_UDT_MOD_SRC_LINE id records, which VC seems to always include.
Essentially, they are types that the user can only find in the debugger
if they call them by name, they cannot be found by traversing a symbol.

In practice, around 80% of type information in a PDB is referenced by a
symbol. That seems like a reasonable number.

I don't really plan to do anything with this tool. It mostly just exists
for informational purposes, and to confirm that we probably don't need
to implement type reference tracking in LLD. We can continue to merge
all types as we do today without wasting space.

Reviewers: zturner, aganea

Subscribers: mgorny, hiraditya, arphaman, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago[x86] add tests with movmsk potential (PR39665); NFC
Sanjay Patel [Thu, 21 Mar 2019 17:57:56 +0000 (17:57 +0000)]
[x86] add tests with movmsk potential (PR39665); NFC

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

5 years ago[InstCombine] Don't transform ((C1 OP zext(X)) & C2) -> zext((C1 OP X) & C2) if eithe...
Craig Topper [Thu, 21 Mar 2019 17:50:49 +0000 (17:50 +0000)]
[InstCombine] Don't transform ((C1 OP zext(X)) & C2) -> zext((C1 OP X) & C2) if either zext or OP has another use.

If they have other users we'll just end up increasing the instruction count.

We might be able to weaken this to only one of them having a single use if we can prove that the and will be removed.

Fixes PR41164.

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

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

5 years ago[X86] Don't avoid folding multiple use sign extended 8-bit immediate into instruction...
Craig Topper [Thu, 21 Mar 2019 17:38:58 +0000 (17:38 +0000)]
[X86] Don't avoid folding multiple use sign extended 8-bit immediate into instructions under optsize.

Under optsize we try to avoid folding immediates into instructions under optsize. But if the immediate is 16-bits or 32 bits, but can be encoded as an 8-bit immediate we don't save enough from disabling the folding unless the immediate has enough uses to make up for the size of the move which is either 3 bytes or 5 bytes since there are no sign extended 8-bit moves. We would also save something if the immediate was a live out of the basic block and thus a move was unavoidable, but that would require a more advanced heuristic than just counting uses.

Note we only avoid folding multiple use immediates into the patterns that use X86ISD::ADD/SUB/XOR/OR/AND/CMP/ADC/SBB nodes and not the more common ISD::ADD/SUB/XOR/OR/AND nodes.

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

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

5 years ago[ScalarizeMaskedMemIntrin] Add support for scalarizing expandload and compressstore...
Craig Topper [Thu, 21 Mar 2019 17:38:52 +0000 (17:38 +0000)]
[ScalarizeMaskedMemIntrin] Add support for scalarizing expandload and compressstore intrinsics.

This adds support for scalarizing these intrinsics as well the X86TargetTransformInfo support to avoid scalarizing them in the cases X86 can handle.

I've omitted handling special cases for constant masks for this first pass. Though CodeGenPrepare can constant fold the branch conditions and remove some of the control flow anyway.

Fixes PR40994 and is covers most of PR3666. Might want to implement constant masks to close that.

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

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

5 years ago[ValueTracking] Use ConstantRange based overflow check for signed sub
Nikita Popov [Thu, 21 Mar 2019 17:23:51 +0000 (17:23 +0000)]
[ValueTracking] Use ConstantRange based overflow check for signed sub

This is D59450, but for signed sub. This case is not NFC, because
the overflow logic in ConstantRange is more powerful than the existing
check. This resolves the TODO in the function.

I've added two tests to show that this indeed catches more cases than
the previous logic, but the main correctness test coverage here is in
the existing ConstantRange unit tests.

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

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

5 years agoAdd more rotate tests, including ORs of rotates
Krzysztof Parzyszek [Thu, 21 Mar 2019 17:14:22 +0000 (17:14 +0000)]
Add more rotate tests, including ORs of rotates

This is a part of https://reviews.llvm.org/D47735.

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

5 years agoFixup opt-remarks.ll gold plugin test. NFC
David Green [Thu, 21 Mar 2019 14:35:06 +0000 (14:35 +0000)]
Fixup opt-remarks.ll gold plugin test. NFC

Now that rL356594 has added a TailCallElim pass to LTO, the call gets marked as
tail.

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

5 years ago[DAGCombiner] Use getTokenFactor in a few more cases.
Florian Hahn [Thu, 21 Mar 2019 14:32:09 +0000 (14:32 +0000)]
[DAGCombiner] Use getTokenFactor in a few more cases.

SDNodes can only have 64k operands and for some inputs (e.g. large
number of stores), we can reach this limit when creating TokenFactor
nodes. This patch is a follow up to D56740 and updates a few more places
that potentially can create TokenFactors with too many operands.

Reviewers: efriedma, craig.topper, aemerson, RKSimon

Reviewed By: RKSimon

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

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

5 years ago[DAGCombine] SimplifySelectCC - call FoldSetCC with the setcc result type
Simon Pilgrim [Thu, 21 Mar 2019 14:07:18 +0000 (14:07 +0000)]
[DAGCombine] SimplifySelectCC - call FoldSetCC with the setcc result type

We were calling FoldSetCC with the compare operand type instead of the result type.

Found by OSS-Fuzz #13838 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13838)

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

5 years ago[CodeGenPrepare] limit formation of overflow intrinsics (PR41129)
Sanjay Patel [Thu, 21 Mar 2019 13:57:07 +0000 (13:57 +0000)]
[CodeGenPrepare] limit formation of overflow intrinsics (PR41129)

This is probably a bigger limitation than necessary, but since we don't have any evidence yet
that this transform led to real-world perf improvements rather than regressions, I'm making a
quick, blunt fix.

In the motivating x86 example from:
https://bugs.llvm.org/show_bug.cgi?id=41129
...and shown in the regression test, we want to avoid an extra instruction in the dominating
block because that could be costly.

The x86 LSR test diff is reversing the changes from D57789. There's no evidence that 1 version
is any better than the other yet.

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

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

5 years ago[llvm-readobj] Format codes. NFC.
Xing GUO [Thu, 21 Mar 2019 13:42:06 +0000 (13:42 +0000)]
[llvm-readobj] Format codes. NFC.

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

5 years ago[Thumb] Fix infinite loop in ABS expansion (PR41160)
Simon Pilgrim [Thu, 21 Mar 2019 12:41:18 +0000 (12:41 +0000)]
[Thumb] Fix infinite loop in ABS expansion (PR41160)

Don't expand ISD::ABS node if its legal.

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

5 years ago[AMDGPU] Support for v3i32/v3f32
Tim Renouf [Thu, 21 Mar 2019 12:01:21 +0000 (12:01 +0000)]
[AMDGPU] Support for v3i32/v3f32

Added support for dwordx3 for most load/store types, but not DS, and not
intrinsics yet.

SI (gfx6) does not have dwordx3 instructions, so they are not enabled
there.

Some of this patch is from Matt Arsenault, also of AMD.

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

Change-Id: I913ef54f1433a7149da8d72f4af54dbb13436bd9

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

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