OSDN Git Service

android-x86/external-llvm.git
5 years ago[X86] Adding the test pointing to the fail case of D45653
Aleksandr Urakov [Mon, 27 Aug 2018 11:56:32 +0000 (11:56 +0000)]
[X86] Adding the test pointing to the fail case of D45653

Summary:
This commit adds the case of tail calling a sret function from a non-sret
function when both functions have the C calling convention.

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

5 years ago[Sparc] Avoid writing outside array in applyFixup
Daniel Cederman [Mon, 27 Aug 2018 11:43:59 +0000 (11:43 +0000)]
[Sparc] Avoid writing outside array in applyFixup

Summary: If an object file ends with a relocation that is smaller
than 4 bytes we will write outside the Data array and trigger an
"Invalid index" assertion.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

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

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

5 years ago[NFC][X86] Fix `sibcall.ll` formatting
Aleksandr Urakov [Mon, 27 Aug 2018 11:25:38 +0000 (11:25 +0000)]
[NFC][X86] Fix `sibcall.ll` formatting

Summary:
Remove unnecessary lines from `sibcall.ll` and rename labels according
to @RKSimon's recommendations in the D45653 conversation.

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

5 years ago[PowerPC] Recommit r340016 after fixing the reported issue
Nemanja Ivanovic [Mon, 27 Aug 2018 11:20:27 +0000 (11:20 +0000)]
[PowerPC] Recommit r340016 after fixing the reported issue

The internal benchmark failure reported by Google was due to a missing
check for the result type for the sign-extend and shift DAG. This commit
adds the check and re-commits the patch.

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

5 years ago[Sparc] Add support for the cycle counter available in GR740
Daniel Cederman [Mon, 27 Aug 2018 11:11:47 +0000 (11:11 +0000)]
[Sparc] Add support for the cycle counter available in GR740

Summary: The GR740 provides an up cycle counter in the registers ASR22
and ASR23. As these registers can not be read together atomically we only
use the value of ASR23 for llvm.readcyclecounter(). The ASR23 register
holds the 32 LSBs of the up-counter.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: jfb, fedor.sergeev, jrtc27, llvm-commits

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

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

5 years ago[NFC] Try to make buildbot happy about virtual destructors
Max Kazantsev [Mon, 27 Aug 2018 10:09:28 +0000 (10:09 +0000)]
[NFC] Try to make buildbot happy about virtual destructors

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

5 years ago[NFC] Split logic of ImplicitControlFlowTracking to allow generalization
Max Kazantsev [Mon, 27 Aug 2018 09:43:16 +0000 (09:43 +0000)]
[NFC] Split logic of ImplicitControlFlowTracking to allow generalization

We have a class `ImplicitControlFlowTracking` which allows us to keep track of
instructions that can abnormally exit and answer queries like "whether or not
there is side-exiting instruction above this instruction in its block".

We may want to have the similar tracking for other types of "special" instructions,
for example instructions that write memory.

This patch separates ImplicitControlFlowTracking into two classes, isolating all
general logic not related to implicit control flow into its parent class. We can
later make another child of this class to keep track of instructions that write
memory.

The motivation for that is that we want to make these checks efficiently in the
patch https://reviews.llvm.org/D50891.

NOTE: The naming of the parent class is not super cool, but the other options we
have are hardly better. Please feel free to rename it as NFC if you think you've
found a more informative name for it.

Differential Revision: https://reviews.llvm.org/D50954
Reviewed By: fedor.sergeev

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

5 years ago[COFF] Expose an easier helper function for getting names for relocation types
Martin Storsjo [Mon, 27 Aug 2018 08:42:39 +0000 (08:42 +0000)]
[COFF] Expose an easier helper function for getting names for relocation types

The existing method is protected, and requires using DataRefImpl
and SmallVector.

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

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

5 years ago[Sparc] Custom bitcast between f64 and v2i32
Daniel Cederman [Mon, 27 Aug 2018 07:14:53 +0000 (07:14 +0000)]
[Sparc] Custom bitcast between f64 and v2i32

Summary:
Currently bitcasting constants from f64 to v2i32 is done by storing the
value to the stack and then loading it again. This is not necessary, but
seems to happen because v2i32 is a valid type for Sparc V8. If it had not
been legal, we would have gotten help from the type legalizer.

This patch tries to do the same work as the legalizer would have done by
bitcasting the floating point constant and splitting the value up into a
vector of two i32 values.

Reviewers: venkatra, jyknight

Reviewed By: jyknight

Subscribers: glaubitz, fedor.sergeev, jrtc27, llvm-commits

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

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

5 years ago[RISCV] atomic_store_nn have a different layout to regular store
Roger Ferrer Ibanez [Mon, 27 Aug 2018 07:08:18 +0000 (07:08 +0000)]
[RISCV] atomic_store_nn have a different layout to regular store

We cannot directy reuse the patterns of StPat because for some reason the store
DAG node and the atomic_store_nn DAG nodes put the ptr and the value in
different positions. Currently we attempt to store the address to an address
formed by the value.

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

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

5 years agoFix this file to have the necessary standard library includes and use
Chandler Carruth [Mon, 27 Aug 2018 06:52:14 +0000 (06:52 +0000)]
Fix this file to have the necessary standard library includes and use
the `std::` namespace. Should fix a number of build bots as well.

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

5 years ago[X86] Cleanup the LowerMULH code by hoisting some commonalities between the vXi32...
Craig Topper [Mon, 27 Aug 2018 06:35:02 +0000 (06:35 +0000)]
[X86] Cleanup the LowerMULH code by hoisting some commonalities between the vXi32 and vXi8 handling. NFCI

vXi32 support was recently moved from LowerMUL_LOHI to LowerMULH.

This commit shares the getOperand calls, switches both to use common IsSigned flag, and hoists the NumElems/NumElts variable.

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

5 years ago[MS Demangler] Add virtual destructor.
Zachary Turner [Mon, 27 Aug 2018 04:04:41 +0000 (04:04 +0000)]
[MS Demangler] Add virtual destructor.

Silence -Wnon-virtual-dtor.

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

5 years ago[MS Demangler] Re-write the Microsoft demangler.
Zachary Turner [Mon, 27 Aug 2018 03:48:03 +0000 (03:48 +0000)]
[MS Demangler] Re-write the Microsoft demangler.

This is a pretty large refactor / re-write of the Microsoft
demangler.  The previous one was a little hackish because it
evolved as I was learning about all the various edge cases,
exceptions, etc.  It didn't have a proper AST and so there was
lots of custom handling of things that should have been much
more clean.

