Nico Weber [Thu, 25 Apr 2019 14:02:26 +0000 (14:02 +0000)]
lld-link: Implement /swaprun: flag
r191276 added this to old LLD, but it never made it to new LLD -- except
that the flag was in Options.td, so it was silently ignored. I figured
it should be easy to implement, so I did that instead of removing the
flags from Options.td.
I then discovered that link.exe also supports comma-separated lists of
'cd' and 'net', which made the parsing code a bit annoying.
The Alias technique in Options.td is to get nice help output.
Differential Revision: https://reviews.llvm.org/D61067
llvm-svn: 359192
Simon Pilgrim [Thu, 25 Apr 2019 13:51:57 +0000 (13:51 +0000)]
[InstCombine][X86] Tweak generic expansion of PACKSS/PACKUS to shuffle then truncate. NFCI.
This has no effect on constant folding but will be useful when we expand non-saturating PACKSS/PACKUS intrinsics.
llvm-svn: 359191
Sam McCall [Thu, 25 Apr 2019 13:33:18 +0000 (13:33 +0000)]
[Support] json::OStream::flush(), which passes through to the underlying stream
llvm-svn: 359190
Nico Weber [Thu, 25 Apr 2019 13:29:34 +0000 (13:29 +0000)]
gn build: Merge r359179
llvm-svn: 359189
Nico Weber [Thu, 25 Apr 2019 13:26:54 +0000 (13:26 +0000)]
gn build: Merge r359174
llvm-svn: 359188
Nico Weber [Thu, 25 Apr 2019 13:25:00 +0000 (13:25 +0000)]
gn build: Merge r359142
llvm-svn: 359187
Sam McCall [Thu, 25 Apr 2019 12:51:42 +0000 (12:51 +0000)]
[Support] Add JSON streaming output API, faster where the heavy value types aren't needed.
Summary:
There's still a little bit of constant factor that could be trimmed (e.g.
more overloads to avoid round-tripping primitives through json::Value).
But this solves the memory scaling problem, and greatly improves the performance
constant factor, and the API should leave room for optimization if needed.
Adapt TimeProfiler to use it, eliminating almost all the performance regression
from r358476.
Performance test on my machine:
perf stat -r 5 ~/llvmbuild-opt/bin/clang++ -w -S -ftime-trace -mllvm -time-trace-granularity=0 spirit.cpp
Handcrafted JSON (HEAD=r358532 with r358476 reverted): 2480ms
json::Value (HEAD): 2757ms (+11%)
After this patch: 2520 ms (+1.6%)
Reviewers: anton-afanasyev, lebedev.ri
Subscribers: kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60804
llvm-svn: 359186
Simon Pilgrim [Thu, 25 Apr 2019 12:45:11 +0000 (12:45 +0000)]
[InstCombine][X86] Add PACKSS/PACKUS tests for truncation where saturation won't occur
llvm-svn: 359185
Marshall Clow [Thu, 25 Apr 2019 12:11:43 +0000 (12:11 +0000)]
Implement midpoint for floating point types. Reviewed as https://reviews.llvm.org/D61014.
llvm-svn: 359184
Ilya Biryukov [Thu, 25 Apr 2019 11:57:40 +0000 (11:57 +0000)]
[Support] Try to unbreak windows buildbot
After r359179.
llvm-svn: 359183
Fangrui Song [Thu, 25 Apr 2019 11:33:30 +0000 (11:33 +0000)]
Parallel: only allow the first TaskGroup to run tasks parallelly
Summary:
Concurrent (e.g. nested) llvm::parallel::for_each() may lead to dead
locks. See PR35788 (fixed by rLLD322041) and PR41508 (fixed by D60757).
When parallel_for_each() is about to return, in ~Latch() called by
~TaskGroup(), a thread (in the default executor) may block in
Latch::sync() waiting for Count to become zero. If all threads in the
default executor are blocked, it is a dead lock.
To fix this, force serial execution if the current TaskGroup is not the
first one. For a nested llvm::parallel::for_each(), this parallelizes
the outermost loop and serializes inner loops.
Differential Revision: https://reviews.llvm.org/D61115
llvm-svn: 359182
Fangrui Song [Thu, 25 Apr 2019 10:25:52 +0000 (10:25 +0000)]
[llvm-objdump] Prep for adding newlines before and after "Disassembly of section ...:"
llvm-svn: 359181
Florian Hahn [Thu, 25 Apr 2019 10:12:43 +0000 (10:12 +0000)]
[ConstantRange] [a, b) udiv a full range is [0, umax(b)).
Reviewers: nikic, spatel, efriedma
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D60536
llvm-svn: 359180
Ilya Biryukov [Thu, 25 Apr 2019 10:08:31 +0000 (10:08 +0000)]
[Testing] Move clangd::Annotations to llvm testing support
Summary:
Annotations allow writing nice-looking unit test code when one needs
access to locations from the source code, e.g. running code completion
at particular offsets in a file. See comments in Annotations.cpp for
more details on the API.
Also got rid of a duplicate annotations parsing code in clang's code
complete tests.
Reviewers: gribozavr, sammccall
Reviewed By: gribozavr
Subscribers: mgorny, hiraditya, ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D59814
llvm-svn: 359179
George Rimar [Thu, 25 Apr 2019 09:59:55 +0000 (09:59 +0000)]
[yaml2obj] - Don't crash on invalid inputs.
yaml2obj might crash on invalid input when unable to parse the YAML.
Recently a crash with a very similar nature was fixed for an empty files.
This patch revisits the fix and does it in yaml::Input instead.
It seems to be more correct way to handle such situation.
With that crash for invalid inputs is also fixed now.
Differential revision: https://reviews.llvm.org/D61059
llvm-svn: 359178
Simon Pilgrim [Thu, 25 Apr 2019 09:49:37 +0000 (09:49 +0000)]
Fix include order. NFCI.
llvm-svn: 359177
Simon Pilgrim [Thu, 25 Apr 2019 09:34:36 +0000 (09:34 +0000)]
[X86][SSE] combineBitcastvxi1 - add support for bitcasting to non-scalar integers
Truncate the movmsk scalar integer result to the equivalent scalar integer width as before but then bitcast to the requested type.
We still have the issue identified in PR41594 but D61114 should handle this.
llvm-svn: 359176
Michael Platings [Thu, 25 Apr 2019 09:27:50 +0000 (09:27 +0000)]
Fix compilation error with -DLIBCXXABI_ENABLE_THREADS=OFF
The error is:
libcxxabi/src/cxa_guard_impl.h: In instantiation of ‘__cxxabiv1::{anonymous}::LibcppMutex __cxxabiv1::{anonymous}::GlobalStatic<__cxxabiv1::{anonymous}::LibcppMutex>::instance’:
libcxxabi/src/cxa_guard_impl.h:529:62: required from here
libcxxabi/src/cxa_guard_impl.h:510:23: error: ‘__cxxabiv1::{anonymous}::LibcppMutex __cxxabiv1::{anonymous}::GlobalStatic<__cxxabiv1::{anonymous}::LibcppMutex>::instance’ has incomplete type
_LIBCPP_SAFE_STATIC T GlobalStatic<T>::instance = {};
^
llvm-svn: 359175
Ilya Biryukov [Thu, 25 Apr 2019 09:03:32 +0000 (09:03 +0000)]
[Support] Add a GTest matcher for Optional<T>
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61071
llvm-svn: 359174
Roman Lebedev [Thu, 25 Apr 2019 08:33:47 +0000 (08:33 +0000)]
[NFC][LoopIdiomRecognize] Some basic baseline tests for bcmp loop idiom
Doubt this is the final test coverage, but this appears to have good
coverage already, so i figure i might as well precommit it.
llvm-svn: 359173
Nikolai Kosjar [Thu, 25 Apr 2019 08:14:39 +0000 (08:14 +0000)]
[NFC] test commit removing excess line
llvm-svn: 359172
Simon Atanasyan [Thu, 25 Apr 2019 07:47:28 +0000 (07:47 +0000)]
[MIPS] Use custom bitcast lowering to avoid excessive instructions
On Mips32r2 bitcast can be expanded to two sw instructions and an ldc1
when using bitcast i64 to double or an sdc1 and two lw instructions when
using bitcast double to i64. By introducing custom lowering that uses
mtc1/mthc1 we can avoid excessive instructions.
Patch by Mirko Brkusanin.
Differential Revision: https://reviews.llvm.org/D61069
llvm-svn: 359171
Craig Topper [Thu, 25 Apr 2019 06:08:02 +0000 (06:08 +0000)]
[X86] Remove part of an if condition that should always be true.
The IndexReg will always be non-null at this point. Earlier in the function, if
IndexReg was null we set it to CurDAG->getRegister(0, VT) which made it
non-null.
llvm-svn: 359170
Lang Hames [Thu, 25 Apr 2019 05:24:40 +0000 (05:24 +0000)]
[JITLink] Make the JITLink MachO/x86-64 eh-frame test work on Windows.
This should fix the MachO/x86-64 eh-frame regression test by ensuring that
the symbols __ZTIi and ___gxx_personality_v0 are defined on all platforms.
llvm-svn: 359169
Lang Hames [Thu, 25 Apr 2019 05:02:10 +0000 (05:02 +0000)]
[llvm-rtdyld] Add support for passing command line arguments to rtdyld-run code.
The --args option can now be used to pass arguments to code linked with
llvm-rtdyld. E.g.
$ llvm-rtdyld file1.o file2.o --args a b c
is equivalent to:
$ ld -o program file1.o file2.o
$ ./program a b c
This is the rtdyld counterpart to the jitlink change in r359115, and makes
benchmarking and comparison between the tools easier.
llvm-svn: 359168
Alina Sbirlea [Thu, 25 Apr 2019 04:49:48 +0000 (04:49 +0000)]
Enable LoopVectorization by default.
Summary:
When refactoring vectorization flags, vectorization was disabled by default in the new pass manager.
This patch re-enables is for both managers, and changes the assumptions opt makes, based on the new defaults.
Comments in opt.cpp should clarify the intended use of all flags to enable/disable vectorization.
Reviewers: chandlerc, jgorbe
Subscribers: jlebar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61091
llvm-svn: 359167
Fangrui Song [Thu, 25 Apr 2019 04:31:26 +0000 (04:31 +0000)]
[llvm-objdump] errorToErrorCode+message -> toString
For test/Object/elf-invalid-phdr.test, the intended error message got lost due to errorToErrorCode().
llvm-svn: 359166
Jinsong Ji [Thu, 25 Apr 2019 02:40:06 +0000 (02:40 +0000)]
[PowerPC][NFC]Update licence to Apache 2
llvm-svn: 359164
Philip Reames [Thu, 25 Apr 2019 02:30:17 +0000 (02:30 +0000)]
Consolidate existing utilities for interpreting vector predicate maskes [NFC]
llvm-svn: 359163
Marshall Clow [Thu, 25 Apr 2019 02:12:51 +0000 (02:12 +0000)]
Update test to better check for the non-constexpr-ness of a move constructor. Fixes PR#41577.
llvm-svn: 359162
Kit Barton [Thu, 25 Apr 2019 02:10:02 +0000 (02:10 +0000)]
Fix unused variable warning in LoopFusion pass.
Do not wrap the contents of printFusionCandidates in the LLVM_DEBUG macro. This
fixes an unused variable warning generated when compiling without asserts but
with -DENABLE_LLVM_DUMP.
Differential Revision: https://reviews.llvm.org/D61035
llvm-svn: 359161
Philip Reames [Thu, 25 Apr 2019 01:18:56 +0000 (01:18 +0000)]
[InstCombine] Be consistent w/handling of masked intrinsics style wise [NFC]
llvm-svn: 359160
Richard Smith [Thu, 25 Apr 2019 00:35:01 +0000 (00:35 +0000)]
Use modern type trait implementations when available.
Teach libcxx to stop using various deprecated __has_* type traits, in favor of
the ("modern", C++11 era) __is_* type traits.
This is mostly just a simplification, but fixes at least one bug: _Atomic T
should be considered trivially-destructible, but is not considered to be POD by
Clang, and __has_trivial_destructor is specified in the GCC documentation as
returning false for non-POD non-class types.
Differential Revision: https://reviews.llvm.org/D48292
llvm-svn: 359159
Richard Smith [Thu, 25 Apr 2019 00:22:11 +0000 (00:22 +0000)]
Fix typo in comment in r312851.
Thanks to Nico Weber for pointing this out!
llvm-svn: 359158
Davide Italiano [Thu, 25 Apr 2019 00:03:02 +0000 (00:03 +0000)]
[utils] Add a lldb data formatter for llvm::SmallString.
Result:
(lldb) p val
(llvm::SmallString<32>) $31 = "patatino"
llvm-svn: 359157
Adrian Prantl [Wed, 24 Apr 2019 23:52:27 +0000 (23:52 +0000)]
Hide stderr output from lldb-argdumper
Under very specific circumstances the default shell /bin/sh might
print stuff to stderr before launching lldb-argdumper, which then
confuses the JSON parser. This patch suppresses stderr output from
lldb-argdumper to avoid this situation.
rdar://problem/
50149390
Differential Revision: https://reviews.llvm.org/D61101
llvm-svn: 359156
Richard Smith [Wed, 24 Apr 2019 23:45:56 +0000 (23:45 +0000)]
PR41427: This has apparently been fixed already, just add a regression
test.
llvm-svn: 359155
Austin Kerbow [Wed, 24 Apr 2019 23:32:21 +0000 (23:32 +0000)]
Fix spelling error. NFC
Summary: Test commit.
Reviewers: msearles, jkorous
Reviewed By: jkorous
Subscribers: dexonsmith, arsenm, jvesely, nhaehnle, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61093
llvm-svn: 359154
Nico Weber [Wed, 24 Apr 2019 23:26:30 +0000 (23:26 +0000)]
llvm-cvtres: Make new dupe resource error a bit friendlier
For well-known type IDs, include the name of the type.
To not duplicate the ID->name map, make llvm-readobj call this new
function as well. It has slightly different output, so this also
requires updating a few tests.
Differential Revision: https://reviews.llvm.org/D61086
llvm-svn: 359153
JF Bastien [Wed, 24 Apr 2019 23:24:53 +0000 (23:24 +0000)]
posix_spawn should retry upon EINTR
Summary:
We've seen cases of bots failing with:
clang: error: unable to execute command: posix_spawn failed: Interrupted system call
Add a small retry loop to posix_spawn in case this happens. Don't retry too much in case there's some systemic problem going on, but retry a few times.
<rdar://problem/
50181448>
Reviewers: Bigcheese, arphaman
Subscribers: jkorous, dexonsmith, kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61096
llvm-svn: 359152
Reid Kleckner [Wed, 24 Apr 2019 23:11:17 +0000 (23:11 +0000)]
Mark new jitlink test XFAIL for windows
llvm-svn: 359151
Mitch Phillips [Wed, 24 Apr 2019 23:03:32 +0000 (23:03 +0000)]
[sanitizer_common] Remove some old commented-out printf statements, and fixed up the order of includes.
llvm-svn: 359150
Amy Huang [Wed, 24 Apr 2019 23:02:48 +0000 (23:02 +0000)]
Recommitting r358783 and r358786 "[MS] Emit S_HEAPALLOCSITE debug info" with fixes for buildbot error (undefined assembler label).
Summary:
This emits labels around heapallocsite calls and S_HEAPALLOCSITE debug
info in codeview. Currently only changes FastISel, so emitting labels still
needs to be implemented in SelectionDAG.
Reviewers: rnk
Subscribers: aprantl, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D61083
llvm-svn: 359149
Reid Kleckner [Wed, 24 Apr 2019 22:45:44 +0000 (22:45 +0000)]
[codeview] Fix symbol names for dynamic initializers and atexit stubs
Summary:
Add a new variant to GlobalDecl for these so that we can detect them
more easily during debug info emission and handle them appropriately.
Reviewers: rsmith, rjmccall, jyu2
Subscribers: aprantl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60930
llvm-svn: 359148
Sanjay Patel [Wed, 24 Apr 2019 22:28:58 +0000 (22:28 +0000)]
[DAGCombiner] scale repeated FP divisor by splat factor
If we have a vector FP division with a splatted divisor, use the existing transform
that converts 'x/y' into 'x * (1.0/y)' to allow more conversions. This can then
potentially be converted into a scalar FP division by existing combines (rL358984)
as seen in the tests here.
That can be a potentially big perf difference if scalar fdiv has better timing
(including avoiding possible frequency throttling for vector ops).
Differential Revision: https://reviews.llvm.org/D61028
llvm-svn: 359147
Joerg Sonnenberger [Wed, 24 Apr 2019 22:12:22 +0000 (22:12 +0000)]
[PowerPC] Allow using initial-exec TLS with PIC
Using initial-exec TLS variables is a reasonable performance
optimisation for system libraries. Use the correct PIC mechanism to get
hold of the GOT to avoid text relocations.
Differential Revision: https://reviews.llvm.org/D61026
llvm-svn: 359146
Frederic Riss [Wed, 24 Apr 2019 22:00:01 +0000 (22:00 +0000)]
Skip test introduced in r359140 on windows
Not sure what is or is not supposed to work on Windows and I have
no way to investigate this.
llvm-svn: 359145
Sean Fertile [Wed, 24 Apr 2019 21:51:30 +0000 (21:51 +0000)]
Add period at end of comment.
llvm-svn: 359144
Craig Topper [Wed, 24 Apr 2019 21:48:24 +0000 (21:48 +0000)]
[X86] Attempt to fix use-after-poison from r359121.
llvm-svn: 359143
Don Hinton [Wed, 24 Apr 2019 21:25:57 +0000 (21:25 +0000)]
[clang-tidy] Add new checker: llvm-prefer-isa-or-dyn-cast-in-conditionals
Summary:
Looks at conditionals and finds cases of ``cast<>``, which will
assert rather than return a null pointer, and ``dyn_cast<>`` where
the return value is not captured. Additionally, finds cases that
match the pattern ``var.foo() && isa<X>(var.foo())``, where the
method is called twice and could be expensive.
.. code-block:: c++
// Finds cases like these:
if (auto x = cast<X>(y)) <...>
if (cast<X>(y)) <...>
// But not cases like these:
if (auto f = cast<Z>(y)->foo()) <...>
if (cast<Z>(y)->foo()) <...>
Reviewers: alexfh, rjmccall, hokein, aaron.ballman, JonasToth
Reviewed By: aaron.ballman
Subscribers: xbolva00, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D59802
llvm-svn: 359142
Jonas Devlieghere [Wed, 24 Apr 2019 21:23:08 +0000 (21:23 +0000)]
[SystemInitializerFull] Fix header sorting (NFC)
Made some changes downstream that touched the header sorting.
llvm-svn: 359141
Frederic Riss [Wed, 24 Apr 2019 21:04:23 +0000 (21:04 +0000)]
Fix infinite recursion when calling C++ template functions
Summary:
When we encounter a templated function in the debug information, we
were creating an AST that looked like this:
FunctionTemplateDecl 0x12980ab90 <<invalid sloc>> <invalid sloc> foo<int>
|-TemplateTypeParmDecl 0x12980aad0 <<invalid sloc>> <invalid sloc> class depth 0 index 0 T
|-FunctionDecl 0x12980aa30 <<invalid sloc>> <invalid sloc> foo<int> 'int (int)' extern
| |-TemplateArgument type 'int'
| `-ParmVarDecl 0x12980a998 <<invalid sloc>> <invalid sloc> t1 'int'
`-FunctionDecl 0x12980aa30 <<invalid sloc>> <invalid sloc> foo<int> 'int (int)' extern
|-TemplateArgument type 'int'
`-ParmVarDecl 0x12980a998 <<invalid sloc>> <invalid sloc> t1 'int'
Note that the FunctionTemplateDecl has 2 children which are identical (as
in have the same address). This is not what Clang is doing:
FunctionTemplateDecl 0x7f89d206c6f8 </tmp/template.cpp:1:1, line:4:1> line:2:5 foo
|-TemplateTypeParmDecl 0x7f89d206c4a8 <line:1:10, col:19> col:19 referenced typename depth 0 index 0 T
|-FunctionDecl 0x7f89d206c660 <line:2:1, line:4:1> line:2:5 foo 'int (T)'
| `-ParmVarDecl 0x7f89d206c570 <col:9, col:11> col:11 t1 'T'
`-FunctionDecl 0x7f89d206cb60 <line:2:1, line:4:1> line:2:5 used foo 'int (int)'
|-TemplateArgument type 'int'
`-ParmVarDecl 0x7f89d206ca68 <col:9, col:11> col:11 t1 'int':'int'
The 2 chidlren are different and actually repesent different things: the first
one is the unspecialized version and the second one is specialized. (Just looking
at the names shows another major difference which is that we create the parent
with a name of "foo<int>" when it should be just "foo".)
The fact that we have those 2 identical children confuses the ClangImporter
and generates an infinite recursion (reported in https://llvm.org/pr41473).
We cannot create the unspecialized version as the debug information doesn't
contain a mapping from the template parameters to their use in the prototype.
This patch just creates 2 different FunctionDecls for those 2 children of the
FunctionTemplateDecl. This avoids the infinite recursion and allows us to
call functions. As the XFAILs in the added test show, we've still got issues
in our handling of templates. I believe they are mostly centered on the fact
that we create do not register "foo" as a template, but "foo<int>". This is
a bigger change that will need changes to the debug information generation.
I believe this change makes sense on its own.
Reviewers: shafik, clayborg, jingham
Subscribers: aprantl, javed.absar, kristof.beyls, lldb-commits
Differential Revision: https://reviews.llvm.org/D61044
llvm-svn: 359140
Stanislav Mekhanoshin [Wed, 24 Apr 2019 20:44:34 +0000 (20:44 +0000)]
[AMDGPU] gfx1010 SOP instructions
Differential Revision: https://reviews.llvm.org/D61080
llvm-svn: 359139
Jonas Devlieghere [Wed, 24 Apr 2019 20:40:24 +0000 (20:40 +0000)]
[ScriptInterpreterPython] find_first_of -> find (NFC)
Follow up to r357198.
llvm-svn: 359138
Reid Kleckner [Wed, 24 Apr 2019 20:38:37 +0000 (20:38 +0000)]
[COFF] Don't emit .gfids sections when CFG is off
Put them on the list of GuardFidChunks instead of the main Chunks list,
even with CFG is off. It will be ignored if CFG is disabled.
llvm-svn: 359137
Alexey Bataev [Wed, 24 Apr 2019 20:21:32 +0000 (20:21 +0000)]
[SLP] Fix crash after r358519, by V. Porpodas.
Summary: The code did not check if operand was undef before casting it to Instruction.
Reviewers: RKSimon, ABataev, dtemirbulatov
Reviewed By: ABataev
Subscribers: uabelho
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61024
llvm-svn: 359136
Reid Kleckner [Wed, 24 Apr 2019 20:13:23 +0000 (20:13 +0000)]
Try once more to ensure constant initializaton of ManagedStatics
First, use the old style of linker initialization for MSVC 2019 in
addition to 2017. MSVC 2019 emits a dynamic initializer for
ManagedStatic when compiled in debug mode, and according to zturner,
also sometimes in release mode. I wasn't able to reproduce that, but it
seems best to stick with the old code that works.
When clang is using the MSVC STL, we have to give ManagedStatic a
constexpr constructor that fully zero initializes all fields, otherwise
it emits a dynamic initializer. The MSVC STL implementation of
std::atomic has a non-trivial (but constexpr) default constructor that
zero initializes the atomic value. Because one of the fields has a
non-trivial constructor, ManagedStatic ends up with a non-trivial ctor.
The ctor is not constexpr, so clang ends up emitting a dynamic
initializer, even though it simply does zero initialization. To make it
constexpr, we must initialize all fields of the ManagedStatic.
However, while the constructor that takes a pointer is marked constexpr,
clang says it does not evaluate to a constant because it contains a cast
from a pointer to an integer. I filed this as:
https://developercommunity.visualstudio.com/content/problem/545566/stdatomic-value-constructor-is-not-actually-conste.html
Once we do that, we can add back the
LLVM_REQUIRE_CONSTANT_INITIALIZATION marker, and so far as I'm aware it
compiles successfully on all supported targets.
llvm-svn: 359135
Louis Dionne [Wed, 24 Apr 2019 20:12:36 +0000 (20:12 +0000)]
[pstl] Make the default backend be the serial backend and always provide parallel policies
Summary:
Before this change, the default backend was TBB but one could disable
anything related to TBB by removing the parallel policies. This change
uses the serial backend by default and removes the ability to disable
parallel policies, which is not useful anymore.
Reviewers: rodgert, MikeDvorskiy
Subscribers: mgorny, jkorous, dexonsmith, jdoerfert, libcxx-commits
Differential Revision: https://reviews.llvm.org/D59792
llvm-svn: 359134
Vitaly Buka [Wed, 24 Apr 2019 20:01:50 +0000 (20:01 +0000)]
[compiler-rt] NFC fixed [whitespace/braces] LINT warning
llvm-svn: 359133
Alexey Bataev [Wed, 24 Apr 2019 19:58:30 +0000 (19:58 +0000)]
[OPENMP]Initial support for non-rectangular loop nest.
Added basic semantic analysis for the non-rectangular loop nests for
OpenMP 5.0 support.
llvm-svn: 359132
Xinliang David Li [Wed, 24 Apr 2019 19:51:16 +0000 (19:51 +0000)]
Add optional arg to profile count getters to filter
synthetic profile count.
Differential Revision: http://reviews.llvm.org/D61025
llvm-svn: 359131
Jason Molenda [Wed, 24 Apr 2019 19:50:53 +0000 (19:50 +0000)]
add postfixexpression.cpp.
llvm-svn: 359130
Craig Topper [Wed, 24 Apr 2019 19:28:38 +0000 (19:28 +0000)]
[X86] Prevent folding a load into an AND if that AND is really a ZEXT_INREG that should use movzx.
This can save a 32-bit immediate move.
We would shrink the load and fold it if it was non-volatile, but that's trickier to check for.
llvm-svn: 359129
Nico Weber [Wed, 24 Apr 2019 19:13:38 +0000 (19:13 +0000)]
llvm-cvtres: Remove a default argument. No behavior change.
llvm-svn: 359128
Adrian Prantl [Wed, 24 Apr 2019 19:08:43 +0000 (19:08 +0000)]
Revert using fcopyfile(3) to implement sys::fs::copy_file(Twine, int) on macOS
It turns out that I mesread the man page and fcopyfile(3) does not
actually support COPYFILE_CLONE for files.
<rdar://problem/
50148757>
llvm-svn: 359127
Adhemerval Zanella [Wed, 24 Apr 2019 19:02:54 +0000 (19:02 +0000)]
[fuzzer] Fix reload.test on Linux/aarch64
The compiler generates a 'brk' instruction for __builtin_trap on aarch64
and Linux kernel issues a SIGTRAP. It is different from x86, where
compiler emits an 'ud2' and kernel issues a SIGILL.
A straightforward is to use abort instead.
llvm-svn: 359126
Vitaly Buka [Wed, 24 Apr 2019 19:01:04 +0000 (19:01 +0000)]
[compiler-rt] Fix warning about virtual destructor in sanitizer_flag_parser.h
llvm-svn: 359125
Davide Italiano [Wed, 24 Apr 2019 18:39:39 +0000 (18:39 +0000)]
[EditLineTests] Call setenv() before editline is initialized.
llvm-svn: 359124
Mitch Phillips [Wed, 24 Apr 2019 18:37:55 +0000 (18:37 +0000)]
[llvm-symbolizer] Quick fix for broken sanitizer bot
(sanitizer-x86_64-linux) until I can triage the issue properly. The
build has been broken due to the symbolizer build checks failing.
As the symbolizer build script relies on the old svn repo layout, it may
take a little while longer to find the responsible patch for the
breakage. This may be a completely valid fix, but I will need to confirm
it. For now, it unbreaks the build.
Tracking data:
Build where the break first occurred: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/21211
Changelist authors: @grimar, @maskray, @whitequark, @spatel, @dpreobra
For the authors, no action needed (yet). Will follow up when I can
identify the cause.
llvm-svn: 359123
David Blaikie [Wed, 24 Apr 2019 18:09:44 +0000 (18:09 +0000)]
DebugInfo: Emit only declarations (not whole definitions) of non-unit user defined types into type units
While this doesn't come up in reasonable cases currently (the only user
defined types not in type units are ones without linkage - which makes
for near-ODR violations, because it'd be a type with linkage referencing
a type without linkage - such a type can't be validly defined in more
than one TU, so arguably it shouldn't be in a type unit to begin with -
but it's a convenient way to demonstrate an issue that will become more
revalent with homed modular debug info type definitions - which also
don't need to be in type units but more legitimately so).
Precursor to the Clang change to de-type-unit (by omitting the
'identifier') types homed due to strong linkage vtables. (making that
change without this one would lead to major type duplication in type
units)
llvm-svn: 359122
Craig Topper [Wed, 24 Apr 2019 18:02:07 +0000 (18:02 +0000)]
[X86] Remove dead nodes left after ReplaceAllUsesWith calls during address matching
ReplaceAllUsesWith doesn't remove the node that was replaced. So its left around in the graph messing up use counts on other nodes.
One thing to note, is that this isn't valid if the node being deleted is the root node of an LEA match that gets rejected. In that case the node needs to stay alive because the isel table walking code would still have a reference to it that its going to try to match next. I don't think that's the case here though because the nodes being deleted here should be "and", "srl", and "zero_extend" none of which can be the root node of an LEA match.
Differential Revision: https://reviews.llvm.org/D61048
llvm-svn: 359121
Joseph Tremoulet [Wed, 24 Apr 2019 18:00:12 +0000 (18:00 +0000)]
[lldb] Use local definition of get_cpuid_count
Summary:
This is needed for gcc/cstdlib++ 5.4.0, where __get_cpuid_count is not
defined in cpuid.h.
Reviewers: labath
Reviewed By: labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D61036
llvm-svn: 359120
Eric Fiselier [Wed, 24 Apr 2019 17:54:25 +0000 (17:54 +0000)]
Add std::is_constant_evaluated.
Clang recently added __builtin_is_constant_evaluated() and GCC 9.0
has it as well.
This patch adds support for it in libc++.
llvm-svn: 359119
Shafik Yaghmour [Wed, 24 Apr 2019 17:38:40 +0000 (17:38 +0000)]
[DataFormatters] Adjusting libc++ std::list formatter to act better with pointers and references and adding a test to cover a previous related fix
Summary:
This previous fix https://github.com/llvm-mirror/lldb/commit/
5469bda296c183d1b6bf74597c88c9ed667b3145 did not have a test since we did not have a reproducer.
This is related to how formatters deal with pointers and references. The added tests both the new behavior and covers the previous bug fix as well.
Differential Revision: https://reviews.llvm.org/D60588
llvm-svn: 359118
Stanislav Mekhanoshin [Wed, 24 Apr 2019 17:28:30 +0000 (17:28 +0000)]
[AMDGPU] gfx1010 sgpr register changes
Differential Revision: https://reviews.llvm.org/D61045
llvm-svn: 359117
Simon Pilgrim [Wed, 24 Apr 2019 17:25:45 +0000 (17:25 +0000)]
[X86][SSE] Add tests for bitcasting vXi1 bool vectors to non-simple types.
llvm-svn: 359116
Lang Hames [Wed, 24 Apr 2019 17:23:05 +0000 (17:23 +0000)]
[JITLink] Add support for passing arguments to jit-linked code.
The --args option can now be used to pass arguments to code linked with
llvm-jitlink. E.g.
$ llvm-jitlink file1.o file2.o --args a b c
is equivalent to:
$ ld -o program file1.o file2.o
$ ./program a b c
llvm-svn: 359115
Robert Widmann [Wed, 24 Apr 2019 17:05:08 +0000 (17:05 +0000)]
[LLVM-C] Deprecate the LLVMValueRef-returning metadata creation functions
Summary: There is still some value in using these functions while the remaining LLVMValueRef-based accessors are still around, but LLVMMDNodeInContext in particular has some wonky semantics that make it worth replacing outright.
Reviewers: whitequark, deadalnix
Reviewed By: whitequark
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60524
llvm-svn: 359114
Stanislav Mekhanoshin [Wed, 24 Apr 2019 17:03:15 +0000 (17:03 +0000)]
[AMDGPU] Add gfx1010 target definitions
Differential Revision: https://reviews.llvm.org/D61041
llvm-svn: 359113
Sam McCall [Wed, 24 Apr 2019 17:00:38 +0000 (17:00 +0000)]
[clangd] Fix broken helper deep in unit test. NFC
llvm-svn: 359112
Simon Pilgrim [Wed, 24 Apr 2019 16:53:17 +0000 (16:53 +0000)]
[InstCombine][X86] Use generic expansion of PACKSS/PACKUS for constant folding. NFCI.
This patch rewrites the existing PACKSS/PACKUS constant folding code to expand as a generic expansion.
This is a first NFCI step toward expanding PACKSS/PACKUS intrinsics which are acting as non-saturating truncations (although technically the expansion could be used in all cases - but we'll probably want to be conservative).
llvm-svn: 359111
JF Bastien [Wed, 24 Apr 2019 16:49:30 +0000 (16:49 +0000)]
Revert "[llvm-objdump] errorToErrorCode+message -> toString"
Revert r359100
It breaks llvm/test/Object/elf-invalid-phdr.test
llvm-svn: 359110
Nico Weber [Wed, 24 Apr 2019 16:09:38 +0000 (16:09 +0000)]
llvm-undname: Fix assert-on->4GiB-string-literal, found by oss-fuzz
llvm-svn: 359109
Marshall Clow [Wed, 24 Apr 2019 15:33:55 +0000 (15:33 +0000)]
Make the test object callable. libstdc++'s bind checks that (libc++ currently does not). Thanks to Jonathan Wakely for the fix.
llvm-svn: 359108
Nico Weber [Wed, 24 Apr 2019 15:31:13 +0000 (15:31 +0000)]
clang-cl: List valid values for /std: in /? output
Differential Revision: https://reviews.llvm.org/D61029
llvm-svn: 359107
Marshall Clow [Wed, 24 Apr 2019 15:26:45 +0000 (15:26 +0000)]
Fix a one more compare test that assumed -1/0/1 instsad of <0/0/>0. NFC.
llvm-svn: 359106
Lang Hames [Wed, 24 Apr 2019 15:15:55 +0000 (15:15 +0000)]
[JITLink] Refer to FDE's CIE (not the most recent CIE) when parsing eh-frame.
Frame Descriptor Entries (FDEs) have a pointer back to a Common Information
Entry (CIE) that describes how the rest FDE should be parsed. JITLink had been
assuming that FDEs always referred to the most recent CIE encountered, but the
spec allows them to point back to any previously encountered CIE. This patch
fixes JITLink to look up the correct CIE for the FDE.
The testcase is a MachO binary with an FDE that refers to a CIE that is not the
one immediately proceeding it (the layout can be viewed wit
'dwarfdump --eh-frame <testcase>'. This test case had to be a binary as llvm-mc
now sorts FDEs (as of r356216) to ensure FDEs *do* point to the most recent CIE.
llvm-svn: 359105
Marshall Clow [Wed, 24 Apr 2019 15:14:14 +0000 (15:14 +0000)]
Fix a couple of tests that assumed that compare retunred -1/0/1 instead of <0/0/>0. Thanks to Jonathan Wakely for the report.
llvm-svn: 359104
Sam Clegg [Wed, 24 Apr 2019 15:13:35 +0000 (15:13 +0000)]
[docs] Copy-edit lld/docs/WebAssembly.rst
Fixes small typos in WebAssembly documentation. I first noticed the
sub-heading "Bahavior", and then decided to review the whole file.
Patch by Christoph Siedentop!
Differential Revision: https://reviews.llvm.org/D60987
llvm-svn: 359103
Fangrui Song [Wed, 24 Apr 2019 15:09:23 +0000 (15:09 +0000)]
[llvm-objdump] Delete redundant check
llvm-svn: 359102
George Rimar [Wed, 24 Apr 2019 15:03:53 +0000 (15:03 +0000)]
[obj2yamp] - Simplify and cleanup the code in ELFDumper<ELFT>::dumpGroup a bit. NFC.
This makes the variables naming to match LLVM style,
simplifies the code used to extract the group members,
simplifies the loop and reorders the code around a bit.
llvm-svn: 359101
Fangrui Song [Wed, 24 Apr 2019 15:03:46 +0000 (15:03 +0000)]
[llvm-objdump] errorToErrorCode+message -> toString
llvm-svn: 359100
Fangrui Song [Wed, 24 Apr 2019 14:44:07 +0000 (14:44 +0000)]
[ELF] Delete a redundant SHT_NOBITS -> SHT_PROGBITS after D60131
Differential Revision: https://reviews.llvm.org/D61006
llvm-svn: 359099
Fangrui Song [Wed, 24 Apr 2019 14:43:05 +0000 (14:43 +0000)]
Use llvm::stable_sort
llvm-svn: 359098
Kostya Kortchinsky [Wed, 24 Apr 2019 14:20:49 +0000 (14:20 +0000)]
[scudo][standalone] Introduce the Secondary allocator
Summary:
The Secondary allocator wraps the platform allocation primitives. It is
meant to be used for larger sizes that the Primary can't fullfill, as
it will be slower, and sizes are multiple of the system page size.
This also changes some of the existing code, notably the opaque
platform data being passed to the platform specific functions: we can
shave a couple of syscalls on Fuchsia by storing additional data (this
addresses a TODO).
Reviewers: eugenis, vitalybuka, hctim, morehouse
Reviewed By: morehouse
Subscribers: mgorny, delcypher, jfb, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D60787
llvm-svn: 359097
Dmitry Preobrazhensky [Wed, 24 Apr 2019 14:06:15 +0000 (14:06 +0000)]
[AMDGPU][MC] Parser cleanup and refactoring
Reviewers: artem.tamazov, arsenm
Differential Revision: https://reviews.llvm.org/D60767
llvm-svn: 359096
Sanjay Patel [Wed, 24 Apr 2019 14:05:08 +0000 (14:05 +0000)]
[x86] make sure horizontal op and broadcast types match to simplify (PR41414)
If the types don't match, we can't just remove the shuffle.
There may be some other opportunity for optimization here,
but this should prevent the crashing seen in:
https://bugs.llvm.org/show_bug.cgi?id=41414
llvm-svn: 359095
Fangrui Song [Wed, 24 Apr 2019 14:03:30 +0000 (14:03 +0000)]
[PPC64] Consider localentry offset when computing branch distance
Summary:
We don't take localentry offset into account, and thus may fail to
create a long branch when the gap is just a few bytes smaller than 2^25.
relocation R_PPC64_REL24 out of range:
33554432 is not in [-
33554432,
33554431]
relocation R_PPC64_REL24 out of range:
33554436 is not in [-
33554432,
33554431]
Fix that by adding the offset to the symbol VA.
Differential Revision: https://reviews.llvm.org/D61058
llvm-svn: 359094
whitequark [Wed, 24 Apr 2019 13:30:03 +0000 (13:30 +0000)]
[LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions
Summary:
The `unwrap<Type>` calls can assert with:
```
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast
```
so replace them with `dyn_cast`.
Reviewers: whitequark, abdulras, hiraditya, compnerd
Reviewed By: whitequark
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60473
llvm-svn: 359093
Pavel Labath [Wed, 24 Apr 2019 13:23:19 +0000 (13:23 +0000)]
Kill modify-python-lldb.py
Summary:
After the last round of cleanups, this script was almost a no-op. The
only piece of functionality that remained was the one which tried to
make the swig-generated function signatures more pythonic.
The "tried" part is important here, as it wasn't doing a really good job
and the end result was not valid python nor c (e.g.,
SetExecutable(SBAttachInfo self, str const * path)).
Doing these transformations another way is not possible, as these
signatures are generated by swig, and not present in source. However,
given that this is the only reason why we need a swig post-process step,
and that the current implementation is pretty sub-optimal, this patch
simply abandons the signature fixup idea, and chooses to simplify our
build process instead.
Reviewers: amccarth, jingham, clayborg
Subscribers: mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D61000
llvm-svn: 359092