Martin Storsjo [Mon, 27 Aug 2018 06:04:36 +0000 (06:04 +0000)]
[COFF] Check the instructions in ARM MOV32T relocations
For this relocation, which applies to two consecutive instructions,
it's plausible that the second instruction might not actually be
the right one.
Differential Revision: https://reviews.llvm.org/D50998
llvm-svn: 340715
Craig Topper [Mon, 27 Aug 2018 05:44:45 +0000 (05:44 +0000)]
[X86] Undef __DEFAULT_FN_ATTRS in avx512fintrin.h.
Fixes test failure after r340713
llvm-svn: 340714
Craig Topper [Mon, 27 Aug 2018 05:27:15 +0000 (05:27 +0000)]
[X86] Don't set min_vector_width to 512 on intrinsics that only operate on k registers.
llvm-svn: 340713
David Carlier [Mon, 27 Aug 2018 05:16:09 +0000 (05:16 +0000)]
[Xray] Darwin - Enable in the driver side
Reviewers: dberris
Reviered By: dberris
Differential Revision: https://reviews.llvm.org/D51269
llvm-svn: 340712
Zachary Turner [Mon, 27 Aug 2018 04:04:41 +0000 (04:04 +0000)]
[MS Demangler] Add virtual destructor.
Silence -Wnon-virtual-dtor.
llvm-svn: 340711
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.
llvm-svn: 340710
Fangrui Song [Sun, 26 Aug 2018 19:47:23 +0000 (19:47 +0000)]
[Driver] Change MipsLinux default linker from "lld" to "ld.lld"
Reviewers: kzhuravl, atanasyan
Reviewed By: atanasyan
Subscribers: sdardis, arichardson, jrtc27, atanasyan, cfe-commits
Differential Revision: https://reviews.llvm.org/D51234
llvm-svn: 340709
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
llvm-svn: 340708
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
llvm-svn: 340707
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
llvm-svn: 340706
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
llvm-svn: 340705
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.
llvm-svn: 340704
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.
llvm-svn: 340703
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. ;]
llvm-svn: 340702
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.
llvm-svn: 340701
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.
llvm-svn: 340700
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.
llvm-svn: 340699
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
llvm-svn: 340698
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
llvm-svn: 340697
Argyrios Kyrtzidis [Sun, 26 Aug 2018 06:27:23 +0000 (06:27 +0000)]
[index] Introduce 'ProtocolInterface' as part of SymbolPropertySet
This is useful to directly infer that a method or property is from a protocol interface
at the point of the symbol occurrences.
llvm-svn: 340696
Craig Topper [Sun, 26 Aug 2018 03:43:23 +0000 (03:43 +0000)]
[X86] Fix typo in comment, expect->except. NFC
llvm-svn: 340695
Craig Topper [Sun, 26 Aug 2018 00:22:07 +0000 (00:22 +0000)]
[X86] Add test cases for D50952, paddus patterns involving constants. NFC
llvm-svn: 340694
Sid Manning [Sat, 25 Aug 2018 23:16:37 +0000 (23:16 +0000)]
[ELF][HEXAGON] Add R_HEX_B13_PCREL relocation support
Differential Revision: https://reviews.llvm.org/D51166
llvm-svn: 340693
Sid Manning [Sat, 25 Aug 2018 21:25:35 +0000 (21:25 +0000)]
[ELF][HEXAGON] Add R_HEX_B9_PCREL and R_HEX_B9_PCREL_X relocation support
Differential Revision: https://reviews.llvm.org/D51045
llvm-svn: 340692
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
llvm-svn: 340691
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
llvm-svn: 340690
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
llvm-svn: 340689
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.
llvm-svn: 340688
Simon Pilgrim [Sat, 25 Aug 2018 17:11:11 +0000 (17:11 +0000)]
Fix -Wunused-function warning. NFCI.
llvm-svn: 340687
Simon Pilgrim [Sat, 25 Aug 2018 16:49:35 +0000 (16:49 +0000)]
Remove superfluous semicolon. NFCI.
llvm-svn: 340686
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
llvm-svn: 340685
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
llvm-svn: 340684
Sanjay Patel [Sat, 25 Aug 2018 14:37:08 +0000 (14:37 +0000)]
[InstCombine] add tests for shuffle+binop transform; NFC
llvm-svn: 340683
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.
llvm-svn: 340682
Jonas Hahnfeld [Sat, 25 Aug 2018 13:42:40 +0000 (13:42 +0000)]
[CUDA/OpenMP] Define only some host macros during device compilation
When compiling CUDA or OpenMP device code Clang parses header files
that expect certain predefined macros from the host architecture. To
make this work the compiler passes the host triple via the -aux-triple
argument and (until now) pulls in all macros for that "auxiliary triple"
unconditionally.
However this results in defines like __SSE_MATH__ that will trigger
inline assembly making use of the "advertised" target features. See
the discussion of D47849 and PR38464 for a detailed explanation of
the encountered problems.
Instead of blacklisting "known bad" examples this patch starts adding
defines that are needed for certain headers like bits/wordsize.h and
bits/mathinline.h.
The disadvantage of this approach is that it decouples the definitions
from their target toolchain. However in my opinion it's more important
to keep definitions for one header close together. For one this will
include a clear documentation why these particular defines are needed.
Furthermore it simplifies maintenance because adding defines for a new
header or support for a new aux-triple only needs to touch one piece
of code.
Differential Revision: https://reviews.llvm.org/D50845
llvm-svn: 340681
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
llvm-svn: 340680
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
llvm-svn: 340679
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
llvm-svn: 340678
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
llvm-svn: 340677
Frederic Riss [Sat, 25 Aug 2018 01:25:24 +0000 (01:25 +0000)]
Disable exceptions for TestDataFormatterLibcxxOptional.py
On macOS, some of the <optional> APIs used by the test are available only
starting on macOS 10.14 when using exceptions. Build the test with
-fno-exceptions so that the test builds on older systems too.
rdar://problem/
43700544
llvm-svn: 340676
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!
llvm-svn: 340675
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
llvm-svn: 340674
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
llvm-svn: 340672
Richard Smith [Fri, 24 Aug 2018 23:30:26 +0000 (23:30 +0000)]
Port my recent changes from LLVM copy of the demangler:
r340663 - Allow Allocator::make to make a node of a different type than that
requested.
r340664 - Add documentation comment to ForwardTemplateReference.
r340665 - Fix ExpandedSpecialSubstitution demangling for Sa and Sb.
r340670 - Allow demangler's node allocator to fail, and bail out of the entire
demangling process when it does.
llvm-svn: 340671
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
llvm-svn: 340670
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
llvm-svn: 340669
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.
llvm-svn: 340668
Hans Wennborg [Fri, 24 Aug 2018 22:46:33 +0000 (22:46 +0000)]
Revert r323281 "Adjust MaxAtomicInlineWidth for i386/i486 targets."
As reported on http://lists.llvm.org/pipermail/cfe-dev/2018-August/058760.html,
this broke i386-freebsd11 due to its lack of atomic 64 bit primitives.
While that's not really this commit's fault, let's revert back to the old
behaviour until this can be fixed. This means generating cmpxchg8b etc for i386
and i486 which don't technically support those, but that's been the behaviour
for a long time, so a little longer probably doesn't hurt that much.
> Adjust MaxAtomicInlineWidth for i386/i486 targets.
>
> This is to fix the bug reported in https://bugs.llvm.org/show_bug.cgi?id=34347#c6.
> Currently, all MaxAtomicInlineWidth of x86-32 targets are set to 64. However,
> i386 doesn't support any cmpxchg related instructions. i486 only supports cmpxchg.
> So in this patch MaxAtomicInlineWidth is reset as follows:
> For i386, the MaxAtomicInlineWidth should be 0 because no cmpxchg is supported.
> For i486, the MaxAtomicInlineWidth should be 32 because it supports cmpxchg.
> For others 32 bits x86 cpu, the MaxAtomicInlineWidth should be 64 because of cmpxchg8b.
>
> Differential Revision: https://reviews.llvm.org/D42154
llvm-svn: 340666
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.
llvm-svn: 340665
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.
llvm-svn: 340664
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
llvm-svn: 340663
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.
llvm-svn: 340661
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.
llvm-svn: 340660
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.
llvm-svn: 340659
Stella Stamenova [Fri, 24 Aug 2018 21:42:53 +0000 (21:42 +0000)]
[vscode] Skip some of the vscode tests on Linux and fix one
Summary: These are already skipped on Darwin because they cause build bot failures. Both on the build bots as well as in our testing we have seen a number of these tests fail and hang. This change skips the failing/hanging tests on Linux and also fixes one of the test - the test needs the thread library to build.
Reviewers: asmith, clayborg, aprantl
Subscribers: teemperor, lldb-commits
Differential Revision: https://reviews.llvm.org/D51227
llvm-svn: 340658
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
llvm-svn: 340657
Jonathan Peyton [Fri, 24 Aug 2018 21:34:10 +0000 (21:34 +0000)]
[OpenMP] Remove deprecated/obsolete MIC attributes from headers
llvm-svn: 340656
Matt Arsenault [Fri, 24 Aug 2018 21:24:18 +0000 (21:24 +0000)]
DAG: Allow matching fminnum/fmaxnum from vselect
llvm-svn: 340655
Vitaly Buka [Fri, 24 Aug 2018 21:03:35 +0000 (21:03 +0000)]
Use unique_ptr to hold MCInstrInfo
llvm-svn: 340654
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
llvm-svn: 340653
Raphael Isemann [Fri, 24 Aug 2018 20:55:23 +0000 (20:55 +0000)]
Fixed windows bots that were failing because of PATH_MAX
As we only use PATH_MAX for an assert in a unit test that is supposed
to catch the random failures on the Swift CI bots, we might as well
just ifdef this assert out on Windows.
llvm-svn: 340652
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
llvm-svn: 340651
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
llvm-svn: 340650
Peter Collingbourne [Fri, 24 Aug 2018 20:38:15 +0000 (20:38 +0000)]
Reland r340552, "Driver: Enable address-significance tables by default when targeting COFF." which was reverted in r340579.
The underlying problem that caused the revert was fixed in r340648.
Differential Revision: https://reviews.llvm.org/D51049
llvm-svn: 340649
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
llvm-svn: 340648
Jonathan Peyton [Fri, 24 Aug 2018 20:35:42 +0000 (20:35 +0000)]
[OpenMP] Fixed affinity verbose double printing for balanced type.
llvm-svn: 340647
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.
llvm-svn: 340646
Matt Davis [Fri, 24 Aug 2018 20:24:53 +0000 (20:24 +0000)]
[llvm-mca] Move views and stats into a Views subdir. NFC.
llvm-svn: 340645
Eli Friedman [Fri, 24 Aug 2018 20:18:34 +0000 (20:18 +0000)]
Add REQUIRES: x86-registered-target to test.
(This isn't really x86-specific, but we have to pick some non-Apple
triple to exercise the right codepath.)
llvm-svn: 340644
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
llvm-svn: 340643
Joel Galenson [Fri, 24 Aug 2018 19:40:35 +0000 (19:40 +0000)]
Use unique_ptr.
llvm-svn: 340642
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
llvm-svn: 340641
Eli Friedman [Fri, 24 Aug 2018 19:31:52 +0000 (19:31 +0000)]
[LTO] Fix -save-temps with LTO and unnamed globals.
If all LLVM passes are disabled, we can't emit a summary because there
could be unnamed globals in the IR.
Differential Revision: https://reviews.llvm.org/D51198
llvm-svn: 340640
Stefan Pintilie [Fri, 24 Aug 2018 19:24:20 +0000 (19:24 +0000)]
[PowerPC] Change Test Options [NFC]
Patch by amyk
llvm-svn: 340639
Philip Reames [Fri, 24 Aug 2018 19:13:39 +0000 (19:13 +0000)]
[AST] Simplify code minorly using pattern match [NFC]
llvm-svn: 340638
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
llvm-svn: 340637
Aaron Ballman [Fri, 24 Aug 2018 18:48:35 +0000 (18:48 +0000)]
Thread safety analysis no longer hands when analyzing a self-referencing initializer.
This fixes PR38640.
llvm-svn: 340636
Martin Storsjo [Fri, 24 Aug 2018 18:36:42 +0000 (18:36 +0000)]
[Common] Discard the temp file while keeping the memory mapping open, on errors
Differential Revision: https://reviews.llvm.org/D51095
llvm-svn: 340635
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
llvm-svn: 340634
Kostya Kortchinsky [Fri, 24 Aug 2018 18:21:32 +0000 (18:21 +0000)]
[scudo] Replace eraseHeader with compareExchangeHeader for Quarantined chunks
Summary:
The reason for the existence of `eraseHeader` was that it was deemed faster
to null-out a chunk header, effectively making it invalid, rather than marking
it as available, which incurred a checksum computation and a cmpxchg.
A previous use of `eraseHeader` was removed with D50655 due to a race.
Now we remove the second use of it in the Quarantine deallocation path and
replace is with a `compareExchangeHeader`.
The reason for this is that greatly helps debugging some heap bugs as the chunk
header is now valid and the chunk marked available, as opposed to the header
being invalid. Eg: we get an invalid state error, instead of an invalid header
error, which reduces the possibilities. The computational penalty is negligible.
Reviewers: alekseyshl, flowerhack, eugenis
Reviewed By: eugenis
Subscribers: delcypher, jfb, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D51224
llvm-svn: 340633
Jonathan Peyton [Fri, 24 Aug 2018 18:07:35 +0000 (18:07 +0000)]
[OpenMP] Fix tasking bug for decreasing hot team nthreads
The __kmp_execute_tasks_template() function reads the task_team and
current_task from the thread structure. There appears to be a pathological
timing where the number of threads in the hot team decreases and so a
thread is put in the pool via __kmp_free_thread(). It could be the case that:
1) A thread reads th_task_team into task_team local variables
and is then interrupted by the OS
2) Master frees the thread and sets current task and task team to NULL
3) The thread reads current_task as NULL
When this happens, current_task is dereferenced and a segfault occurs.
This patch just checks for current_task to not be NULL as well.
Differential Revision: https://reviews.llvm.org/D50651
llvm-svn: 340632
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
llvm-svn: 340631
Craig Topper [Fri, 24 Aug 2018 18:05:02 +0000 (18:05 +0000)]
[X86] Add test case for D50868. NFC
llvm-svn: 340630
Jonathan Peyton [Fri, 24 Aug 2018 18:05:00 +0000 (18:05 +0000)]
[OpenMP] Add check for hot_teams array
If hot teams are not being used, this code could seg fault without the added
check, and does so when composability is used in conjunction with nesting.
The fix prevents the segfault.
Differential Revision: https://reviews.llvm.org/D50649
llvm-svn: 340629
Jonathan Peyton [Fri, 24 Aug 2018 18:03:27 +0000 (18:03 +0000)]
[OpenMP] Fix incorrect barrier imbalance reporting in ITTNOTIFY
Exclude nested explicit tasks from timing, only outer level explicit task
counted and its time added to barrier arrive time for the thread.
Differential Revision: https://reviews.llvm.org/D50584
llvm-svn: 340628
Raphael Isemann [Fri, 24 Aug 2018 18:01:56 +0000 (18:01 +0000)]
[ASTImporter] Add test for PackExpansionExpr
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51142
llvm-svn: 340627
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
llvm-svn: 340626
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.
llvm-svn: 340625
Jonas Toth [Fri, 24 Aug 2018 17:25:06 +0000 (17:25 +0000)]
[clang-format] fix PR38557 - comments between "default" and ':' causes the case label to be treated as an identifier
Summary:
The Bug was reported and fixed by Owen Pan. See the original bug report here: https://bugs.llvm.org/show_bug.cgi?id=38557
Patch by Owen Pan!
Reviewers: krasimir, djasper, klimek
Reviewed By: klimek
Subscribers: JonasToth, cfe-commits
Differential Revision: https://reviews.llvm.org/D50697
llvm-svn: 340624
Jonas Toth [Fri, 24 Aug 2018 17:14:31 +0000 (17:14 +0000)]
[clang-format] fix PR38525 - Extraneous continuation indent spaces with BreakBeforeBinaryOperators set to All
Summary: See bug report https://bugs.llvm.org/show_bug.cgi?id=38525 for more details.
Reviewers: djasper, klimek, krasimir, sammccall
Reviewed By: sammccall
Subscribers: hiraditya, JonasToth, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D50699
llvm-svn: 340623
Krzysztof Parzyszek [Fri, 24 Aug 2018 17:13:42 +0000 (17:13 +0000)]
[Hexagon] Remove unneeded strings from builtin definitions, NFC
llvm-svn: 340622
David Carlier [Fri, 24 Aug 2018 16:53:06 +0000 (16:53 +0000)]
[Sanitizer] implementing remaining function under OSX
- GetRandom and GetnumberOfCPUs using sys call for the former.
- enabling unit tests for the other oses.
Reviewers: kubamracek
Reviewed By: kubamracek
Differential Revision: https://reviews.llvm.org/D50937
llvm-svn: 340621
Julie Hockett [Fri, 24 Aug 2018 16:43:46 +0000 (16:43 +0000)]
[clang-doc] Fix memory leaks
Adds a virtual destructor to the base Info class.
Differential Revision: https://reviews.llvm.org/D51137
llvm-svn: 340620
David Bolvansky [Fri, 24 Aug 2018 16:39:41 +0000 (16:39 +0000)]
Revert [Inliner] Attribute callsites with inline remarks
llvm-svn: 340619
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
llvm-svn: 340618
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
llvm-svn: 340617
Joel Galenson [Fri, 24 Aug 2018 16:22:42 +0000 (16:22 +0000)]
Modify tests to show PLT entry labels
llvm-svn: 340616
Joel Galenson [Fri, 24 Aug 2018 16:15:44 +0000 (16:15 +0000)]
Add missing override keyword (NFC)
llvm-svn: 340615
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
llvm-svn: 340614
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.
llvm-svn: 340613