Taking what was learned from that experience, it's now
re-written with a completely redesigned and much more sensible
AST.  It's probably still not perfect, but at least it's
comprehensible now to someone else who wants to come along
and make some modifications or read the code.

Incidentally, this fixed a couple of bugs, so I've enabled
the tests which now pass.

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

5 years ago[X86] Correct the cost of (v4i32 (fptoui (v4f64))) under AVX512F.
Craig Topper [Sun, 26 Aug 2018 18:47:44 +0000 (18:47 +0000)]
[X86] Correct the cost of (v4i32 (fptoui (v4f64))) under AVX512F.

Summary: This was inheriting the cost from the AVX table, but should be legal under AVX512.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

5 years ago[X86] Add FeatureCMOV explicitly to all CPUs that support it. Remove FeatureCMOV...
Craig Topper [Sun, 26 Aug 2018 18:29:33 +0000 (18:29 +0000)]
[X86] Add FeatureCMOV explicitly to all CPUs that support it. Remove FeatureCMOV implication from Feature64Bit and FeatureSSE1

Summary:
Previously most CPUs inherited cmov support through Feature64Bit(or FeatureCMPXCHG16HB implying Feature64Bit) or FeatureSSE1.

This has the surprising side effect that -mattr=-cmov causes an assert to fire in 64-bit mode because it clears the Feature64Bit. Or in 32-bit mode, -mattr=-cmov disables any sse/avx features which seems surprising.

This patch removes the implication and instead updates hasCMOV in X86Subtarget to check SSE1 or is64Bit in addition to the regular cmov flag. This should keep most things working the way they did before. I don't believe there is a way to specific "-cmov" directly from clang so this should only effect our lower level tools.

This does stop -mattr=cx16(cmpxchg16b) from implying cmov is enabled via the 64bit flag as you can see from one of the changed tests. But that was a 32-bit test so I don't know why it enabled cx16 anyway.

For the other test I had to add -sse to override the new sse check in hasCMOV.

Reviewers: RKSimon, DavidKreitzer, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits, jfb

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

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

5 years ago[X86] Add FeatureCMOV to athlon and athlon-tbird cpus.
Craig Topper [Sun, 26 Aug 2018 18:29:27 +0000 (18:29 +0000)]
[X86] Add FeatureCMOV to athlon and athlon-tbird cpus.

Summary: This matches gcc and one cpuid dump I found online. Given that these are considered 7th generation x86 CPU it seems likely they support cmov since cmov was added by Intel in their 6th generation.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

5 years ago[SelectionDAG][x86] turn insertelement into undef with variable index into splat
Sanjay Patel [Sun, 26 Aug 2018 18:20:41 +0000 (18:20 +0000)]
[SelectionDAG][x86] turn insertelement into undef with variable index into splat

I noticed this along with the patterns in D51125, but when the index is variable,
we don't convert insertelement into a build_vector.

For x86, that means these get expanded at legalization time into the loading/spilling
code that we see in the tests. I think it's always better to avoid going to memory on
these, and we get the optimal 'broadcast' if it's available.

I suspect other targets may want to look at enabling the hook. AArch64 and AMDGPU have
regression tests that would be affected (although I did not check what would happen in
those cases). In the most basic cases shown here, AArch64 would probably do much
better with a splat.

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

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

5 years ago[ORC] Remove a workaround for systems lacking 8-byte atomics.
Lang Hames [Sun, 26 Aug 2018 16:46:02 +0000 (16:46 +0000)]
[ORC] Remove a workaround for systems lacking 8-byte atomics.

SymbolStringPool ref counts are now size_t, rather than uint64_t, so I do not
think this is necessary any more.

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

5 years ago[ORC] Do not include non-global symbols in getObjectSymbolFlags.
Lang Hames [Sun, 26 Aug 2018 16:46:02 +0000 (16:46 +0000)]
[ORC] Do not include non-global symbols in getObjectSymbolFlags.

Private symbols are not visible outside the object file, and so not defined by
the object file from ORC's perspective.

No test case yet. Ideally this would be a unit test parsing a checked-in binary,
but I am not aware of any way to reference the LLVM source root from a unit
test.

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

5 years agoReplace fancy use of initializer lists with simple functions that return
Chandler Carruth [Sun, 26 Aug 2018 10:03:08 +0000 (10:03 +0000)]
Replace fancy use of initializer lists with simple functions that return
vectors, and move this test code into an anonymous namespace.

Hoping that this will avoid hitting an MSVC bug that causes it to crash
and burn pretty spectacularly. Also, this degree of clever use of
initializer lists seems somewhat questionable in general. ;]

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

5 years ago[IR] Replace `isa<TerminatorInst>` with `isTerminator()`.
Chandler Carruth [Sun, 26 Aug 2018 09:51:22 +0000 (09:51 +0000)]
[IR] Replace `isa<TerminatorInst>` with `isTerminator()`.

This is a bit awkward in a handful of places where we didn't even have
an instruction and now we have to see if we can build one. But on the
whole, this seems like a win and at worst a reasonable cost for removing
`TerminatorInst`.

All of this is part of the removal of `TerminatorInst` from the
`Instruction` type hierarchy.

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

5 years agoAvoid specializing a variadic member template in a way that seems to not
Chandler Carruth [Sun, 26 Aug 2018 09:17:49 +0000 (09:17 +0000)]
Avoid specializing a variadic member template in a way that seems to not
agree with MSVC.

There isn't actually a need for specialization here as we can write the
code generically and just have a test that will fold away as a constant.

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

5 years ago[IR] Sink `isExceptional` predicate to `Instruction`, rename it to
Chandler Carruth [Sun, 26 Aug 2018 08:56:42 +0000 (08:56 +0000)]
[IR] Sink `isExceptional` predicate to `Instruction`, rename it to
`isExceptionalTermiantor` and implement it for opcodes as well following
the common pattern in `Instruction`.

Part of removing `TerminatorInst` from the `Instruction` type hierarchy
to make it easier to share logic and interfaces between instructions
that are both terminators and not terminators.

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

5 years ago[IR] Begin removal of TerminatorInst by removing successor manipulation.
Chandler Carruth [Sun, 26 Aug 2018 08:41:15 +0000 (08:41 +0000)]
[IR] Begin removal of TerminatorInst by removing successor manipulation.

The core get and set routines move to the `Instruction` class. These
routines are only valid to call on instructions which are terminators.

The iterator and *generic* range based access move to `CFG.h` where all
the other generic successor and predecessor access lives. While moving
the iterator here, simplify it using the iterator utilities LLVM
provides and updates coding style as much as reasonable. The APIs remain
pointer-heavy when they could better use references, and retain the odd
behavior of `operator*` and `operator->` that is common in LLVM
iterators. Adjusting this API, if desired, should be a follow-up step.

