Eric Fiselier [Fri, 8 Mar 2019 22:06:48 +0000 (22:06 +0000)]
[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.
Summary:
The following code is accepted by Clang 7 and prior but rejected by the upcoming 8 release and in trunk [1]
```
// error {{never produces a constant expression}}
void foo(const char* s) __attribute__((enable_if(__builtin_constant_p(*s) == false, "trap"))) {}
void test() { foo("abc"); }
```
Prior to Clang 8, the call to `__builtin_constant_p` was a constant expression returning false. Currently, it's not a valid constant expression.
The bug is caused because we failed to set `InConstantContext` when attempting to evaluate unevaluated constant expressions.
[1] https://godbolt.org/z/ksAjmq
Reviewers: rsmith, hans, sbenza
Reviewed By: rsmith
Subscribers: kristina, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59038
llvm-svn: 355743
Sunil Srivastava [Fri, 8 Mar 2019 22:00:50 +0000 (22:00 +0000)]
Improve "llvm-nm -f sysv" output for Elf files
Specifically, compute and Print Type and Section columns.
This is a re-commit of rL354833, after fixing the Asan problem found a a buildbot.
Differential Revision: https://reviews.llvm.org/D59060
llvm-svn: 355742
Sanjay Patel [Fri, 8 Mar 2019 21:54:41 +0000 (21:54 +0000)]
[x86] scalarize extract element 0 of FP cmp
An extension of D58282 noted in PR39665:
https://bugs.llvm.org/show_bug.cgi?id=39665
This doesn't answer the request to use movmsk, but that's an
independent problem. We need this and probably still need
scalarization of FP selects because we can't do that as a
target-independent transform (although it seems likely that
targets besides x86 should have this transform).
llvm-svn: 355741
Alexey Bataev [Fri, 8 Mar 2019 21:29:17 +0000 (21:29 +0000)]
[NVPTX][DEBUGINFO]Temp workaround for crash of ptxas: disable packed bytes in debug sections.
Summary:
This patch works around the bug in the ptxas tool with the processing of bytes
separated by the comma symbol. The emission of the packed string is
temporarily disabled.
Reviewers: tra
Subscribers: jholewinski, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59148
llvm-svn: 355740
Jonathan Peyton [Fri, 8 Mar 2019 21:23:34 +0000 (21:23 +0000)]
[OpenMP][stats] Update stats gathering macros
llvm-svn: 355739
Mitch Phillips [Fri, 8 Mar 2019 21:22:35 +0000 (21:22 +0000)]
[HWASan] Save + print registers when tag mismatch occurs in AArch64.
Summary:
This change change the instrumentation to allow users to view the registers at the point at which tag mismatch occured. Most of the heavy lifting is done in the runtime library, where we save the registers to the stack and emit unwind information. This allows us to reduce the overhead, as very little additional work needs to be done in each __hwasan_check instance.
In this implementation, the fast path of __hwasan_check is unmodified. There are an additional 4 instructions (16B) emitted in the slow path in every __hwasan_check instance. This may increase binary size somewhat, but as most of the work is done in the runtime library, it's manageable.
The failure trace now contains a list of registers at the point of which the failure occured, in a format similar to that of Android's tombstones. It currently has the following format:
Registers where the failure occurred (pc 0x0055555561b4):
x0
0000000000000014 x1
0000007ffffff6c0 x2
1100007ffffff6d0 x3
12000056ffffe025
x4
0000007fff800000 x5
0000000000000014 x6
0000007fff800000 x7
0000000000000001
x8
12000056ffffe020 x9
0200007700000000 x10
0200007700000000 x11
0000000000000000
x12
0000007fffffdde0 x13
0000000000000000 x14
02b65b01f7a97490 x15
0000000000000000
x16
0000007fb77376b8 x17
0000000000000012 x18
0000007fb7ed6000 x19
0000005555556078
x20
0000007ffffff768 x21
0000007ffffff778 x22
0000000000000001 x23
0000000000000000
x24
0000000000000000 x25
0000000000000000 x26
0000000000000000 x27
0000000000000000
x28
0000000000000000 x29
0000007ffffff6f0 x30
00000055555561b4
... and prints after the dump of memory tags around the buggy address.
Every register is saved exactly as it was at the point where the tag mismatch occurs, with the exception of x16/x17. These registers are used in the tag mismatch calculation as scratch registers during __hwasan_check, and cannot be saved without affecting the fast path. As these registers are designated as scratch registers for linking, there should be no important information in them that could aid in debugging.
Reviewers: pcc, eugenis
Reviewed By: pcc, eugenis
Subscribers: srhines, kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, hiraditya, jdoerfert, llvm-commits, #sanitizers
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D58857
llvm-svn: 355738
Sam Clegg [Fri, 8 Mar 2019 21:10:48 +0000 (21:10 +0000)]
[WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj`
This matches the ELF does. Update the comment in ELF/Symbols.h and
duplicate it in wasm/Symbols.h
This a followup on rL355580 and rL355577.
Differential Revision: https://reviews.llvm.org/D59075
llvm-svn: 355737
Michal Gorny [Fri, 8 Mar 2019 21:10:43 +0000 (21:10 +0000)]
[lldb] [Process] Add proper support for NetBSD core files with threads
Improve the support for processing NetBSD cores. Fix reading process
identifier, thread information and associating the terminating signal
with the correct thread.
Includes test cases for single-threaded program receiving SIGSEGV,
and two dual-threaded programs: one where thread receives the signal,
and the other one when the whole process is signalled.
Differential Revision: https://reviews.llvm.org/D32149
llvm-svn: 355736
Shoaib Meenai [Fri, 8 Mar 2019 21:10:22 +0000 (21:10 +0000)]
[cmake] Remove llvm from LLVM_ALL_PROJECTS
LLVM is always built; including it in LLVM_ENABLE_PROJECTS has no
effect, but since it's in LLVM_ALL_PROJECTS, we produce a confusing
message about it being disabled. Drop it from LLVM_ALL_PROJECTS to avoid
this. Pointed out by David Greene on the mailing list [1].
[1] http://lists.llvm.org/pipermail/llvm-dev/2019-March/130854.html
llvm-svn: 355735
Mitch Phillips [Fri, 8 Mar 2019 21:05:27 +0000 (21:05 +0000)]
[GN] Merge 355720.
llvm-svn: 355734
Michael Kruse [Fri, 8 Mar 2019 21:03:06 +0000 (21:03 +0000)]
[RegionPass] Fix forgotten "!".
Commit r355068 "Fix IR/Analysis layering issue with OptBisect" uses the
template
return Gate.isEnabled() && !Gate.shouldRunPass(this, getDescription(...));
for all pass kinds. For the RegionPass, it left out the not operator,
causing region passes to be skipped as soon as a pass gate is used.
llvm-svn: 355733
Louis Dionne [Fri, 8 Mar 2019 21:01:25 +0000 (21:01 +0000)]
[NFC] Add missing revision information to ABI Changelog
llvm-svn: 355732
Matt Arsenault [Fri, 8 Mar 2019 20:58:11 +0000 (20:58 +0000)]
AMDGPU: Move d16 load matching to preprocess step
When matching half of the build_vector to a load, there could still be
a hidden dependency on the other half of the build_vector the pattern
wouldn't detect. If there was an additional chain dependency on the
other value, a cycle could be introduced.
I don't think a tablegen pattern is capable of matching the necessary
conditions, so move this into PreprocessISelDAG. Check isPredecessorOf
for the other value to avoid a cycle. This has a warning that it's
expensive, so this should probably be moved into an MI pass eventually
that will have more freedom to reorder instructions to help match
this. That is currently complicated by the lack of a computeKnownBits
type mechanism for the selected function.
llvm-svn: 355731
Zachary Turner [Fri, 8 Mar 2019 20:56:10 +0000 (20:56 +0000)]
Remove dependency edges from Host to Target/Core.
After recent changes, Host is now dependency-free.
llvm-svn: 355730
Alexey Bataev [Fri, 8 Mar 2019 20:48:54 +0000 (20:48 +0000)]
[OPENMP]Remove debug service variable.
Removed not required service variable for the debug info.
llvm-svn: 355729
Matt Arsenault [Fri, 8 Mar 2019 20:46:15 +0000 (20:46 +0000)]
DAG: Don't try to cluster loads with tied inputs
This avoids breaking possible value dependencies when sorting loads by
offset.
AMDGPU has some load instructions that write into the high or low bits
of the destination register, and have a tied input for the other input
bits. These can easily have the same base pointer, but be a swizzle so
the high address load needs to come first. This was inserting glue
forcing the opposite ordering, producing a cycle the InstrEmitter
would assert on. It may be potentially expensive to look for the
dependency between the other loads, so just skip any where this could
happen.
Fixes bug 40936 by reverting r351379, which added a hacky attempt to
fix this by adding chains in this case, which I think was just working
around broken glue before the InstrEmitter. The core of the patch is
re-implementing the fix for that problem.
llvm-svn: 355728
Sanjay Patel [Fri, 8 Mar 2019 20:45:27 +0000 (20:45 +0000)]
[x86] add tests for extracted vector FP cmp; NFC
llvm-svn: 355727
Mandeep Singh Grang [Fri, 8 Mar 2019 20:35:25 +0000 (20:35 +0000)]
[docs] Fix checkers.rst doc for PointerSorting checker
llvm-svn: 355726
Matthew Voss [Fri, 8 Mar 2019 20:33:55 +0000 (20:33 +0000)]
Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
This broke the windows bots.
This reverts commit
28302c66d2586074f77497d5dc4eac7182b679e0.
llvm-svn: 355725
Matt Arsenault [Fri, 8 Mar 2019 20:30:51 +0000 (20:30 +0000)]
AMDGPU: Add more tests for d16 loads
Also fix a few cases that weren't testing what they were supposed to.
llvm-svn: 355724
Matt Arsenault [Fri, 8 Mar 2019 20:30:51 +0000 (20:30 +0000)]
AMDGPU: Don't bother checking the chain in areLoadsFromSameBasePtr
This is only called in contexts that are verifying the chain itself,
and the query itself is only asking about the address.
llvm-svn: 355723
Matt Arsenault [Fri, 8 Mar 2019 20:30:50 +0000 (20:30 +0000)]
AMDGPU: Correct DS implementation of areLoadsFromSameBasePtr
This was checking the wrong operands for the base register and the
offsets. The indexes are shifted by the number of output registers
from the machine instruction definition, and the chain is moved to the
end.
llvm-svn: 355722
Rafael Auler [Fri, 8 Mar 2019 20:23:57 +0000 (20:23 +0000)]
Revert "Recommit "Support attribute used in member funcs of class templates""
There is nontrivial bug caused in lld that I need to further
investigate. Meanwhile, I'll revert this.
This reverts commit
8297e93480c636dc90fd14653c5a66406193363f.
llvm-svn: 355721
Mandeep Singh Grang [Fri, 8 Mar 2019 20:13:53 +0000 (20:13 +0000)]
[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements
Summary:
Added a new category of checkers for non-determinism. Added a checker for non-determinism
caused due to sorting containers with pointer-like elements.
Reviewers: NoQ, george.karpenkov, whisperity, Szelethus
Reviewed By: NoQ, Szelethus
Subscribers: Charusso, baloghadamsoftware, jdoerfert, donat.nagy, dkrupp, martong, dblaikie, MTC, Szelethus, mgorny, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D50488
llvm-svn: 355720
Alexey Bataev [Fri, 8 Mar 2019 20:08:04 +0000 (20:08 +0000)]
[DEBUG_INFO][NVPTX]Emit empty .debug_loc section in presence of the debug option.
Summary:
If the LLVM module shows that it has debug info, but the file is
actually empty and the real debug info is not emitted, the ptxas tool
emits error 'Debug information not found in presence of .target debug'.
We need at leas one empty debug section to silence this message. Section
`.debug_loc` is not emitted for PTX and we can emit empty `.debug_loc`
section if `debug` option was emitted.
Reviewers: tra
Subscribers: jholewinski, aprantl, llvm-commits
Differential Revision: https://reviews.llvm.org/D57250
llvm-svn: 355719
Hubert Tong [Fri, 8 Mar 2019 19:57:27 +0000 (19:57 +0000)]
[msan] Properly guard tests added by r355348; NFC
r355348 uses builtins without proper guards, breaking the test on
various platforms.
llvm-svn: 355718
Julian Lettner [Fri, 8 Mar 2019 19:52:45 +0000 (19:52 +0000)]
[TSan] Initialize libdispatch interceptors if necessary
On Linux (and other non-Darwin platforms) we need to initialize
interceptors. Since tsan_libdispatch.cc is compiled optionally, add a
weak default implementation of `InitializeLibdispatchInterceptors`.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D59113
llvm-svn: 355717
Amaury Sechet [Fri, 8 Mar 2019 19:39:32 +0000 (19:39 +0000)]
[DAGCombiner] fold (add (add (xor a, -1), b), 1) -> (sub b, a)
Summary: This pattern is sometime created after legalization.
Reviewers: efriedma, spatel, RKSimon, zvi, bkramer
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58874
llvm-svn: 355716
George Burgess IV [Fri, 8 Mar 2019 19:28:55 +0000 (19:28 +0000)]
[CFLAnders] Fix typo in comment; NFC
Patch by Enna1!
Differential Revision: https://reviews.llvm.org/D58756
llvm-svn: 355715
Wei Mi [Fri, 8 Mar 2019 19:25:32 +0000 (19:25 +0000)]
[RegisterCoalescer] Limit the number of joins for large live interval with
many valnos.
Recently we found compile time out problem in several cases when
SpeculativeLoadHardening was enabled. The significant compile time was spent
in register coalescing pass, where register coalescer tried to join many other
live intervals with some very large live intervals with many valnos.
Specifically, every time JoinVals::mapValues is called, computeAssignment will
be called by getNumValNums() times of the target live interval. If the large
live interval has N valnos and has N copies associated with it, trying to
coalescing those copies will at least cost N^2 complexity.
The patch adds some limit to the effort trying to join those very large live
intervals with others. By default, for live interval with > 100 valnos, and
when it has been coalesced with other live interval by more than 100 times,
we will stop coalescing for the live interval anymore. That put a compile
time cap for the N^2 algorithm and effectively solves the compile time
problem we saw.
Differential revision: https://reviews.llvm.org/D59143
llvm-svn: 355714
Sanjay Patel [Fri, 8 Mar 2019 19:20:28 +0000 (19:20 +0000)]
[x86] prevent infinite looping from inverse shuffle transforms
llvm-svn: 355713
Simon Pilgrim [Fri, 8 Mar 2019 19:16:26 +0000 (19:16 +0000)]
[X86] Add test case for PR22473
llvm-svn: 355712
Jonas Devlieghere [Fri, 8 Mar 2019 19:09:27 +0000 (19:09 +0000)]
[Reproducers] Add missing LLDB_RECORD_DUMMY macros
Re-ran lldb-inst on the API folder to insert missing LLDB_RECORD_DUMMY
macros.
llvm-svn: 355711
Jonas Devlieghere [Fri, 8 Mar 2019 18:33:40 +0000 (18:33 +0000)]
[lldb-instr] Support LLDB_RECORD_DUMMY
Extend lldb-instr to insert LLDB_RECORD_DUMMY macros for currently
unsupported signatures (void and function pointers).
llvm-svn: 355710
Jonas Devlieghere [Fri, 8 Mar 2019 17:50:27 +0000 (17:50 +0000)]
[Reproducers] Add LLDB_RECORD_DUMMY
Add a macro that doesn't actually record anything but still toggles the
API boundary. Removing just the register macros for lldb::thread_t
wasn't sufficient on NetBSD because the serialization logic needed the
underlying type to be complete.
This macro should be used by functions that are currently unsupported,
as they might trip the API boundary logic. This should be easy using the
lldb-instr tool.
llvm-svn: 355709
Jonas Devlieghere [Fri, 8 Mar 2019 17:36:54 +0000 (17:36 +0000)]
[lldb-vscode] Fix warning
I changed the variable to an unsigned to get rid of a signed and
unsigned compare without realizing the value could be negative. This
fixes the assert instead.
llvm-svn: 355708
Diogo N. Sampaio [Fri, 8 Mar 2019 17:11:20 +0000 (17:11 +0000)]
[ARM][FIX] Fix vfmal.f16 and vfmsl.f16 operand
The indexed variant of vfmal.f16 and vfmsl.f16
instructions use the uppser bits of the indexed
operand to store the index (1 bit for the double
variant, 2 bits for the quad).
This limits the usable registers to d0 - d7 or
s0 - s15. This patch enforces this limitation.
Differential Revision: https://reviews.llvm.org/D59021
llvm-svn: 355707
Frederic Riss [Fri, 8 Mar 2019 17:09:13 +0000 (17:09 +0000)]
Add more logging to TestQueues.py
The last round of logging taught us that when the test fails, lldb
is indeed aware of the thread it's failing to associate to a given
queue. Add more logging to try to figure out why the thread and the
queue do not appear related to the Queue APIs.
llvm-svn: 355706
Kristof Umann [Fri, 8 Mar 2019 16:26:29 +0000 (16:26 +0000)]
[analyzer] Fix infinite recursion in printing macros
In the commited testfile, macro expansion (the one implemented for the plist
output) runs into an infinite recursion. The issue originates from the algorithm
being faulty, as in
#define value REC_MACRO_FUNC(value)
the "value" is being (or at least attempted) expanded from the same macro.
The solved this issue by gathering already visited macros in a set, which does
resolve the crash, but will result in an incorrect macro expansion, that would
preferably be fixed down the line.
Patch by Tibor Brunner!
Differential Revision: https://reviews.llvm.org/D57891
llvm-svn: 355705
Kristof Umann [Fri, 8 Mar 2019 16:00:42 +0000 (16:00 +0000)]
[analyzer] Emit an error rather than assert on invalid checker option input
Asserting on invalid input isn't very nice, hence the patch to emit an error
instead.
This is the first of many patches to overhaul the way we handle checker options.
Differential Revision: https://reviews.llvm.org/D57850
llvm-svn: 355704
Kristof Umann [Fri, 8 Mar 2019 15:47:56 +0000 (15:47 +0000)]
[analyzer] Use the new infrastructure of expressing taint propagation, NFC
In D55734, we implemented a far more general way of describing taint propagation
rules for functions, like being able to specify an unlimited amount of
source and destination parameters. Previously, we didn't have a particularly
elegant way of expressing the propagation rules for functions that always return
(either through an out-param or return value) a tainted value. In this patch,
we model these functions similarly to other ones, by assigning them a
TaintPropagationRule that describes that they "create a tainted value out of
nothing".
The socket C function is somewhat special, because for certain parameters (for
example, if we supply localhost as parameter), none of the out-params should
be tainted. For this, we added a general solution of being able to specify
custom taint propagation rules through function pointers.
Patch by Gábor Borsik!
Differential Revision: https://reviews.llvm.org/D59055
llvm-svn: 355703
Hyrum Wright [Fri, 8 Mar 2019 15:37:15 +0000 (15:37 +0000)]
[clang-tidy] NFC: Negate the name and semantics of the isNotInMacro function.
This function is always used in a context where its result was also
negated, which made for confusing naming and code.
llvm-svn: 355702
Manman Ren [Fri, 8 Mar 2019 15:30:56 +0000 (15:30 +0000)]
Reland compiler-rt support for order file instrumentation.
r355343 was landed and was reverted in r355363 due to build breakage.
This patch adds Linux/Windows support on top of r355343.
In this patch, Darwin should be working with testing case. Linux should be working,
I will enable the testing case in a follwup diff. Windows/Other should be building.
Correct implementation for Other platforms will be added.
Thanks David for reviewing the original diff, helping me with issues on Linux, and
giving suggestions for adding support for Other platforms.
llvm-svn: 355701
Akira Hatanaka [Fri, 8 Mar 2019 15:20:12 +0000 (15:20 +0000)]
Use {{.*}} in test case to match the type of wide string literals.
The type of wide string literals varies depending on the target.
llvm-svn: 355700
Simon Pilgrim [Fri, 8 Mar 2019 15:17:26 +0000 (15:17 +0000)]
Fix typo in constant vector
llvm-svn: 355699
Erich Keane [Fri, 8 Mar 2019 15:10:07 +0000 (15:10 +0000)]
Re-fix _lrotl/_lrotr to always take Long, no matter the platform.
r355322 fixed this, however is being reverted due to concerns with
enabling it in other modes.
Change-Id: I6a939b7469b8fa196d5871a627eb2330dbd30f29
llvm-svn: 355698
Erich Keane [Fri, 8 Mar 2019 15:10:05 +0000 (15:10 +0000)]
Revert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."
This reverts commit
24400dafe16716f28cd0e7e5fa6e004c0e50686a.
llvm-svn: 355697
James Henderson [Fri, 8 Mar 2019 13:22:05 +0000 (13:22 +0000)]
[llvm-readelf]Don't lose negative-ness of negative addends for no symbol relocations
llvm-readelf prints relocation addends as:
<symbol value>[+-]<absolute addend>
where [+-] is determined from whether addend is less than zero or not.
However, it does not print the +/- if there is no symbol, which meant
that negative addends became their positive value with no indication
that this had happened. This patch stops the absolute conversion when
addends are negative and there is no associated symbol.
Reviewed by: Higuoxing, mattd, MaskRay
Differential Revision: https://reviews.llvm.org/D59095
llvm-svn: 355696
Nico Weber [Fri, 8 Mar 2019 13:07:22 +0000 (13:07 +0000)]
gn build: Merge r355685
llvm-svn: 355695
Nico Weber [Fri, 8 Mar 2019 13:01:58 +0000 (13:01 +0000)]
gn build: Unbreak finding a working `gn` on $PATH on Unix after r355645
From the Python subprocess docs:
If shell is True, it is recommended to pass args as a string rather than as
a sequence.
[...]
If args is a sequence, the first item specifies the command string, and any
additional items will be treated as additional arguments to the shell itself.
Prior to this change, the `--version` would be passed to the shell, not to
a potential gn binary on $PATH, and running `gn` without any arguments makes
it exit with an exit code != 0, so the script would think that there wasn't
a working gn binary on $PATH.
Fix this by following the documentation's recommendation of using a string
now that we pass shell=True. I tested this on macOS and Windows, each with
the three cases of
- no gn on PATH (should run gn downloaded by get.py if present,
else suggest running get.py)
- broken gn wrapper on PATH (should behave like the previous item)
- working gn on PATH (should use gn on PATH)
llvm-svn: 355694
Nico Weber [Fri, 8 Mar 2019 12:45:50 +0000 (12:45 +0000)]
gn build: Unbreak get.py and gn.py on Windows
`os.uname()` doesn't exist on Windows, so use `platform.machine()` which
returns `os.uname()[4]` on non-Win and (on 64-bit systems) "AMD64" on Windows.
Also use `sys.platform` instead of `platform` to check for Windows-ness for the
file extension in gn.py (get.py got this right).
Differential Revision: https://reviews.llvm.org/D59115
llvm-svn: 355693
Clement Courbet [Fri, 8 Mar 2019 12:41:42 +0000 (12:41 +0000)]
[sanitizer] Update global_symbols.txt
Add `bcmp` after r355672.
llvm-svn: 355692
Simon Pilgrim [Fri, 8 Mar 2019 11:41:18 +0000 (11:41 +0000)]
[DAGCombine] Merge visitSMULO+visitUMULO into visitMULO. NFCI.
llvm-svn: 355690
Simon Pilgrim [Fri, 8 Mar 2019 11:30:33 +0000 (11:30 +0000)]
[DAGCombine] Merge visitSADDO+visitUADDO into visitADDO. NFCI.
llvm-svn: 355689
Simon Pilgrim [Fri, 8 Mar 2019 11:16:55 +0000 (11:16 +0000)]
[DAGCombine] Merge visitSSUBO+visitUSUBO into visitSUBO. NFCI.
llvm-svn: 355688
Petar Jovanovic [Fri, 8 Mar 2019 10:53:19 +0000 (10:53 +0000)]
[mips] Use libatomic instead of GCC intrinsics for 64bit
The following GCC intrinsics are not available on MIPS32:
__sync_fetch_and_add_8
__sync_fetch_and_and_8
__sync_fetch_and_or_8
__sync_val_compare_and_swap_8
Replace these with appropriate libatomic implementation.
Patch by Miodrag Dinic.
Differential Revision: https://reviews.llvm.org/D45691
llvm-svn: 355687
Michael Platings [Fri, 8 Mar 2019 10:44:06 +0000 (10:44 +0000)]
[IR][ARM] Add function pointer alignment to datalayout
Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.
Differential Revision: https://reviews.llvm.org/D57335
llvm-svn: 355685
Benjamin Kramer [Fri, 8 Mar 2019 10:43:56 +0000 (10:43 +0000)]
Make function definition in header inline
Otherwise including this header from more than one place will break
linking.
llvm-svn: 355684
Kadir Cetinkaya [Fri, 8 Mar 2019 10:18:40 +0000 (10:18 +0000)]
[clang][Index] Fix msan failure
llvm-svn: 355683
Hans Wennborg [Fri, 8 Mar 2019 10:00:42 +0000 (10:00 +0000)]
clang-cl : Parse all /d2 options
We will now warn about such options being unused,
which is better than the current
"no such file or directory: '/d2foo'" errors.
Note that we can still handle specific flags separately,
e.g. we were already ignoring /d2FastFail and /d2Zi+
llvm-svn: 355682
Kadir Cetinkaya [Fri, 8 Mar 2019 09:57:33 +0000 (09:57 +0000)]
[clangd] Remove ./ and ../ in the file paths
Reviewers: hokein
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59084
llvm-svn: 355681
Haojian Wu [Fri, 8 Mar 2019 09:56:42 +0000 (09:56 +0000)]
[clangd] Redirect clangd page.
Reviewers: gribozavr
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59128
llvm-svn: 355680
Kadir Cetinkaya [Fri, 8 Mar 2019 09:54:37 +0000 (09:54 +0000)]
[clangd] Make sure constructors do not reference class
Reviewers: gribozavr
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58815
llvm-svn: 355679
Kadir Cetinkaya [Fri, 8 Mar 2019 09:42:04 +0000 (09:42 +0000)]
[clang][Tooling] Delete dots and dotdots when generating absolute paths
Summary:
GetAllFiles interface returns absolute paths, but keeps dots and dot
dots. This patch makes those paths canonical by deleting them.
Reviewers: hokein
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59079
llvm-svn: 355678
Haojian Wu [Fri, 8 Mar 2019 09:26:30 +0000 (09:26 +0000)]
[clangd] Deduplicate Refs on the fly.
Summary:
Currently, we only do deduplication when we flush final results. We may
have huge duplications (refs from headers) during the indexing period (running
clangd-indexer on Chromium).
With this change, clangd-indexer can index the whole chromium projects
(48 threads, 40 GB peak memory usage).
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59092
llvm-svn: 355676
Clement Courbet [Fri, 8 Mar 2019 09:07:45 +0000 (09:07 +0000)]
[SelectionDAG] Allow the user to specify a memeq function.
Summary:
Right now, when we encounter a string equality check,
e.g. `if (memcmp(a, b, s) == 0)`, we try to expand to a comparison if `s` is a
small compile-time constant, and fall back on calling `memcmp()` else.
This is sub-optimal because memcmp has to compute much more than
equality.
This patch replaces `memcmp(a, b, s) == 0` by `bcmp(a, b, s) == 0` on platforms
that support `bcmp`.
`bcmp` can be made much more efficient than `memcmp` because equality
compare is trivially parallel while lexicographic ordering has a chain
dependency.
Subscribers: fedor.sergeev, jyknight, ckennelly, gchatelet, llvm-commits
Differential Revision: https://reviews.llvm.org/D56593
llvm-svn: 355672
Carl Ritson [Fri, 8 Mar 2019 09:03:11 +0000 (09:03 +0000)]
[AMDGPU] V_CVT_F32_UBYTE{0,1,2,3} are full rate instructions
Summary: Fix a bug in the scheduling model where V_CVT_F32_UBYTE{0,1,2,3} are incorrectly marked as quarter rate instructions.
Reviewers: arsenm, rampitec
Reviewed By: rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59091
llvm-svn: 355671
Hans Wennborg [Fri, 8 Mar 2019 09:01:10 +0000 (09:01 +0000)]
Add another test for r354937 that came up in PR40890
llvm-svn: 355670
Kadir Cetinkaya [Fri, 8 Mar 2019 08:38:25 +0000 (08:38 +0000)]
[clangd] Adjust compile commands to be applicable for tooling
Summary:
As can be seen in https://github.com/llvm-mirror/clang/blob/master/lib/Tooling/Tooling.cpp#L385
clang tool invocations adjust commands normally like this. In clangd we have
different code paths for invoking a frontend action(preamble builds, ast builds,
background index, clangd-indexer) they all work on the same GlobalCompilationDatabase
abstraction, but later on are subject to different modifications.
This patch makes sure all of the clangd actions make use of the same compile
commands before invocation.
Enables background-index to work on chromium codebase(since they had dependency
file output in their compile commands).
Reviewers: gribozavr, hokein
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59086
llvm-svn: 355669
Kadir Cetinkaya [Fri, 8 Mar 2019 08:30:20 +0000 (08:30 +0000)]
[clang][Index] Mark references from Constructors and Destructors to class as NameReference
Summary:
In current indexing logic we get references to class itself when we see
a constructor/destructor which is only syntactically true. Semantically
this information is not correct. This patch marks that reference as
NameReference to let clients deal with it.
Reviewers: akyrtzi, gribozavr, nathawes, benlangmuir
Reviewed By: gribozavr, nathawes
Subscribers: nathawes, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58814
llvm-svn: 355668
Craig Topper [Fri, 8 Mar 2019 07:33:43 +0000 (07:33 +0000)]
[X86] Improve the type checking in isLegalMaskedLoad and isLegalMaskedGather.
We were just checking pointer size and type primitive size. But this caused unintended things like vectors of half being accepted by masked load/store.
For FP we now explicitly check for only double and float.
For pointers we now let any pointer through. Trusting that only 32 and 64 would be used to generate assembly.
We only check bitwidth after checking that the type is an integer.
llvm-svn: 355667
Petr Hosek [Fri, 8 Mar 2019 06:16:32 +0000 (06:16 +0000)]
[Clang] Include the test directory ommited in r355665
This was omitted in r355655 causing the test to fail.
llvm-svn: 355666
Petr Hosek [Fri, 8 Mar 2019 05:35:22 +0000 (05:35 +0000)]
[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/
This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory. Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/<target> and include/ directories, leaving resource directory only
for compiler-rt runtimes and Clang builtin headers.
Differential Revision: https://reviews.llvm.org/D59013
llvm-svn: 355665
Akira Hatanaka [Fri, 8 Mar 2019 05:30:54 +0000 (05:30 +0000)]
Fix test case committed in r355662.
Build bots were failing because wide string literals don't have type
'int *' on some targets.
llvm-svn: 355664
Steven Wu [Fri, 8 Mar 2019 05:27:53 +0000 (05:27 +0000)]
[Bitcode] Fix bitcode compatibility issue with clang.arc.use intrinsic
Summary:
In r349534, objc arc implementation is switched to use intrinsics and at
the same time, clang.arc.use is renamed to llvm.objc.clang.arc.use to
make the naming more consistent. The side-effect of that is llvm no
longer recognize it as intrinsics and codegen external references to
it instead.
Rather than upgrade the old intrinsics name to the new one and wait for
the arc-contract pass to remove it, simply remove it in the bitcode
upgrader.
rdar://problem/
48607063
Reviewers: pete, ahatanak, erik.pilkington, dexonsmith
Reviewed By: pete, dexonsmith
Subscribers: jkorous, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59112
llvm-svn: 355663
Akira Hatanaka [Fri, 8 Mar 2019 04:45:37 +0000 (04:45 +0000)]
[ObjC] Emit a boxed expression as a compile-time constant if the
expression inside the parentheses is a valid UTF-8 string literal.
Previously clang emitted an expression like @("abc") as a message send
to stringWithUTF8String. This commit makes clang emit the boxed
expression as a compile-time constant instead.
This commit also has the effect of silencing the nullable-to-nonnull
conversion warning clang started emitting after r317727, which
originally motivated this commit (see https://oleb.net/2018/@keypath).
rdar://problem/
42684601
Differential Revision: https://reviews.llvm.org/D58729
llvm-svn: 355662
Jason Molenda [Fri, 8 Mar 2019 04:18:21 +0000 (04:18 +0000)]
Add ASAN llvm build directory variants to
get_llvm_bin_dirs().
llvm-svn: 355661
JF Bastien [Fri, 8 Mar 2019 01:26:49 +0000 (01:26 +0000)]
Variable auto-init: split out small arrays
Summary: Following up with r355181, initialize small arrays as well.
LLVM stage2 shows a tiny size gain.
<rdar://
48523005>
Reviewers: glider, pcc, kcc, rjmccall
Subscribers: jkorous, dexonsmith, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58885
llvm-svn: 355660
Craig Topper [Fri, 8 Mar 2019 01:15:18 +0000 (01:15 +0000)]
[X86] Make x86-intrinsics-headers-clean.cpp stricter.
Remove the -Wno-ignored-attributes.
Add -fno-lax-vector-conversions
Also use -ffreestanding instead of defining _MM_MALLOC_H.
llvm-svn: 355659
Jonas Devlieghere [Fri, 8 Mar 2019 00:53:57 +0000 (00:53 +0000)]
[Reproducers] TestImagineList.test -> TestImageList.test
And run the actual binary so we load the shared libraries.
llvm-svn: 355658
Jonas Devlieghere [Fri, 8 Mar 2019 00:24:06 +0000 (00:24 +0000)]
[Reproducers] Mark partial specialization as inline
The overload and/or template specialization are regular functions and
should be marked inline when implemented in the header. Writing the
previous commit message should've made that obvious but I was already
overthinking it. This will fix the windows bot.
llvm-svn: 355657
Zachary Turner [Fri, 8 Mar 2019 00:11:27 +0000 (00:11 +0000)]
[lldb-vscode] Report an error if an invalid program is specified.
Previously if an invalid program was specified, there was a bug
which, when we attempted to launch the program, would report that
the operation succeeded, causing LLDB to then hang while waiting
indefinitely to receive some events from the process.
After this patch, when an invalid program is specified, we immediately
return to vs code with an error message that indicates that the
program can not be found.
Differential Revision: https://reviews.llvm.org/D59114
llvm-svn: 355656
Sanjay Patel [Thu, 7 Mar 2019 23:55:54 +0000 (23:55 +0000)]
[x86] add extract FP tests for target-specific nodes; NFC
llvm-svn: 355655
Jonas Devlieghere [Thu, 7 Mar 2019 23:37:46 +0000 (23:37 +0000)]
[Reproducers] Use partial template specialization instead of overload
Not sure if this is what's causing MSVC to claim the function to be
already defined elsewhere, but worth a shot.
llvm-svn: 355654
Adrian Prantl [Thu, 7 Mar 2019 23:30:19 +0000 (23:30 +0000)]
Temporarily diasble debug output in GenericDomTreeConstruction.h
to get the modules bots running again.
The LLVM_DEBUG macro only plays well with a modular build of LLVM when
the header is marked as textual, but doing so causes redefinition
errors.
llvm-svn: 355653
Adrian Prantl [Thu, 7 Mar 2019 23:17:11 +0000 (23:17 +0000)]
Make GenericDomTreeConstruction textual instead.
I think the problem is that it uses the LLVM_DEBUG macro in funciton bodies.
llvm-svn: 355652
Jonas Devlieghere [Thu, 7 Mar 2019 22:59:55 +0000 (22:59 +0000)]
Make bytes_read an unsigned
llvm-svn: 355651
Jonas Devlieghere [Thu, 7 Mar 2019 22:58:39 +0000 (22:58 +0000)]
Remove unused function
llvm-svn: 355650
Jonas Devlieghere [Thu, 7 Mar 2019 22:47:13 +0000 (22:47 +0000)]
[SBAPI] Log from record macro
The current record macros already log the function being called. This
patch extends the macros to also log their input arguments and removes
explicit logging from the SB API.
This might degrade the amount of information in some cases (because of
smarter casts or efforts to log return values). However I think this is
outweighed by the increased coverage and consistency. Furthermore, using
the reproducer infrastructure, diagnosing bugs in the API layer should
become much easier compared to relying on log messages.
Differential revision: https://reviews.llvm.org/D59101
llvm-svn: 355649
Alex Langford [Thu, 7 Mar 2019 22:37:23 +0000 (22:37 +0000)]
Fix TestPaths.py on windows
I committed an implementation of GetClangResourceDir on windows but
forgot to update this test. I merged the tests like I intended to, but I
realized that the test was actually failing. After looking into it, it
appears that FileSystem::Resolve was taking the path and setting
the FileSpec's Directory to "/path/to/lldb/lib/clang/" and the File to
"9.0.0" which isn't what we want. So I removed the resolve line from
DefaultComputeClangResourceDir.
llvm-svn: 355648
Frederic Riss [Thu, 7 Mar 2019 22:28:01 +0000 (22:28 +0000)]
Add logging to TestQueues.py
In an attempt to understand why the test is still failing after r355555,
add some logging.
llvm-svn: 355647
Adrian Prantl [Thu, 7 Mar 2019 22:25:26 +0000 (22:25 +0000)]
Work around a module build error on the LLDB incremental green dragon bot.
llvm-svn: 355646
Mitch Phillips [Thu, 7 Mar 2019 22:20:36 +0000 (22:20 +0000)]
[GN] Locate prebuilt binaries correctly.
Use the system shell to see if we can find a 'gn' binary on $PATH. This solves the error wherein subprocess.call fails ungracefully if the binary doesn't exist.
llvm-svn: 355645
Frederic Riss [Thu, 7 Mar 2019 22:12:03 +0000 (22:12 +0000)]
Fix TestAppleSimulatorOSType.py with Xcode 10.2
It looks like the simctl tool shipped in Xcode10.2 changed the format of
its json output.
llvm-svn: 355644
Kostya Kortchinsky [Thu, 7 Mar 2019 21:44:35 +0000 (21:44 +0000)]
[scudo][standalone] Adding a stats class
Summary:
This adds simple local & global stats classes to be used by the Primary
and Secondary, and associated test. Note that we don't need the strict
atomicity of the addition & subtraction (as is in sanitizer_common) so
we just use load & store.
Reviewers: morehouse, vitalybuka, eugenis, flowerhack, dmmoore415
Reviewed By: morehouse, vitalybuka
Subscribers: mgorny, delcypher, jfb, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D59031
llvm-svn: 355643
Julian Lettner [Thu, 7 Mar 2019 21:42:48 +0000 (21:42 +0000)]
[TSan] Temporarily disable test which fails on build bot
llvm-svn: 355642
Davide Italiano [Thu, 7 Mar 2019 21:33:43 +0000 (21:33 +0000)]
[testsuite] Recommit the TestTerminal directory.
Turns out this is actually testing that editline doesn't
screw up the terminal.
llvm-svn: 355640
Hubert Tong [Thu, 7 Mar 2019 21:28:33 +0000 (21:28 +0000)]
Add secondary libstdc++ 4.8 and 5.1 detection mechanisms
Summary:
The date-based approach to detecting unsupported versions of libstdc++
does not handle bug fix releases of older versions. As an example, the
`__GLIBCXX__` value associated with version 5.1, `
20150422`, is less
than the values associated with versions 4.8.5 and 4.9.3.
This patch adds secondary checks based on certain properties in
sufficiently new versions of libstdc++.
Reviewers: jfb, tstellar, rnk, sfertile, nemanjai
Reviewed By: jfb
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58682
llvm-svn: 355638
Zachary Turner [Thu, 7 Mar 2019 21:23:21 +0000 (21:23 +0000)]
[lldb-vscode] Support running in server mode on Windows.
Windows can't use standard i/o system calls such as read and write
to work with sockets, it instead needs to use the specific send
and recv calls. This complicates matters for the debug adapter,
since it needs to be able to work in both server mode where it
communicates over a socket, as well as non-server mode where it
communicates via stdin and stdout. To abstract this out, I've
introduced a class IOStream which hides all these details and
exposes a read/write interface that does the right on each
platform.
Differential Revision: https://reviews.llvm.org/D59104
llvm-svn: 355637
Craig Topper [Thu, 7 Mar 2019 21:22:56 +0000 (21:22 +0000)]
[X86] Correct scheduler information for rotate by constant for Haswell, Broadwell, and Skylake.
Rotate with explicit immediate is a single uop from Haswell on. An immediate of 1 has a dependency on the previous writer of flags, but the other immediate values do not.
The implicit rotate by 1 instruction is 2 uops. But the flags are merged after the rotate uop so the data result does not see the flag dependency. But I don't think we have any way of modeling that.
RORX is 1 uop without the load. 2 uops with the load. We currently model these with WriteShift/WriteShiftLd.
Differential Revision: https://reviews.llvm.org/D59077
llvm-svn: 355636