Evandro Menezes [Tue, 30 Apr 2019 18:35:38 +0000 (18:35 +0000)]
[SimplifyLibCalls] Clean up code (NFC)
Fix pointer check after dereferencing (PR41665).
llvm-svn: 359595
Yaxun Liu [Tue, 30 Apr 2019 18:35:37 +0000 (18:35 +0000)]
AMDGPU: Enable _Float16
llvm-svn: 359594
Jonas Devlieghere [Tue, 30 Apr 2019 18:21:14 +0000 (18:21 +0000)]
Add CxxModuleHandler to Xcode project
llvm-svn: 359593
Sanjay Patel [Tue, 30 Apr 2019 18:15:18 +0000 (18:15 +0000)]
[AArch64] add more tests for constant folding failures; NFC
llvm-svn: 359592
Petr Hosek [Tue, 30 Apr 2019 18:13:22 +0000 (18:13 +0000)]
Reland "[compiler-rt] Simple crtbegin.o and crtend.o implementation"
Clang relies on existence of certain symbols that are normally
provided by crtbegin.o/crtend.o. However, LLVM does not currently
provide implementation of these files, instead relying on either
libgcc or implementations provided as part of the system.
This change provides an initial implementation of crtbegin.o/crtend.o
that can be used on system that don't provide crtbegin.o/crtend.o as
part of their C library.
Differential Revision: https://reviews.llvm.org/D28791
llvm-svn: 359591
Jonathan Metzman [Tue, 30 Apr 2019 17:58:59 +0000 (17:58 +0000)]
fix broken test
llvm-svn: 359590
Jonathan Metzman [Tue, 30 Apr 2019 17:58:58 +0000 (17:58 +0000)]
remove extra zeros
llvm-svn: 359589
Jonathan Metzman [Tue, 30 Apr 2019 17:58:58 +0000 (17:58 +0000)]
remove stale comment
llvm-svn: 359588
Jonathan Metzman [Tue, 30 Apr 2019 17:58:57 +0000 (17:58 +0000)]
change order
llvm-svn: 359587
Jonathan Metzman [Tue, 30 Apr 2019 17:58:57 +0000 (17:58 +0000)]
fix comment
llvm-svn: 359586
Jonathan Metzman [Tue, 30 Apr 2019 17:58:56 +0000 (17:58 +0000)]
[libFuzzer] Enable for i386
Summary: Get libFuzzer to build on i386 and fix tests.
Subscribers: mgorny, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D61070
llvm-svn: 359585
Jonathan Metzman [Tue, 30 Apr 2019 17:58:55 +0000 (17:58 +0000)]
Fix issues with testing for i386
llvm-svn: 359584
Jonathan Metzman [Tue, 30 Apr 2019 17:58:54 +0000 (17:58 +0000)]
Enable x86 builds
llvm-svn: 359583
Craig Topper [Tue, 30 Apr 2019 17:56:47 +0000 (17:56 +0000)]
[X86] If PreprocessISelDAG reorders a load before a call, make sure we remove dead nodes from the graph
The reordering can leave at least a dead TokenFactor in the graph. This cause the linearize scheduler to fail with something like the assert seen in PR22614. This is only one of many ways we can break the linearize scheduler today so I can't say for sure that any of the other failures in that bug were caused by this issue.
This takes the heavy hammer approach of just running RemoveDeadNodes unconditionally at the end of the PreprocessISelDAG. If this turns out to be a compile time hit, we can try to refine it.
Differential Revision: https://reviews.llvm.org/D61164
llvm-svn: 359582
Craig Topper [Tue, 30 Apr 2019 17:56:28 +0000 (17:56 +0000)]
[X86] Initial cleanups on the FixupLEAs pass. Separate Atom LEA creation from other LEA optimizations.
This removes some of the class variables. Merge basic block processing into
runOnMachineFunction to keep the flags local.
Pass MachineBasicBlock around instead of an iterator. We can get the iterator in
the few places that need it. Allows a range-based outer for loop.
Separate the Atom optimization from the rest of the optimizations. This allows
fixupIncDec to create INC/DEC and still allow Atom to turn it back into LEA
when profitable by its heuristics.
I'd like to improve fixupIncDec to turn LEAs into ADD any time the base or index
register is equal to the destination register. This is profitable regardless of
the various slow flags. But again we would want Atom to be able to undo that.
Differential Revision: https://reviews.llvm.org/D60993
llvm-svn: 359581
Nico Weber [Tue, 30 Apr 2019 17:46:00 +0000 (17:46 +0000)]
Re-reland "[Option] Fix PR37006 prefix choice in findNearest"
This was first reviewed in https://reviews.llvm.org/D46776 and
landed in r332299, but got reverted because it broke the PS4
bots.
https://reviews.llvm.org/D50410 fixed this, and then this
change was re-reviewed at https://reviews.llvm.org/D50515 and
relanded in r341329. It got reverted due to causing MSan issues.
However, nobody wrote down the error message and the bot link
is dead, so I'm relanding this to capture the MSan error.
I'll then either fix it, or copy it somewhere and revert if
fixing looks difficult.
llvm-svn: 359580
Petr Hosek [Tue, 30 Apr 2019 17:32:05 +0000 (17:32 +0000)]
Revert "[compiler-rt] Simple crtbegin.o and crtend.o implementation"
This reverts commit r359576 since it's failing on Windows bots.
llvm-svn: 359579
Yitzhak Mandelbaum [Tue, 30 Apr 2019 17:24:36 +0000 (17:24 +0000)]
[LibTooling] Fix broken test after r359574.
r359574 changed the way that failures are reported, which broke the test TransformerTest.NodePartNameDeclRefFailure which detects a faiure.
llvm-svn: 359578
Jonas Devlieghere [Tue, 30 Apr 2019 17:22:29 +0000 (17:22 +0000)]
Sort Symbol/CMakeLists.txt
This makes resolving merge conflicts downstream a tad easier.
llvm-svn: 359577
Petr Hosek [Tue, 30 Apr 2019 17:21:13 +0000 (17:21 +0000)]
[compiler-rt] Simple crtbegin.o and crtend.o implementation
Clang relies on existence of certain symbols that are normally
provided by crtbegin.o/crtend.o. However, LLVM does not currently
provide implementation of these files, instead relying on either
libgcc or implementations provided as part of the system.
This change provides an initial implementation of crtbegin.o/crtend.o
that can be used on system that don't provide crtbegin.o/crtend.o as
part of their C library.
Differential Revision: https://reviews.llvm.org/D28791
llvm-svn: 359576
Jonas Devlieghere [Tue, 30 Apr 2019 17:21:05 +0000 (17:21 +0000)]
XFAIL x86-64-zmm-read on Darwin
llvm-svn: 359575
Yitzhak Mandelbaum [Tue, 30 Apr 2019 16:48:33 +0000 (16:48 +0000)]
[LibTooling] Change Transformer's TextGenerator to a partial function.
Summary:
Changes the signature of the TextGenerator std::function to return an Expected<std::string>
instead of std::string to allow for (non-fatal) failures. Previously, we
expected that any failures would be expressed with assertions. However, that's
unfriendly to running the code in servers or other places that don't want their
library calls to crash the program.
Correspondingly, updates Transformer's handling of failures in TextGenerators
and the signature of `ChangeConsumer`.
Reviewers: ilya-biryukov
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61015
llvm-svn: 359574
Stella Stamenova [Tue, 30 Apr 2019 16:42:39 +0000 (16:42 +0000)]
Un-xfail the TestMiniDump tests on Windows
After Aaron's commit for ObjectFilePECOFF:: GetUUID, the tests are now passing
llvm-svn: 359573
Michal Gorny [Tue, 30 Apr 2019 16:30:32 +0000 (16:30 +0000)]
[lldb] [Process/NetBSD] Fix handling piod_len from PT_IO calls
Fix bugs in piod_len return value processing in ReadMemory()
and WriteMemory() methods. In particular, add support for piod_len == 0
indicating EOF, and fix summing bytes_read/bytes_written when PT_IO does
partial reads/writes.
The EOF condition could happen if LLDB attempts to read past
vm.maxaddress, e.g. as a result of RBP containing large (invalid) value.
Previously, the 0 return caused the function to retry reading via PT_IO
indefinitely, effectively deadlooping lldb-server.
Partial reads probably did not occur in practice, yet they would cause
ReadMemory() to return incorrect bytes_read and/or overwrite previously
read data.
WriteMemory() suffered from analoguous problems.
Differential Revision: https://reviews.llvm.org/D61310
llvm-svn: 359572
Louis Dionne [Tue, 30 Apr 2019 15:44:19 +0000 (15:44 +0000)]
[libc++][CMake] Refactor how we link against system libraries
Summary:
Instead of populating the global LIBCXX_LIBRARIES, we use the link-time
dependency management built into CMake to propagate link flags. This
leads to a cleaner and easier-to-follow build.
Reviewers: phosek, smeenai, EricWF
Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, mstorsjo, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D60969
llvm-svn: 359571
Nico Weber [Tue, 30 Apr 2019 15:36:02 +0000 (15:36 +0000)]
gn build: Add check-clangd target after r3359424
r359527 already merged some of that to the GN build,
but it was missing some bits as well.
The check-clangd target works (at least for now) differently than all
the other check-foo targets, see https://reviews.llvm.org/D61187
For that reason, there's no gni file and the generated lit configs are
not (yet?) added to llvm-lit/BUILD.gn.
llvm-svn: 359570
Russell Gallop [Tue, 30 Apr 2019 15:35:16 +0000 (15:35 +0000)]
Add llvm-profdata to LLVM_TOOLCHAIN_TOOLS
This is required for using PGO on Windows but isn't in the Windows
release packages. Windows packages are built with
LLVM_INSTALL_TOOLCHAIN_ONLY so only includes llvm "tools" listed here.
Differential Revision: https://reviews.llvm.org/D61317
llvm-svn: 359569
Jordan Rupprecht [Tue, 30 Apr 2019 15:21:36 +0000 (15:21 +0000)]
[llvm-objcopy] Add RISC-V support for -B/-O
Reviewers: jorgbrown, espindola, alexshap, jhenderson
Subscribers: emaste, arichardson, fedor.sergeev, jakehehrlich, kito-cheng, shiva0217, MaskRay, rogfer01, rkruppe, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61272
llvm-svn: 359568
Kostya Kortchinsky [Tue, 30 Apr 2019 14:56:18 +0000 (14:56 +0000)]
[scudo][standalone] Add the memory reclaiming mechanism
Summary:
This CL implements the memory reclaiming function `releaseFreeMemoryToOS`
and its associated classes. Most of this code was originally written by
Aleksey for the Primary64 in sanitizer_common, and I made some changes to
be able to implement 32-bit reclaiming as well. The code has be restructured
a bit to accomodate for freelist of batches instead of the freearray used
in the current sanitizer_common code.
Reviewers: eugenis, vitalybuka, morehouse, hctim
Reviewed By: vitalybuka
Subscribers: srhines, mgorny, delcypher, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D61214
llvm-svn: 359567
Sanjay Patel [Tue, 30 Apr 2019 14:37:15 +0000 (14:37 +0000)]
[SelectionDAG] remove div-by-zero constant folding restriction
We don't have this restriction in IR, so it should not be here
either simply out of consistency. Code that wants to handle FP
exceptions is expected to use the 'strict' variants of these
nodes.
We don't get the frem case because frem by 0.0 produces NaN (invalid),
and that's the remaining check here (so the removed check for frem
was dead code AFAIK).
This is the only place in SDAG that uses "HasFPExceptions", so I
think we should remove that entirely as a follow-up patch.
llvm-svn: 359566
Andrew Ng [Tue, 30 Apr 2019 14:31:22 +0000 (14:31 +0000)]
[LLD][ELF] /DISCARD/ output sections should not be orphans
/DISCARD/ output sections were being treated as orphans. As a result, if
a /DISCARD/ output section has been assigned a PHDR, it could cause
incorrect assignment of sections to segments.
Differential Revision: https://reviews.llvm.org/D61186
llvm-svn: 359565
Sam McCall [Tue, 30 Apr 2019 14:21:10 +0000 (14:21 +0000)]
[clangd] gen_std uses multiprocessing pool to be fast. While here, log ambiguous symbols. NFC
llvm-svn: 359564
Eugene Leviant [Tue, 30 Apr 2019 13:51:48 +0000 (13:51 +0000)]
[llvm-nm] Add --special-syms no-op flag
Differential revision: https://reviews.llvm.org/D60502
llvm-svn: 359563
Nico Weber [Tue, 30 Apr 2019 13:45:16 +0000 (13:45 +0000)]
gn build: Merge r359455
llvm-svn: 359562
Sanjay Patel [Tue, 30 Apr 2019 13:43:17 +0000 (13:43 +0000)]
[AArch64] add tests for fdiv/frem constant folding (PR41668); NFC
llvm-svn: 359561
Pavel Labath [Tue, 30 Apr 2019 13:33:18 +0000 (13:33 +0000)]
PostfixExpression: Introduce InitialValueNode
Summary:
This node represents can be used to refer to the initial value, which is
sometimes pushed onto the DWARF stack as the "input" to the DWARF
expression. The typical use case (and the reason why I'm introducing it)
is that the "Canonical Frame Address" is passed this way to the DWARF
expressions computing the values of registers during frame unwind.
The nodes are converted into dwarf by keeping track of DWARF stack depth
an any given point, and then copying the initial value from the bottom
of the stack via the DW_OP_pick opcode. This could be made more
efficient for simple expressions, but here I chose to start with the
most general implementation possible.
Reviewers: amccarth, clayborg, aleksandr.urakov
Subscribers: aprantl, jasonmolenda, lldb-commits, markmentovai
Differential Revision: https://reviews.llvm.org/D61183
llvm-svn: 359560
Simon Pilgrim [Tue, 30 Apr 2019 13:09:55 +0000 (13:09 +0000)]
[TableGen] Fix null pointer dereferencing in token parser.
Reported in https://www.viva64.com/en/b/0629/
llvm-svn: 359559
Russell Gallop [Tue, 30 Apr 2019 12:53:19 +0000 (12:53 +0000)]
Fix inconsistency in calculating DIAG_START_ values.
This was introduced at r313975. As DIAG_SIZE_CROSSTU and
DIAG_SIZE_COMMENT are both 100 this should be NFC.
Differential Revision: https://reviews.llvm.org/D61264
llvm-svn: 359558
Hans Wennborg [Tue, 30 Apr 2019 12:41:33 +0000 (12:41 +0000)]
vs integration: vs2019 support
llvm-svn: 359557
Russell Gallop [Tue, 30 Apr 2019 12:37:10 +0000 (12:37 +0000)]
[cmake] Fix error message on simulated VS version check
For clang-cl self hosts in VS2015 environment this was reporting: "Host
Clang must have at least -fms-compatibility-version=19.00.24213.1, your
version is 9.0.0".
This check fires as CMake detects the simulated environment as _MSC_VER
1900, which is truncated. This makes it less than the required
19.00.24213.1.
Differential revision: https://reviews.llvm.org/D61188
llvm-svn: 359556
Simon Pilgrim [Tue, 30 Apr 2019 12:34:21 +0000 (12:34 +0000)]
Revert rL359519 : [MemorySSA] Invalidate MemorySSA if AA or DT are invalidated.
Summary:
MemorySSA keeps internal pointers of AA and DT.
If these get invalidated, so should MemorySSA.
Reviewers: george.burgess.iv, chandlerc
Subscribers: jlebar, Prazek, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61043
........
This was causing windows build bot failures
llvm-svn: 359555
Andrew Ng [Tue, 30 Apr 2019 12:27:06 +0000 (12:27 +0000)]
[LLD][ELF] Fix getRankProximity to "ignore" not live sections
This is a follow up to r358979 which made findOrphanPos only consider
live sections. Unfortunately, this required change to getRankProximity,
used by findOrphanPos, was missed.
Differential Revision: https://reviews.llvm.org/D61197
llvm-svn: 359554
Simon Pilgrim [Tue, 30 Apr 2019 11:03:09 +0000 (11:03 +0000)]
[SLP] Lit test that cannot get vectorized due to lack of look-ahead operand reordering heuristic.
The code in this test is not vectorized by SLP because its operand reordering cannot look beyond the immediate predecessors.
This will get fixed in a follow-up patch that introduces the look-ahead operand reordering heuristic.
Committed on behalf of @vporpo (Vasileios Porpodas)
Differential Revision: https://reviews.llvm.org/D61283
llvm-svn: 359553
George Rimar [Tue, 30 Apr 2019 11:02:09 +0000 (11:02 +0000)]
[llvm-objcopy] - Check dynamic relocation sections for broken references.
This is a fix for https://bugs.llvm.org/show_bug.cgi?id=41371.
Currently, it is possible to break the sh_link field of the dynamic relocation section
by removing the section it refers to. The patch fixes an issue and adds 2 test cases.
One of them shows that it does not seem possible to break the sh_info field.
I added an assert to verify this.
Differential revision: https://reviews.llvm.org/D60825
llvm-svn: 359552
Simon Pilgrim [Tue, 30 Apr 2019 10:57:37 +0000 (10:57 +0000)]
Fix gcc "-Wdangling-else" warning. NFCI.
llvm-svn: 359551
Simon Pilgrim [Tue, 30 Apr 2019 10:57:02 +0000 (10:57 +0000)]
Fix gcc "-Wdangling-else" warnings. NFCI.
llvm-svn: 359550
Jeremy Morse [Tue, 30 Apr 2019 10:56:33 +0000 (10:56 +0000)]
Update checks in an instcombine test, NFC
This reduces the delta in some incoming work that changes this test.
llvm-svn: 359549
Simon Pilgrim [Tue, 30 Apr 2019 10:35:37 +0000 (10:35 +0000)]
Fix Wpedantic "default argument specified for lambda parameter" warning. NFCI.
llvm-svn: 359548
Sjoerd Meijer [Tue, 30 Apr 2019 10:28:50 +0000 (10:28 +0000)]
[ARM] Implement TTI::getMemcpyCost
This implements TargetTransformInfo method getMemcpyCost, which estimates the
number of instructions to which a memcpy instruction expands to.
Differential Revision: https://reviews.llvm.org/D59787
llvm-svn: 359547
Raphael Isemann [Tue, 30 Apr 2019 10:27:31 +0000 (10:27 +0000)]
Sort containers alphabetically in CxxModuleHandler [NFC]
llvm-svn: 359546
Simon Pilgrim [Tue, 30 Apr 2019 10:18:25 +0000 (10:18 +0000)]
Fix for bug 41512: lower INSERT_VECTOR_ELT(ZeroVec, 0, Elt) to SCALAR_TO_VECTOR(Elt) for all SSE flavors
Current LLVM uses pxor+pinsrb on SSE4+ for INSERT_VECTOR_ELT(ZeroVec, 0, Elt) insead of much simpler movd.
INSERT_VECTOR_ELT(ZeroVec, 0, Elt) is idiomatic construct which is used e.g. for _mm_cvtsi32_si128(Elt) and for lowest element initialization in _mm_set_epi32.
So such inefficient lowering leads to significant performance digradations in ceratin cases switching from SSSE3 to SSE4.
https://bugs.llvm.org/show_bug.cgi?id=41512
Here INSERT_VECTOR_ELT(ZeroVec, 0, Elt) is simply converted to SCALAR_TO_VECTOR(Elt) when applicable since latter is closer match to desired behavior and always efficiently lowered to movd and alike.
Committed on behalf of @Serge_Preis (Serge Preis)
Differential Revision: https://reviews.llvm.org/D60852
llvm-svn: 359545
David Bolvansky [Tue, 30 Apr 2019 10:09:28 +0000 (10:09 +0000)]
Revert r359520
llvm-svn: 359544
Sjoerd Meijer [Tue, 30 Apr 2019 10:09:15 +0000 (10:09 +0000)]
[TargetLowering] findOptimalMemOpLowering. NFCI.
This was a local static funtion in SelectionDAG, which I've promoted to
TargetLowering so that I can reuse it to estimate the cost of a memory
operation in D59787.
Differential Revision: https://reviews.llvm.org/D59766
llvm-svn: 359543
Diana Picus [Tue, 30 Apr 2019 09:24:43 +0000 (09:24 +0000)]
[ARM GlobalISel] Widen small shift operands
The legalizer was already widening the shift amount. Add tests for that
behaviour, and also support widening the shifted value.
llvm-svn: 359542
Fangrui Song [Tue, 30 Apr 2019 09:14:02 +0000 (09:14 +0000)]
[AsmPrinter] Make AsmPrinter::HandlerInfo::Handler a unique_ptr
Handlers.clear() in AsmPrinter::doFinalization() will destroy these handlers.
A unique_ptr makes the ownership clearer.
llvm-svn: 359541
Diana Picus [Tue, 30 Apr 2019 09:05:25 +0000 (09:05 +0000)]
[ARM GlobalISel] Be more careful about bailing out
Bail out on function arguments/returns with types aggregating an
unsupported type. This fixes cases where we would happily and
incorrectly lower functions taking e.g. [1 x i64] parameters, when we
don't even support plain i64 yet.
llvm-svn: 359540
Kristof Umann [Tue, 30 Apr 2019 08:47:56 +0000 (08:47 +0000)]
[analyzer][UninitializedObjectChecker] PR41611: Regard vector types as primitive
https://bugs.llvm.org/show_bug.cgi?id=41611
Similarly to D61106, the checker ran over an llvm_unreachable for vector types:
struct VectorSizeLong {
VectorSizeLong() {}
__attribute__((__vector_size__(16))) long x;
};
void __vector_size__LongTest() {
VectorSizeLong v;
}
Since, according to my short research,
"The vector_size attribute is only applicable to integral and float scalars,
although arrays, pointers, and function return values are allowed in conjunction
with this construct."
[src: https://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Vector-Extensions.html#Vector-Extensions]
vector types are safe to regard as primitive.
Differential Revision: https://reviews.llvm.org/D61246
llvm-svn: 359539
Raphael Isemann [Tue, 30 Apr 2019 08:41:35 +0000 (08:41 +0000)]
Instantiate 'std' templates explicitly in the expression evaluator
Summary:
This patch is a follow-up for D58125. It implements the manual instantiation and merging of 'std' templates like
`std::vector` and `std::shared_ptr` with information from the debug info AST. This (finally) allows using these classes
in the expression evaluator like every other class (i.e. things like `vec.size()` and shared_ptr debugging now works, yay!).
The main logic is the `CxxModuleHandler` which intercept the ASTImporter import process and replaces any `std` decls
by decls from the C++ module. The decls from the C++ module are "imported" by just deserializing them directly in
the expression evaluation context. This is mostly because we don't want to rely on the ASTImporter to correctly import
these declarations, but in the future we should also move to the ASTImporter for that.
This patch doesn't contain the automatic desugaring for result variables. This means that if you call for example
`size` of `std::vector` you maybe get some very verbose typedef'd type as the variable type, e.g.
`std::vector<int, std::allocator<int>>::value_type`.
This is not only unreadable, it also means that our ASTImporter has to import all these types and associated
decls into the persisent variable context. This currently usually leads to some assertion getting triggered
in Clang when the ASTImporter either makes a mistake during importing or our debug info AST is inconsitent.
The current workaround I use in the tests is to just cast the result to it's actual type (e.g. `size_t` or `int`) to prevent
the ASTImporter from having to handle all these complicated decls.
The automatic desugaring will be a future patch because I'm not happy yet with the current code for that and because
I anticipate that this will be a controversial patch.
Reviewers: aprantl, shafik, jingham, martong, serge-sans-paille
Reviewed By: martong
Subscribers: balazske, rnkovacs, mgorny, mgrang, abidh, jdoerfert, lldb-commits
Tags: #c_modules_in_lldb, #lldb
Differential Revision: https://reviews.llvm.org/D59537
llvm-svn: 359538
Sjoerd Meijer [Tue, 30 Apr 2019 08:38:12 +0000 (08:38 +0000)]
[TargetLowering] Change getOptimalMemOpType to take a function attribute list
The MachineFunction wasn't used in getOptimalMemOpType, but more importantly,
this allows reuse of findOptimalMemOpLowering that is calling getOptimalMemOpType.
This is the groundwork for the changes in D59766 and D59787, that allows
implementation of TTI::getMemcpyCost.
Differential Revision: https://reviews.llvm.org/D59785
llvm-svn: 359537
Alexander Potapenko [Tue, 30 Apr 2019 08:35:14 +0000 (08:35 +0000)]
MSan: handle llvm.lifetime.start intrinsic
Summary:
When a variable goes into scope several times within a single function
or when two variables from different scopes share a stack slot it may
be incorrect to poison such scoped locals at the beginning of the
function.
In the former case it may lead to false negatives (see
https://github.com/google/sanitizers/issues/590), in the latter - to
incorrect reports (because only one origin remains on the stack).
If Clang emits lifetime intrinsics for such scoped variables we insert
code poisoning them after each call to llvm.lifetime.start().
If for a certain intrinsic we fail to find a corresponding alloca, we
fall back to poisoning allocas for the whole function, as it's now
impossible to tell which alloca was missed.
The new instrumentation may slow down hot loops containing local
variables with lifetime intrinsics, so we allow disabling it with
-mllvm -msan-handle-lifetime-intrinsics=false.
Reviewers: eugenis, pcc
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60617
llvm-svn: 359536
Markus Lavin [Tue, 30 Apr 2019 07:58:57 +0000 (07:58 +0000)]
[DebugInfo] DW_OP_deref_size in PrologEpilogInserter.
The PrologEpilogInserter need to insert a DW_OP_deref_size before
prepending a memory location expression to an already implicit
expression to avoid having the existing expression act on the memory
address instead of the value behind it.
The reason for using DW_OP_deref_size and not plain DW_OP_deref is that
big-endian targets need to read the right size as simply truncating a
larger read would yield the wrong result (LSB bytes are not at the lower
address).
This re-commit fixes issues reported in the first one. Namely deref was
inserted under wrong conditions and additionally the deref_size argument
was incorrectly encoded.
Differential Revision: https://reviews.llvm.org/D59687
llvm-svn: 359535
Eric Fiselier [Tue, 30 Apr 2019 06:38:24 +0000 (06:38 +0000)]
Update DemangleConfig.h to better mangle LLVM's version.
There's no need for the demangling bits to depend on libc++ internals,
in the same way they don't when compiled as part of LLVM.
llvm-svn: 359534
Kang Zhang [Tue, 30 Apr 2019 03:39:05 +0000 (03:39 +0000)]
[NFC][PowerPC] Use -check-prefixes to simplify the check in code-align.ll
Summary:
When checking the same output, we can use the `-check-prefixes` to simplify the check.
For example, if we want to check below output.
```
; GENERIC-LABEL: .globl foo
; BASIC-LABEL: .globl foo
; PWR-LABEL: .globl foo
; GENERIC: .p2align 2
; BASIC: .p2align 4
; PWR: .p2align 4
; GENERIC: @foo
; BASIC: @foo
; PWR: @foo
```
If we use `-check-prefixes`
```
... -check-prefixes=CHECK,GENERAL
... -check-prefixes=CHECK,BASIC
... -check-prefixes=CHECK,PWR
```
Above check can be simplify to:
```
; CHECK-LABEL: .globl foo
; GENERIC: .p2align 2
; BASIC: .p2align 4
; PWR: .p2align 4
; CHECK: @foo
```
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D61227
llvm-svn: 359533
Zi Xuan Wu [Tue, 30 Apr 2019 03:01:14 +0000 (03:01 +0000)]
[DAGCombiner] Do not generate ISD::ADDE node if adde is not legal for the target when combine ISD::TRUNC node
Do not combine (trunc adde(X, Y, Carry)) into (adde trunc(X), trunc(Y), Carry),
if adde is not legal for the target. Even it's at type-legalize phase.
Because adde is special and will not be legalized at operation-legalize phase later.
This fixes: PR40922
https://bugs.llvm.org/show_bug.cgi?id=40922
Differential Revision: https://reviews.llvm.org//D60854
llvm-svn: 359532
Artem Dergachev [Tue, 30 Apr 2019 03:01:02 +0000 (03:01 +0000)]
[analyzer] Treat functions without run-time branches as "small".
Currently we always inline functions that have no branches, i.e. have exactly
three CFG blocks: ENTRY, some code, EXIT. This makes sense because when there
are no branches, it means that there's no exponential complexity introduced
by inlining such function. Such functions also don't trigger various fundamental
problems with our inlining mechanism, such as the problem of inlined
defensive checks.
Sometimes the CFG may contain more blocks, but in practice it still has
linear structure because all directions (except, at most, one) of all branches
turned out to be unreachable. When this happens, still treat the function
as "small". This is useful, in particular, for dealing with C++17 if constexpr.
Differential Revision: https://reviews.llvm.org/D61051
llvm-svn: 359531
Artem Dergachev [Tue, 30 Apr 2019 03:00:57 +0000 (03:00 +0000)]
[analyzer] SmartPtrModeling: Fix a null dereference.
Don't crash when trying to model a call in which the callee is unknown
in compile time, eg. a pointer-to-member call.
Differential Revision: https://reviews.llvm.org/D61285
llvm-svn: 359530
Lang Hames [Tue, 30 Apr 2019 02:43:01 +0000 (02:43 +0000)]
[ORC] Fix an ambiguous call in a unit test.
llvm-svn: 359529
Aaron Smith [Tue, 30 Apr 2019 01:41:33 +0000 (01:41 +0000)]
[PECOFF] Implementation of ObjectFilePECOFF:: GetUUID()
Summary:
Provide an implementation of GetUUID() for remote debugging scenarios.
Return a PDB's GUID (or PDB70's Signature) as the UUID.
Reviewers: amccarth, labath
Reviewed By: labath
Subscribers: amccarth, clayborg, Hui, labath, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D56229
llvm-svn: 359528
Vitaly Buka [Tue, 30 Apr 2019 01:35:42 +0000 (01:35 +0000)]
[clangd] Fix GN build
llvm-svn: 359527
Marshall Clow [Tue, 30 Apr 2019 00:54:38 +0000 (00:54 +0000)]
Implement LWG 2960: nonesuch is insufficiently useless
llvm-svn: 359526
Marshall Clow [Tue, 30 Apr 2019 00:54:26 +0000 (00:54 +0000)]
Mark LWG#2977 as 'Nothing to do'. NFC
llvm-svn: 359525
JF Bastien [Tue, 30 Apr 2019 00:19:43 +0000 (00:19 +0000)]
[NFC] typo
llvm-svn: 359524
JF Bastien [Tue, 30 Apr 2019 00:11:53 +0000 (00:11 +0000)]
[NFC] typo
llvm-svn: 359523
Don Hinton [Tue, 30 Apr 2019 00:09:49 +0000 (00:09 +0000)]
[CommandLine} Wire-up cl::list::setDefault() so it will work correctly with cl::ResetAllOptionOccurrences() in unittests. Part 2 of 5
Summary:
With this change, cl::ResetAllOptionOccurrences() clears
cl::list just like cl::opt, allowing users to call
cl::ParseCommandLineOptions() multiple times without interference from
previous calls.
Reviewers: rnk
Reviewed By: rnk
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61234
llvm-svn: 359522
Lang Hames [Tue, 30 Apr 2019 00:03:26 +0000 (00:03 +0000)]
[ORC] Allow JITDylib definition generators to return Errors.
Background: A definition generator can be attached to a JITDylib to generate
new definitions in response to queries. For example: a generator that forwards
calls to dlsym can map symbols from a dynamic library into the JIT process on
demand.
If definition generation fails then the generator should be able to return an
error. This allows the JIT API to distinguish between the case where a
generator does not provide a definition, and the case where it was not able to
determine whether it provided a definition due to an error.
The immediate motivation for this is cross-process symbol lookups: If the
remote-lookup generator is attached to a JITDylib early in the search list, and
if a generator failure is misinterpreted as "no definition in this JITDylib" then
lookup may continue and bind to a different definition in a later JITDylib, which
is a bug.
llvm-svn: 359521
David Bolvansky [Mon, 29 Apr 2019 23:57:20 +0000 (23:57 +0000)]
[PDB] Fixed null pointer dereference
Reviewers: zturner, rnk
Reviewed By: rnk
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61279
llvm-svn: 359520
Alina Sbirlea [Mon, 29 Apr 2019 23:53:04 +0000 (23:53 +0000)]
[MemorySSA] Invalidate MemorySSA if AA or DT are invalidated.
Summary:
MemorySSA keeps internal pointers of AA and DT.
If these get invalidated, so should MemorySSA.
Reviewers: george.burgess.iv, chandlerc
Subscribers: jlebar, Prazek, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61043
llvm-svn: 359519
Nico Weber [Mon, 29 Apr 2019 23:26:21 +0000 (23:26 +0000)]
Add more lld release notes
llvm-svn: 359518
Ahsan Saghir [Mon, 29 Apr 2019 23:25:33 +0000 (23:25 +0000)]
Add __builtin_dcbf support for PPC
Summary:
This patch adds support for __builtin_dcbf for PPC.
__builtin_dcbf copies the contents of a modified block from the data cache
to main memory and flushes the copy from the data cache.
Differential revision: https://reviews.llvm.org/D59843
llvm-svn: 359517
David Bolvansky [Mon, 29 Apr 2019 23:24:00 +0000 (23:24 +0000)]
[Diagnostics] Support -Wtype-limits for GCC compatibility
Summary:
GCC's -Wtype-limits (part of -Wextra):
Warn if a comparison is always true or always false due to the limited range of the data type
Reviewers: rsmith, aaron.ballman, lebedev.ri, thakis
Reviewed By: rsmith
Subscribers: lebedev.ri, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58841
llvm-svn: 359516
Nico Weber [Mon, 29 Apr 2019 23:09:35 +0000 (23:09 +0000)]
[PDB] Fix hash function used to write /src/headerblock
lld-link used to write PDB files that DIA couldn't recover natvis
files from if:
- The global strings table was > 64kiB
- There were at least 3 natvis files
The cause was that the hash function for the /src/headerblock stream
was incorrect: It needs to be truncated to 16 bit.
If the global strings table was <= 64kiB, truncating to 16 bit is a
no-op, so this wasn't needed for small programs.
If there are only 1 or 2 natvis files, then the growth strategy in
HashTable::grow() would mean the hash table would have 2 buckets (for 1
natvis file) or 4 buckets (for 4 natvis files), and since the hash
function is used modulo number of buckets, and since 2 and 4 divide
0x10000, the missing `% 0x10000` is a no-op there too. For 3 natvis
files, the hash table grows to 6 buckets, which has a factor that's not
common with 0x10000 and the difference starts to matter.
Fixes PR41626.
Differential Revision: https://reviews.llvm.org/D61277
llvm-svn: 359515
Nico Weber [Mon, 29 Apr 2019 23:06:03 +0000 (23:06 +0000)]
gn build: Merge r359252
llvm-svn: 359514
Reid Kleckner [Mon, 29 Apr 2019 23:05:47 +0000 (23:05 +0000)]
Re-land r359250, [COFF] Statically link certain runtime library functions
Reverts the revert of r359251, this time with fixed tests.
Differential Revision: https://reviews.llvm.org/D55229
llvm-svn: 359513
Douglas Yung [Mon, 29 Apr 2019 22:57:15 +0000 (22:57 +0000)]
Make test more robust by writing stdout/stderr to different files.
Our internal build bots were failing this test randomly as the stderr
output was emitted to the file in the middle of the stdout output
line that the test was checking.
llvm-svn: 359512
Lang Hames [Mon, 29 Apr 2019 22:37:27 +0000 (22:37 +0000)]
[ORC] Replace the LLJIT/LLLazyJIT Create methods with Builder utilities.
LLJITBuilder and LLLazyJITBuilder construct LLJIT and LLLazyJIT instances
respectively. Over time these will allow more configurable options to be
added while remaining easy to use in the default case, which for default
in-process JITing is now:
auto J = ExitOnErr(LLJITBuilder.create());
llvm-svn: 359511
Lang Hames [Mon, 29 Apr 2019 22:37:16 +0000 (22:37 +0000)]
[JITLink] Move a typedef.
The FinalizeContinuation typedef belongs on the Allocation class, not the
allocator.
llvm-svn: 359510
Dan Gohman [Mon, 29 Apr 2019 22:37:08 +0000 (22:37 +0000)]
[WebAssembly] Make an assertion message prettier. NFC.
This is a follow-up to https://reviews.llvm.org/D59521.
llvm-svn: 359509
Steven Wu [Mon, 29 Apr 2019 21:39:54 +0000 (21:39 +0000)]
[ThinLTO] Adding architecture name into saved object filename
Summary:
For ThinLTOCodegenerator, it has an option to save the object file
outputs into a directory which is essential for debug info. Tools like lldb
and dsymutil will look for these object files for debug info.
On Darwin platform, you can link fat binaries with one single clang
driver invocation like:
$ clang -arch x86_64 -arch i386 -Wl,-object_path_lto,$TMPDIR ...
Unfornately, the output object files for one architecture is going to
overwrite the previous ones and one architecture slice will end up with
no debug info. One example for this is to turn on ThinLTO for sanitizer
dylibs in compiler-rt project.
To fix the issue, add the name for the architecture into the name of the
output object file.
rdar://problem/
35482935
Reviewers: tejohnson, bd1976llvm, dexonsmith, JDevlieghere
Reviewed By: dexonsmith
Subscribers: mehdi_amini, aprantl, inglorion, eraman, hiraditya, jkorous, dang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60924
llvm-svn: 359508
Reid Kleckner [Mon, 29 Apr 2019 21:32:05 +0000 (21:32 +0000)]
Simplify exclusion of nested classes from extern template instantiation, NFC
Summary:
This simplifies three checks for MS ABI, Win Itanium, or Win GNU to just
"is Windows".
The question remains, however, if this is really the correct thing to
do. We could, for example, only not consider inner classes to be
externally available if the outer class has a dllexport annotation.
However, I will leave that as future work.
Reviewers: hans, mstorsjo
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61278
llvm-svn: 359507
Mike Rice [Mon, 29 Apr 2019 21:21:17 +0000 (21:21 +0000)]
When skipping code at the start of a file during PCH use, Preprocessor::Lex
is not used since it consumes all preprocessor directives until it returns
a real token. Using the specific Lexer (i.e. CurLexer->Lex) makes it
possible to stop skipping after an #include or #pragma hdrstop. Previously
the skipping code was only handling CurLexer, now all will be handled
correctly.
Fixes: llvm.org/PR41585
Differential Revision: https://reviews.llvm.org/D61217
llvm-svn: 359506
Dan Gohman [Mon, 29 Apr 2019 21:09:44 +0000 (21:09 +0000)]
[WebAssembly] Define the signature for __stack_chk_fail
The WebAssembly backend needs to know the signatures of all runtime
libcall functions. This adds the signature for __stack_chk_fail which was
previously missing.
Also, make the error message for a missing libcall include the name of
the function.
Differential Revision: https://reviews.llvm.org/D59521
Reviewed By: sbc100
llvm-svn: 359505
Roland Froese [Mon, 29 Apr 2019 21:08:35 +0000 (21:08 +0000)]
[PowerPC] Try harder to avoid load/move-to VSR for partial vector loads
Change the PPCISelLowering.cpp function that decides to avoid update form in
favor of partial vector loads to know about newer load types and to not be
confused by the chain operand.
Differential Revision: https://reviews.llvm.org/D60102
llvm-svn: 359504
Jonas Devlieghere [Mon, 29 Apr 2019 21:03:39 +0000 (21:03 +0000)]
[lit] Check for the psutil module when setting a timeout
Apparently setting the per-test-timeout and not having the psutil
package constitutes to a fatal error. So only set the timeout when the
module is available.
llvm-svn: 359503
Raphael Isemann [Mon, 29 Apr 2019 21:02:35 +0000 (21:02 +0000)]
[ASTImporter] Add an ImportImpl method to allow customizing Import behavior.
Summary:
We are currently implementing support in LLDB that reconstructs the STL templates from
the target program in the expression evaluator. This reconstruction happens during the
import process from our debug info AST into the expression evaluation AST, which means
we need a way to intercept the ASTImporter import process.
This patch adds an protected ImportImpl method that we can overwrite in LLDB to implement
our special importing logic (which is essentially just looking into a C++ module that is attached to
the target context). Because ImportImpl has to call MapImported/AddToLookup for the decls it
creates, this patch also exposes those via a new unified method and checks that we call it when
importing decls.
Reviewers: martong, balazske, a.sidorin, shafik, a_sidorin
Reviewed By: martong, a_sidorin
Subscribers: rnkovacs, cfe-commits, lldb-commits, aprantl
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59485
llvm-svn: 359502
Jessica Paquette [Mon, 29 Apr 2019 20:58:17 +0000 (20:58 +0000)]
[GlobalISel][AArch64] Select llvm.aarch64.crypto.sha1h
This was falling back and gives us a reason to create a selectIntrinsic function
which we would need eventually anyway. Update arm64-crypto.ll to show that we
correctly select it.
Also factor out the code for finding an intrinsic ID.
llvm-svn: 359501
Reid Kleckner [Mon, 29 Apr 2019 20:44:26 +0000 (20:44 +0000)]
Fix FIXME added in r359339
We have windows.h in asan_win.cc, so we can just use the correct
prototypes for these EH-related interceptors without worrying.
Also fix an unused variable warning while I'm here.
llvm-svn: 359500
Reid Kleckner [Mon, 29 Apr 2019 20:40:08 +0000 (20:40 +0000)]
Pacify sanitizer lint script after r359498
llvm-svn: 359499
Matthew G McGovern [Mon, 29 Apr 2019 20:26:19 +0000 (20:26 +0000)]
[AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in asan_malloc_win.cc
HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user.
_recalloc previously did not zero new memory after reallocation.
https://reviews.llvm.org/D61268
llvm-svn: 359498
Martin Storsjo [Mon, 29 Apr 2019 20:25:56 +0000 (20:25 +0000)]
[UpdateTestChecks] Allow Lbegin_func without a leading period
On mingw/i686, local labels don't start with a leading period.
Also escape the leading period, as it previously could match
any char.
Differential Revision: https://reviews.llvm.org/D61254
llvm-svn: 359497
Martin Storsjo [Mon, 29 Apr 2019 20:25:51 +0000 (20:25 +0000)]
[X86] Run CFIInstrInserter on Windows if Dwarf is used
This is necessary since SVN r330706, as tail merging can include
CFI instructions since then.
This fixes PR40322 and PR40012.
Differential Revision: https://reviews.llvm.org/D61252
llvm-svn: 359496