Non-generic range iteration is added for the two instructions where
there is an especially easy mechanism and where there was code
attempting to use the range accessor from a specific subclass:
`indirectbr` and `br`. In both cases, the successors are contiguous
operands and can be easily iterated via the operand list.

This is the first major patch in removing the `TerminatorInst` type from
the IR's instruction type hierarchy. This change was discussed in an RFC
here and was pretty clearly positive:
http://lists.llvm.org/pipermail/llvm-dev/2018-May/123407.html

There will be a series of much more mechanical changes following this
one to complete this move.

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

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

5 years ago[MIPS GlobalISel] Legalize i8 and i16 add
Petar Jovanovic [Sun, 26 Aug 2018 07:25:33 +0000 (07:25 +0000)]
[MIPS GlobalISel] Legalize i8 and i16 add

Legalize G_ADD for types smaller than i32.
LegalizationArtifactCombiner replaces extend instructions with appropriate
bitwise instructions.

Patch by Petar Avramovic.

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

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

5 years ago[X86] Fix typo in comment, expect->except. NFC
Craig Topper [Sun, 26 Aug 2018 03:43:23 +0000 (03:43 +0000)]
[X86] Fix typo in comment, expect->except. NFC

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

5 years ago[X86] Add test cases for D50952, paddus patterns involving constants. NFC
Craig Topper [Sun, 26 Aug 2018 00:22:07 +0000 (00:22 +0000)]
[X86] Add test cases for D50952, paddus patterns involving constants. NFC

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

5 years ago[C-API][DIBuilder] Use NameLen in LLVMDIBuilderCreateParameterVariable
Robert Widmann [Sat, 25 Aug 2018 19:54:39 +0000 (19:54 +0000)]
[C-API][DIBuilder] Use NameLen in LLVMDIBuilderCreateParameterVariable

Summary: NameLen wasn't being used and caused the parameters in gdb to very long, in my case, crashes in others. Please also perform the correct magical incarnations to have this be applied to the LLVM 7 branch.

Reviewers: whitequark, CodaFi

Reviewed By: CodaFi

Subscribers: llvm-commits

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

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

5 years ago[X86] Replace support for vXi32 SMUL_LOHI/UMUL_LOHI with MULHS/MULHU support instead.
Craig Topper [Sat, 25 Aug 2018 18:01:24 +0000 (18:01 +0000)]
[X86] Replace support for vXi32 SMUL_LOHI/UMUL_LOHI with MULHS/MULHU support instead.

Summary:
The only time vector SMUL_LOHI/UMUL_LOHI nodes are created is during division/remainder lowering. If its created before op legalization, generic DAGCombine immediately turns that SMUL_LOHI/UMUL_LOHI into a MULHS/MULHU since only the upper half is used. That node will stick around through vector op legalization and will be turned back into UMUL_LOHI/SMUL_LOHI during op legalization. It will then be custom lowered by the X86 backend. Due to this two step lowering the vector shuffles created by the custom lowering get legalized after their inputs rather than before. This prevents the shuffles from being combined with any build_vector of constants.

This patch uses changes vXi32 to use MULHS/MULHU instead. This is what the later DAG combine did anyway. But by skipping the change back to UMUL_LOHI/SMUL_LOHI we lower it before any constant BUILD_VECTORS. This allows the vector_shuffle creation to constant fold with the build_vectors. This accounts for the test changes here.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

5 years ago[SelectionDAG][X86] Reorder the operands the MaskedStoreSDNode to put the value first.
Craig Topper [Sat, 25 Aug 2018 17:48:17 +0000 (17:48 +0000)]
[SelectionDAG][X86] Reorder the operands the MaskedStoreSDNode to put the value first.

Summary:
Previously the value being stored is the last operand in SDNode. This causes the type legalizer to visit the mask operand before the value operand. The type legalizer was more complicated because of this since we want the type of the value to drive the decisions.

This patch moves the value to be the first operand so we visit it first during type legalization. It also simplifies the type legalization code accordingly.

X86 is currently the only in tree target that uses this SDNode. Not sure if there are any users out of tree.

Reviewers: RKSimon, delena, hfinkel, eli.friedman

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

5 years ago[X86] Make sure type is a vector before calling VT.getVectorNumElements() in combineL...
Craig Topper [Sat, 25 Aug 2018 17:23:43 +0000 (17:23 +0000)]
[X86] Make sure type is a vector before calling VT.getVectorNumElements() in combineLoopMAddPattern

Fixes PR38700.

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

5 years agoFix -Wunused-function warning. NFCI.
Simon Pilgrim [Sat, 25 Aug 2018 17:11:11 +0000 (17:11 +0000)]
Fix -Wunused-function warning. NFCI.

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

5 years agoRemove superfluous semicolon. NFCI.
Simon Pilgrim [Sat, 25 Aug 2018 16:49:35 +0000 (16:49 +0000)]
Remove superfluous semicolon. NFCI.

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

5 years ago[x86] try harder to use broadcast to load a scalar into vector reg
Sanjay Patel [Sat, 25 Aug 2018 14:56:05 +0000 (14:56 +0000)]
[x86] try harder to use broadcast to load a scalar into vector reg

This is a preliminary step for a preliminary step for D50992.
I noticed that x86 often misses chances to load a scalar directly
into a vector register.

So this patch is just allowing more of those cases to match a
broadcast op in lowerBuildVectorAsBroadcast(). The old code comment
said it doesn't make sense to use a broadcast when we're loading a
single element and everything else is undef, but I think that's the
best case in the improved tests in insert-loaded-scalar.ll. We avoid
scalar-to-vector-register move and/or less efficient shuffling.

Note that there are some existing types that were already producing
a broadcast, but that happens semi-accidentally. Ie, it's not
happening as part of lowerBuildVectorAsBroadcast(). The build vector
gets expanded into load + shuffle, and then shuffle lowering produces
the broadcast.

Description of the other test diffs:
1. avx-basic.ll - replacing load+shufle is a win.
2. sse3-avx-addsub-2.ll - vmovddup vs. vbroadcastss is neutral
3. sse41.ll - don't care - we convert that intrinsic to generic IR now, so this test is deprecated
4. vector-shuffle-128-v8.ll / vector-shuffle-256-v16.ll - pshufb alternatives with an extra instruction are not obviously bad

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

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

5 years ago[AMDGPU] Add support for multi-dword s.buffer.load intrinsic
Tim Renouf [Sat, 25 Aug 2018 14:53:17 +0000 (14:53 +0000)]
[AMDGPU] Add support for multi-dword s.buffer.load intrinsic

Summary:
Patch by Marek Olsak and David Stuttard, both of AMD.

This adds a new amdgcn intrinsic supporting s.buffer.load, in particular
multiple dword variants. These are convenient to use from some front-end
implementations.

Also modified the existing llvm.SI.load.const intrinsic to common up the
underlying implementation.

This modification also requires that we can lower to non-uniform loads correctly
by splitting larger dword variants into sizes supported by the non-uniform
versions of the load.

V2: Addressed minor review comments.
V3: i1 glc is now i32 cachepolicy for consistency with buffer and
    tbuffer intrinsics, plus fixed formatting issue.
V4: Added glc test.

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

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

Change-Id: I83a6e00681158bb243591a94a51c7baa445f169b

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

5 years ago[InstCombine] add tests for shuffle+binop transform; NFC
Sanjay Patel [Sat, 25 Aug 2018 14:37:08 +0000 (14:37 +0000)]
[InstCombine] add tests for shuffle+binop transform; NFC

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

5 years ago[X86] Make requested test changes from D50636
Simon Pilgrim [Sat, 25 Aug 2018 14:16:03 +0000 (14:16 +0000)]
[X86] Make requested test changes from D50636

The tests were relying on X / X -> 1 and X % X -> 0 combines not happening in the DAG.

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

5 years ago[CodeGen] Set FrameSetup/FrameDestroy on BUNDLE instructions
Bjorn Pettersson [Sat, 25 Aug 2018 11:26:17 +0000 (11:26 +0000)]
[CodeGen] Set FrameSetup/FrameDestroy on BUNDLE instructions

Summary:
If any of the bundled instructions are marked as FrameSetup
or FrameDestroy, then that property is set on the BUNDLE
instruction as well.

As long as the scheduler/packetizer aren't mixing
prologue/epilogue instructions (i.e. all the bundled
instructions have the same property) then this simply gives
the bundle the correct property (so when using a bundle
iterator in late passes a bundle will be correctly identified
as FrameSetup/FrameDestroy).

When for example bundling a mix of FrameSetup instructions
with non-FrameSetup instructions it could be discussed if
the bundle should have the property or not. The choice here
has been to set these properties on the BUNDLE instruction if
any of the bundled instructions have the property set.

Reviewers: #debug-info, kparzysz

Reviewed By: kparzysz

Subscribers: vsk, thegameg, llvm-commits

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

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

5 years ago[LiveDebugVariables] Avoid faulty addDefsFromCopies in computeIntervals
Bjorn Pettersson [Sat, 25 Aug 2018 10:02:03 +0000 (10:02 +0000)]
[LiveDebugVariables] Avoid faulty addDefsFromCopies in computeIntervals

Summary:
When computeIntervals is looking through COPY instruction to
extend the location mapping for a debug variable it did not
handle subregisters correctly.

For example
    DBG_VALUE debug-use %0.sub_8bit_hi, ...
    %1:gr16 = COPY %0
was transformed into
    DBG_VALUE debug-use %0.sub_8bit_hi, ...
    %1:gr16 = COPY %0
    DBG_VALUE debug-use %1, ...
So the subregister index was missing in the added DBG_VALUE.

As long as the subreg refered to the least significant bits
of the superreg, then I guess we could get the correct
result in a debugger even when referring to the superreg.
But as in the example above when the subreg refers to other
parts of the superreg, then debuginfo would be incorrect.

I'm not sure exactly how to fix this properly, so this patch
just avoids looking through the COPY when there is a subreg
involved (for more info, see the FIXME added in the code).

Reviewers: rnk, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits

Tags: #debug-info

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

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

5 years ago[MC, RISCV] Fixed StringRef Assertion `Index < Length && "Invalid index!"'
Ana Pazos [Sat, 25 Aug 2018 01:34:32 +0000 (01:34 +0000)]
[MC, RISCV] Fixed StringRef Assertion `Index < Length && "Invalid index!"'

Summary:
Handle the case IDVal is an empty string.

This bug was uncovered by a LLVM MC Assembler Protocol Buffer
Fuzzer  for the RISC-V assembly language.

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, niravd, pcc, peter.smith, asb, grosbach, llvm-commits, bcain, kito-cheng, shiva0217, rogfer01, PkmX

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

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

5 years ago[llvm] Document "%T" as deprecated in CommandGuide/lit.rst
Kuba Mracek [Sat, 25 Aug 2018 01:27:48 +0000 (01:27 +0000)]
[llvm] Document "%T" as deprecated in CommandGuide/lit.rst

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

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

5 years agoThis patch adds support to LLVM for writing HermitCore (https://hermitcore.org) ELF...
Eric Christopher [Sat, 25 Aug 2018 01:08:18 +0000 (01:08 +0000)]
This patch adds support to LLVM for writing HermitCore (https://hermitcore.org) ELF binaries.

HermitCore is a POSIX-compatible kernel for running a single application in an isolated environment to get maximum performance and predictable runtime behavior. It can either be used bare-metal on hardware or a VM (Unikernel) or side by side to an existing Linux system (Multikernel).
Due to the latter feature, HermitCore binaries are marked with ELFOSABI_STANDALONE to let the Linux ELF loader distinguish them from regular Unix/Linux binaries and load them using the HermitCore "proxy" tool.

Patch by Colin Finck!

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

5 years ago[RISCV] Fixed Assertion`Kind == Immediate && "Invalid type access!"' failed.
Ana Pazos [Fri, 24 Aug 2018 23:47:49 +0000 (23:47 +0000)]
[RISCV] Fixed Assertion`Kind == Immediate && "Invalid type access!"' failed.

Summary:
Missing check for isImm() in some Immediate classes.

This bug was uncovered by a LLVM MC Assembler Protocol Buffer Fuzzer
for the RISC-V assembly language.

Reviewers: hiraditya, asb

Reviewed By: hiraditya, asb

Subscribers: llvm-commits, hiraditya, kito-cheng, shiva0217, rkruppe, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei

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

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

5 years agoPrevent DILocation::getMergedLocation() from creating invalid metadata.
Adrian Prantl [Fri, 24 Aug 2018 23:30:57 +0000 (23:30 +0000)]
Prevent DILocation::getMergedLocation() from creating invalid metadata.

The function's new implementation from r340583 had a bug in it that
could cause an invalid scope to be generated when merging two
DILocations with no common ancestor scope.

This patch detects this situation and picks the scope of the first
location. This is not perfect, because the scope is misleading, but on
the other hand, this will be a line 0 location.

rdar://problem/43687474

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

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

5 years agoAllow demangler's node allocator to fail, and bail out of the entire
Richard Smith [Fri, 24 Aug 2018 23:26:05 +0000 (23:26 +0000)]
Allow demangler's node allocator to fail, and bail out of the entire
demangling process when it does.

Use this to support a "lookup" query for the mangling canonicalizer that
does not create new nodes. This could also be used to implement
demangling with a fixed-size temporary storage buffer.

Reviewers: erik.pilkington

Subscribers: llvm-commits

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

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

5 years ago [RISCV] Fix std::advance slowness
Ana Pazos [Fri, 24 Aug 2018 23:13:59 +0000 (23:13 +0000)]
 [RISCV] Fix std::advance slowness

Summary:
It seems std::advance template is treating "-MFI.getCalleeSavedInfo().size()"
as a large unsigned value", causing slowness.

Thanks to Henrik Gustafsson for reporting the issue.

Reviewers: asb

Reviewed By: asb

Subscribers: llvm-commits, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb

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

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

5 years ago[llvm-mca] Move ResourceManager from Scheduler into its own file. NFC.
Matt Davis [Fri, 24 Aug 2018 22:59:13 +0000 (22:59 +0000)]
[llvm-mca] Move ResourceManager from Scheduler into its own file. NFC.

This time I should be preserving history of the ResourceManager changes.

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

5 years agoFix ExpandedSpecialSubstitution demangling for Sa and Sb.
Richard Smith [Fri, 24 Aug 2018 22:34:20 +0000 (22:34 +0000)]
Fix ExpandedSpecialSubstitution demangling for Sa and Sb.

No functionality change: we never actually create these forms currently.

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

5 years agoAdd documentation comment to ForwardTemplateReference.
Richard Smith [Fri, 24 Aug 2018 22:33:53 +0000 (22:33 +0000)]
Add documentation comment to ForwardTemplateReference.

This node doesn't directly correspond to a mangled name fragment, so
it's useful to explicitly describe when it's created and what it's for.

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

5 years agoAdd data structure to form equivalence classes of mangled names.
Richard Smith [Fri, 24 Aug 2018 22:31:51 +0000 (22:31 +0000)]
Add data structure to form equivalence classes of mangled names.

Summary:
Given a set of equivalent name fragments, this mechanism determines whether two
mangled names are equivalent. The intent is to use this for fuzzy matching of
profile data against the program after certain refactorings are performed.

Reviewers: erik.pilkington, dlj

Subscribers: mgorny, llvm-commits

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

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

5 years ago[llvm-mca] Revert r340659. NFC.
Matt Davis [Fri, 24 Aug 2018 22:05:14 +0000 (22:05 +0000)]
[llvm-mca] Revert r340659. NFC.

Choosing to revert the change and do it again, hopefully preserving the history
of the changes by using svn copy instead of simply creating a new file from the
contents within Scheduler.

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

5 years ago[CVP] Extend tests to illustrate an old patch isn't needed
Philip Reames [Fri, 24 Aug 2018 21:56:43 +0000 (21:56 +0000)]
[CVP] Extend tests to illustrate an old patch isn't needed

Back in https://reviews.llvm.org/D19559, I tried to teach CVP about range facts implied by value/value icmps (i.e. no constants.)  In the meantime, we've implemented the optimization, but I couldn't find tests checked in, so adding them.

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

5 years ago[llvm-mca] Move the ResourceManger from the Scheduler into its own file. NFC.
Matt Davis [Fri, 24 Aug 2018 21:53:12 +0000 (21:53 +0000)]
[llvm-mca] Move the ResourceManger from the Scheduler into its own file. NFC.

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

5 years ago[PGO] add target md5sum in warning message for icall
Xinliang David Li [Fri, 24 Aug 2018 21:38:24 +0000 (21:38 +0000)]
[PGO] add target md5sum in warning message for icall

Differential revision: http://reviews.llvm.org/D51193

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

5 years agoDAG: Allow matching fminnum/fmaxnum from vselect
Matt Arsenault [Fri, 24 Aug 2018 21:24:18 +0000 (21:24 +0000)]
DAG: Allow matching fminnum/fmaxnum from vselect

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

5 years agoUse unique_ptr to hold MCInstrInfo
Vitaly Buka [Fri, 24 Aug 2018 21:03:35 +0000 (21:03 +0000)]
Use unique_ptr to hold MCInstrInfo

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

5 years agoVerifier: verify that a DILocation's scope is a DILocalScope.
Adrian Prantl [Fri, 24 Aug 2018 21:01:58 +0000 (21:01 +0000)]
Verifier: verify that a DILocation's scope is a DILocalScope.

This fixes an assertion failure(!) in the Verifier.

rdar://problem/43687474

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

5 years ago[SafeStack] Set debug location for calls to __safestack_pointer_address.
Eli Friedman [Fri, 24 Aug 2018 20:42:32 +0000 (20:42 +0000)]
[SafeStack] Set debug location for calls to __safestack_pointer_address.

Otherwise, the debug info is incorrect.  On its own, this is mostly
harmless, but the safe-stack also later inlines the call to
__safestack_pointer_address, which leads to debug info with the wrong
scope, which eventually causes an assertion failure (and incorrect debug
info in release mode).

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

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

5 years agoReduce the memory footprint of dsymutil. (NFC)
Adrian Prantl [Fri, 24 Aug 2018 20:41:08 +0000 (20:41 +0000)]
Reduce the memory footprint of dsymutil. (NFC)

This (partially) fixes a regression introduced by
https://reviews.llvm.org/D43945 / r327399, which parallelized
DwarfLinker. This patch avoids parsing and allocating the memory for
all input DIEs up front and instead only allocates them in the
concurrent loop in the AnalyzeLambda. At the end of the loop the
memory from the LinkContext is cleared again.

This reduces the peak memory needed to link the debug info of a
non-modular build of the Swift compiler by >3GB.

rdar://problem/43444464

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

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

5 years agoCodeGen: Add two more conditions for adding symbols to the address-significance table.
Peter Collingbourne [Fri, 24 Aug 2018 20:37:09 +0000 (20:37 +0000)]
CodeGen: Add two more conditions for adding symbols to the address-significance table.

Firstly, require the symbol to be used within the module. If a
symbol is unused within a module, then by definition it cannot be
address-significant within that module. This condition is useful on all
platforms because it could make symbol tables smaller -- without this
change, emitting an address-significance table could cause otherwise
unused undefined symbols to be added to the object file.

But this change is necessary with COFF specifically in order to
preserve the property that an unreferenced undefined symbol in an IR
module does not result in a link failure. This is already the case for
ELF because ELF linkers only reject links with unresolved symbols if
there is a relocation to that symbol, but COFF linkers require all
undefined symbols to be resolved regardless of relocations. So if
a module contains an unreferenced undefined symbol, we need to make
sure not to add it to the address-significance table (and thus the
symbol table) in case it doesn't end up resolved at link time.

Secondly, do not add dllimport symbols to the table. These symbols
won't be able to be resolved because their definitions live in another
module and are accessed via the IAT, and the address-significance
table has no effect on other modules anyway. It wouldn't make sense
to add the IAT entry symbol to the address-significance table either
because the IAT entry isn't address-significant -- the generated code
never takes its address.

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

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

5 years agoDebugInfo: Fix skipping CUs in DWARFv5 debug_names table
David Blaikie [Fri, 24 Aug 2018 20:31:05 +0000 (20:31 +0000)]
DebugInfo: Fix skipping CUs in DWARFv5 debug_names table

My previoust test case had skipped CUs from one TU out of a two-TU LTO
scenario, which meant the CU index wasn't needed (as it was unambiguous
which CU a table entry applied to) - expanding the test to use 3 TUs,
skipping one (so long as it's not the last one) shows the indexes are
miscomputed. Fix that with a little indirection for the index.

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

5 years ago[llvm-mca] Move views and stats into a Views subdir. NFC.
Matt Davis [Fri, 24 Aug 2018 20:24:53 +0000 (20:24 +0000)]
[llvm-mca] Move views and stats into a Views subdir. NFC.

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

5 years ago[PowerPC] Emit xscpsgndp instead of xxlor when copying floating point scalar register...
Stefan Pintilie [Fri, 24 Aug 2018 20:00:24 +0000 (20:00 +0000)]
[PowerPC] Emit xscpsgndp instead of xxlor when copying floating point scalar registers for P9

This patch will address using the xscpsgndp instruction to copy floating point
scalar registers instead of the xxlor (specifically XXLORf) instruction that is
currently used. Additionally, this patch of utilizing xscpsgndp will apply to
P9, while pre-P9 will still use xxlor.

Patch by amyk

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

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

5 years agoUse unique_ptr.
Joel Galenson [Fri, 24 Aug 2018 19:40:35 +0000 (19:40 +0000)]
Use unique_ptr.

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

5 years ago[Exception Handling] Unwind tables are required for all functions that have an EH...
Stefan Pintilie [Fri, 24 Aug 2018 19:38:29 +0000 (19:38 +0000)]
[Exception Handling] Unwind tables are required for all functions that have an EH personality.

This patch is for defect:
https://bugs.llvm.org/show_bug.cgi?id=32611

Functions may require unwind tables even if they are marked with the attribute
nounwind. Any function with an EH personality may require an unwind table.

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

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

5 years ago[PowerPC] Change Test Options [NFC]
Stefan Pintilie [Fri, 24 Aug 2018 19:24:20 +0000 (19:24 +0000)]
[PowerPC] Change Test Options [NFC]

Patch by amyk

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

5 years ago[AST] Simplify code minorly using pattern match [NFC]
Philip Reames [Fri, 24 Aug 2018 19:13:39 +0000 (19:13 +0000)]
[AST] Simplify code minorly using pattern match [NFC]

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

5 years ago[AArch64] Reject inline asm with FP registers when FP is disabled.
Eli Friedman [Fri, 24 Aug 2018 19:12:13 +0000 (19:12 +0000)]
[AArch64] Reject inline asm with FP registers when FP is disabled.

Otherwise, we would crash trying to deal with an illegal input.

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

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

5 years ago[Support] Allow discarding a FileOutputBuffer without removing the memory mapping
Martin Storsjo [Fri, 24 Aug 2018 18:36:22 +0000 (18:36 +0000)]
[Support] Allow discarding a FileOutputBuffer without removing the memory mapping

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

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

5 years ago[X86] Teach combineLoopMAddPattern to handle cases where there is no loop and the...
Craig Topper [Fri, 24 Aug 2018 18:05:04 +0000 (18:05 +0000)]
[X86] Teach combineLoopMAddPattern to handle cases where there is no loop and the add has two multiply inputs

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

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

5 years ago[X86] Add test case for D50868. NFC
Craig Topper [Fri, 24 Aug 2018 18:05:02 +0000 (18:05 +0000)]
[X86] Add test case for D50868. NFC

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

5 years ago[DAGCombiner][Mips] Don't combine bitcast+store after LegalOperations when the store...
Craig Topper [Fri, 24 Aug 2018 17:48:25 +0000 (17:48 +0000)]
[DAGCombiner][Mips] Don't combine bitcast+store after LegalOperations when the store is volatile, if the resulting store isn't Legal

Previously we allowed the store to be Custom. But without knowing for sure that the Custom handling won't split the store, we shouldn't convert a volatile store. We also probably shouldn't be creating a store the requires custom handling after LegalizeOps. This could lead to an infinite loop if the custom handling was to insert a bitcast. Though I guess isStoreBitCastBeneficial could be used to block such a loop.

The test changes here are due to the volatile part of this. The stores in the test are all volatile and i32 stores are marked custom, So we are no longer converting them

This is related to D50491 where I was trying to allow some bitcasting of volatile loads

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

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

5 years agoRevert "[Exception Handling] Unwind tables are required for all functions that have...
Stefan Pintilie [Fri, 24 Aug 2018 17:27:35 +0000 (17:27 +0000)]
Revert "[Exception Handling] Unwind tables are required for all functions that have an EH personality."

This reverts commit rL340614.
Previous commit broke some llvm-cfi-verify tests.

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

5 years agoRevert [Inliner] Attribute callsites with inline remarks
David Bolvansky [Fri, 24 Aug 2018 16:39:41 +0000 (16:39 +0000)]
Revert [Inliner] Attribute callsites with inline remarks

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

5 years ago[Inliner] Attribute callsites with inline remarks
David Bolvansky [Fri, 24 Aug 2018 16:28:36 +0000 (16:28 +0000)]
[Inliner] Attribute callsites with inline remarks

Summary:
Sometimes reading an output *.ll file it is not easy to understand why some callsites are not inlined. We can read output of inline remarks (option --pass-remarks-missed=inline) and try correlating its messages with the callsites.

An easier way proposed by this patch is to add to every callsite processed by Inliner an attribute with the latest message that describes the cause of not inlining this callsite. The attribute is called //inline-remark//. By default this feature is off. It can be switched on by the option //-inline-remark-attribute//.

For example in the provided test the result method //@test1// has two callsites //@bar// and inline remarks report different inlining missed reasons:
  remark: <unknown>:0:0: bar not inlined into test1 because too costly to inline (cost=-5, threshold=-6)
  remark: <unknown>:0:0: bar not inlined into test1 because it should never be inlined (cost=never): recursive

It is not clear which remark correspond to which callsite. With the inline remark attribute enabled we get the reasons attached to their callsites:
  define void @test1() {
    call void @bar(i1 true) #0
    call void @bar(i1 false) #2
    ret void
  }
  attributes #0 = { "inline-remark"="(cost=-5, threshold=-6)" }
  ..
  attributes #2 = { "inline-remark"="(cost=never): recursive" }

Patch by: yrouban (Yevgeny Rouban)

Reviewers: xbolva00, tejohnson, apilipenko

Reviewed By: xbolva00, tejohnson

Subscribers: eraman, llvm-commits

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

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

5 years ago[LICM] Hoist an invariant_start out of loops if there are no stores executed before it
Philip Reames [Fri, 24 Aug 2018 16:24:48 +0000 (16:24 +0000)]
[LICM] Hoist an invariant_start out of loops if there are no stores executed before it

Once the invariant_start is reached, we know that no instruction *after* it can modify the memory. So, if we can prove the location isn't read *between entry into the loop and the execution of the invariant_start*, we can execute the invariant_start before entering the loop.

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

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

5 years agoAdd missing override keyword (NFC)
Joel Galenson [Fri, 24 Aug 2018 16:15:44 +0000 (16:15 +0000)]
Add missing override keyword (NFC)

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

5 years ago[Exception Handling] Unwind tables are required for all functions that have an EH...
Stefan Pintilie [Fri, 24 Aug 2018 15:51:47 +0000 (15:51 +0000)]
[Exception Handling] Unwind tables are required for all functions that have an EH personality.

This patch is for defect:
https://bugs.llvm.org/show_bug.cgi?id=32611

Functions may require unwind tables even if they are marked with the attribute
nounwind. Any function with an EH personality may require an unwind table.

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

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

5 years ago[PhiValues] Use callback value handles to invalidate deleted values
John Brawn [Fri, 24 Aug 2018 15:48:30 +0000 (15:48 +0000)]
[PhiValues] Use callback value handles to invalidate deleted values

The way that PhiValues is integrated with BasicAA it is possible for a pass
which uses BasicAA to pick up an instance of BasicAA that uses PhiValues without
intending to, and then delete values from a function in a way that causes
PhiValues to return dangling pointers to these deleted values. Fix this by
having a set of callback value handles to invalidate values when they're
deleted.

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

5 years ago[cfi-verify] Support cross-DSO
Joel Galenson [Fri, 24 Aug 2018 15:21:58 +0000 (15:21 +0000)]
[cfi-verify] Support cross-DSO

When used in cross-DSO mode, CFI will generate calls to special functions rather than trap instructions.  For example, instead of generating

if (!InlinedFastCheck(f))
  abort();
call *f

CFI generates

if (!InlinedFastCheck(f))
  __cfi_slowpath(CallSiteTypeId, f);
call *f

This patch teaches cfi-verify to recognize calls to __cfi_slowpath and abort and treat them as trap functions.

In addition to normal symbols, we also parse the dynamic relocations to handle cross-DSO calls in libraries.

We also extend cfi-verify to recognize other patterns that occur using cross-DSO.  For example, some indirect calls are not guarded by a branch to a trap but instead follow a call to __cfi_slowpath.  For example:

if (!InlinedFastCheck(f))
  call *f
else {
  __cfi_slowpath(CallSiteTypeId, f);
  call *f
}

In this case, the second call to f is not marked as protected by the current code.  We thus recognize if indirect calls directly follow a call to a function that will trap on CFI violations and treat them as protected.

We also ignore indirect calls in the PLT, since on AArch64 each entry contains an indirect call that should not be protected by CFI, and these are labeled incorrectly when debug information is not present.

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

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

5 years ago[llvm-objdump] Label calls to the PLT.
Joel Galenson [Fri, 24 Aug 2018 15:21:57 +0000 (15:21 +0000)]
[llvm-objdump] Label calls to the PLT.

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

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

5 years agoFind PLT entries for x86, x86_64, and AArch64.
Joel Galenson [Fri, 24 Aug 2018 15:21:56 +0000 (15:21 +0000)]
Find PLT entries for x86, x86_64, and AArch64.

This adds a new method to ELFObjectFileBase that returns the symbols and addresses of PLT entries.

This design was suggested by pcc and eugenis in https://reviews.llvm.org/D49383.

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

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

5 years ago[Local] Make DoesKMove required for combineMetadata.
Florian Hahn [Fri, 24 Aug 2018 11:40:04 +0000 (11:40 +0000)]
[Local] Make DoesKMove required for combineMetadata.

This patch makes the DoesKMove argument non-optional, to force people
to think about it. Most cases where it is false are either code hoisting
or code sinking, where we pick one instruction from a set of
equal instructions among different code paths.

Reviewers: dberlin, nlopes, efriedma, davide

Reviewed By: efriedma

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

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

5 years ago[XRay] Refactor loadTraceFile(...) into two (NFC)
Dean Michael Berris [Fri, 24 Aug 2018 10:30:37 +0000 (10:30 +0000)]
[XRay] Refactor loadTraceFile(...) into two (NFC)

This patch splits the file trace loading function into two versions, one
that takes a filename and one that takes a `DataExtractor`.

This change is a precursor to larger changes to increase test coverage
for the trace loading implementation.

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

5 years ago[SDAG] Add versions of computeKnownBits that return a value
Justin Bogner [Fri, 24 Aug 2018 02:42:24 +0000 (02:42 +0000)]
[SDAG] Add versions of computeKnownBits that return a value

Having the KnownBits as an output parameter is kind of awkward to use
and a holdover from when it was two separate APInts. Instead, just
return a KnownBits object.

I'm leaving the existing interface in place for now, since updating
the callers all at once would be thousands of lines of diff.

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

5 years agoMake llvm-profdata show -text work as advertised in the documentation.
Richard Smith [Fri, 24 Aug 2018 01:34:45 +0000 (01:34 +0000)]
Make llvm-profdata show -text work as advertised in the documentation.

Per LLVM's CommandGuide, llvm-profdata show -text is supposed to produce
textual output that can be passed as input to further llvm-profdata
invocations. This previously didn't work for two reasons:

1) -text was not sufficient to enable the machine-readable text format output;
instead, -text was effectively ignored if -counts was not also specified. (With
this patch, -counts is instead ignored if -text is specified, because the
machine-readable text format always includes counts.)

2) When the input data was an IR-level profile, the :ir marker was missing from
the output, resulting in a text format output that would not be usable as
profiling data due to function hash mismatches.

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

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

5 years agoMake LLVM_ENABLE_CRASH_DUMPS set a variable default
Reid Kleckner [Thu, 23 Aug 2018 22:58:56 +0000 (22:58 +0000)]
Make LLVM_ENABLE_CRASH_DUMPS set a variable default

That way users can set the default to true, but then disable core dumps
from certain apps that link support.

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

5 years agoDebugInfo: Improve debug location merging
David Blaikie [Thu, 23 Aug 2018 22:35:58 +0000 (22:35 +0000)]
DebugInfo: Improve debug location merging

Fix a set of related bugs:

* Considering two locations as equivalent when their lines are the same
but their scopes are different causes erroneous debug info that
attributes a commoned call to be attributed to one of the two calls it
was commoned from.

* The previous code to compute a new location's scope was inaccurate and
would use the inlinedAt that was the /parent/ of the inlinedAt that is
the nearest common one, and also used that parent scope instead of the
nearest common scope.

* Not generating new locations generally seemed like a lower quality
choice

There was some risk that generating more new locations could hurt object
size by making more fine grained line table entries, but it looks like
that was offset by the decrease in line table (& address & ranges) size
caused by more accurately computing the scope - which likely lead to
fewer range entries (more contiguous ranges) & reduced size that way.

All up with these changes I saw minor reductions (-1.21%, -1.77%) in
.rela.debug_ranges and .rela.debug_addr (in a fission, compressed debug
info build) as well as other minor size changes (generally reductinos)
across the board (-1.32% debug_info.dwo, -1.28% debug_loc.dwo). Measured
in an optimized (-O2) build of the clang binary.

If you are investigating a size regression in an optimized debug builds,
this is certainly a patch to look into - and I'd be happy to look into
any major regressions found & see what we can do to address them.

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

5 years ago[IDF] Make GraphDiff a const constructor argument.
Alina Sbirlea [Thu, 23 Aug 2018 21:56:30 +0000 (21:56 +0000)]
[IDF] Make GraphDiff a const constructor argument.

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

5 years ago[MemorySSA] Fix def optimization handling
George Burgess IV [Thu, 23 Aug 2018 21:29:11 +0000 (21:29 +0000)]
[MemorySSA] Fix def optimization handling

In order for more complex updates of MSSA to happen (e.g. those in
D45299), MemoryDefs need to be actual `Use`s of what they're optimized
to. This patch makes that happen.

In addition, this patch changes our optimization behavior for Defs
slightly: we'll now consider a Def optimization invalid if the
MemoryAccess it's optimized to changes. That we weren't doing this
before was a bug, but given that we were tracking these with a WeakVH
before, it was sort of difficult for that to matter.

We're already have both of these behaviors for MemoryUses. The
difference is that a MemoryUse's defining access is always its optimized
access, and defining accesses are always `Use`s (in the LLVM sense).

Nothing exploded when testing a stage3 clang+llvm locally, so...

This also includes the test-case promised in r340461.

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

5 years ago[MIPS GlobalISel] Lower i8 and i16 arguments
Petar Jovanovic [Thu, 23 Aug 2018 20:41:09 +0000 (20:41 +0000)]
[MIPS GlobalISel] Lower i8 and i16 arguments

Lower integer arguments smaller than i32.
Support both register and stack arguments.
Define setLocInfo function for setting LocInfo field in ArgLocs vector.

Patch by Petar Avramovic.

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

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

5 years ago[llvm-mca] Fix parameter name. NFC.
Walter Lee [Thu, 23 Aug 2018 20:17:42 +0000 (20:17 +0000)]
[llvm-mca] Fix parameter name.  NFC.

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

5 years ago[WebAssembly] Prioritize splats over v128.consts
Thomas Lively [Thu, 23 Aug 2018 19:23:13 +0000 (19:23 +0000)]
[WebAssembly] Prioritize splats over v128.consts

Summary:
Splats are fewer bytes than v128.consts, so use them when either could
apply.

Reviewers: aheejin, dschuff

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

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

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

5 years agoRemove the use of pair inside the tuple in concat_iterator.
Alina Sbirlea [Thu, 23 Aug 2018 18:46:48 +0000 (18:46 +0000)]
Remove the use of pair inside the tuple in concat_iterator.

Summary:
Remove the use of pair inside the tuple in concat_iterator, and create separate begins and ends tuples instead.
This fixes the failure for llvm <= 3.7 and libstd++ that broke the hexagon build.

Reviewers: timshen

Subscribers: sanjoy, jlebar, dexonsmith, kparzysz, llvm-commits

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

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

5 years ago[llvm-mca] Set the Selection strategy to Default if nullptr is passed.
Matt Davis [Thu, 23 Aug 2018 18:42:37 +0000 (18:42 +0000)]
[llvm-mca] Set the Selection strategy to Default if nullptr is passed.

* Set (not reset) the strategy in Scheduler::setCustomStrategyImpl()

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

5 years ago[x86] move/add tests for insertelement with variable index; NFC
Sanjay Patel [Thu, 23 Aug 2018 18:38:40 +0000 (18:38 +0000)]
[x86] move/add tests for insertelement with variable index; NFC

The variable index pattern is different than the constant index
cases as shown in D51125. We might want to splat regardless of
whether the scalar is loaded from memory or transferred from GPR.

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

5 years ago[LoopVectorize][NFCI] Use find instead of count
David Bolvansky [Thu, 23 Aug 2018 18:34:58 +0000 (18:34 +0000)]
[LoopVectorize][NFCI] Use find instead of count

Summary:
Avoid "count" if possible -> use "find" to check for the existence of keys.

Passed llvm test suite.

Reviewers: fhahn, dcaballe, mkuper, rengolin

Reviewed By: fhahn

Subscribers: llvm-commits

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

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

5 years agoFixup AreCoreFilesPrevented() to consider first LLVM_ENABLE_CRASH_DUMPS and secondly...
Douglas Yung [Thu, 23 Aug 2018 18:20:13 +0000 (18:20 +0000)]
Fixup AreCoreFilesPrevented() to consider first LLVM_ENABLE_CRASH_DUMPS and secondly coreFilesPrevented.

The previous change ignored the latter resulting in crash dumps being generated when LLVM_ENABLE_CRASH_DUMPS was
set, but coreFilesPrevented was true.

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

5 years ago[ValueTracking] Fix assert message and add test case for r340546 and PR38677.
Craig Topper [Thu, 23 Aug 2018 17:45:53 +0000 (17:45 +0000)]
[ValueTracking] Fix assert message and add test case for r340546 and PR38677.

The bug was already fixed. This just adds a test case for it.

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