platform/upstream/llvm.git
4 years ago[lldb][NFC] Make clang-format happy by removing trailing space in ArchSpec.cpp
Raphael Isemann [Tue, 17 Dec 2019 08:13:23 +0000 (09:13 +0100)]
[lldb][NFC] Make clang-format happy by removing trailing space in ArchSpec.cpp

4 years ago[lit] [windows] Make sure to convert all path separators to backslashes in NT style...
Martin Storsjö [Fri, 13 Dec 2019 21:28:19 +0000 (21:28 +0000)]
[lit] [windows] Make sure to convert all path separators to backslashes in NT style \\?\... paths

E.g. the mingw python distributed in msys2 (the mingw one, which is a
normal win32 application and doesn't use the msys2 runtime itself),
despite being a normal win32 python, still uses forward slashes. This
works fine for other cases (many, but not all), but when constructing a
raw NT path, all path separators must be backslashes.

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

4 years ago[MinGW] Implicitly add .exe suffix if not provided
Martin Storsjö [Thu, 12 Dec 2019 09:08:18 +0000 (11:08 +0200)]
[MinGW] Implicitly add .exe suffix if not provided

GCC implicitly adds an .exe suffix if it is given an output file name,
but the file name doesn't contain a suffix, and there are certain
users of GCC that rely on this behaviour (and run into issues when
trying to use Clang instead of GCC). And MSVC's cl.exe also does the
same (but not link.exe).

However, GCC only does this when actually running on windows, not when
operating as a cross compiler.

As GCC doesn't have this behaviour when cross compiling, we definitely
shouldn't introduce the behaviour in such cases (as it would break
at least as many cases as this fixes).

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

4 years ago[ELF] Add IpltSection
Fangrui Song [Sat, 14 Dec 2019 22:17:35 +0000 (14:17 -0800)]
[ELF] Add IpltSection

PltSection is used by both PLT and IPLT. The PLT section may have a
header while the IPLT section does not. Split off IpltSection from
PltSection to be clearer.

Unlike other targets, PPC64 cannot use the same code sequence for PLT
and IPLT. This helps make a future PPC64 patch (D71509) more isolated.

On EM_386 and EM_X86_64, when PLT is empty while IPLT is not, currently
we are inconsistent whether the PLT header is conceptually attached to
in.plt or in.iplt .  Consistently attach the header to in.plt can make
the -z retpolineplt logic simpler. It also makes `jmp` point to an
aesthetically better place for non-retpolineplt cases.

Reviewed By: grimar, ruiu

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

4 years ago[sanitizer] Construct InternalMmapVector without memory allocation.
Igor Kudrin [Wed, 11 Dec 2019 10:37:24 +0000 (17:37 +0700)]
[sanitizer] Construct InternalMmapVector without memory allocation.

Construction of InternalMmapVector is often followed by a call to
reserve(), which may result in immediate reallocation of the memory
for the internal storage. This patch delays that allocation until
it is really needed.

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

4 years ago[MachO] Fix detecting malformed DWARF.
Igor Kudrin [Mon, 16 Dec 2019 14:16:14 +0000 (21:16 +0700)]
[MachO] Fix detecting malformed DWARF.

This fixes an invalid constant used to detect the reserved range when
reading the compilation unit header. See also: D64622 and D65039.

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

4 years ago[lldb] Fix unused variable warning in ThreadPlanStepRange.cpp
Raphael Isemann [Tue, 17 Dec 2019 07:53:00 +0000 (08:53 +0100)]
[lldb] Fix unused variable warning in ThreadPlanStepRange.cpp

This was added in 434905b97d961531286d4b49c7ee1969f7cbea0e.
Remove it to fix the compiler warnings for this.

4 years ago[LegalizeTypes] Pre-size the SmallVectors in ScalarizeVecRes_StrictFPOp and SplitVecR...
Craig Topper [Tue, 17 Dec 2019 07:35:29 +0000 (23:35 -0800)]
[LegalizeTypes] Pre-size the SmallVectors in ScalarizeVecRes_StrictFPOp and SplitVecRes_StrictFPOp so we don't have to call push_back. NFCI

This avoids grow checking/handling in each iteration of the loop.

4 years ago[LegalizeTypes] Remove ScalarizeVecRes_STRICT_FP_ROUND in favor of just using Scalari...
Craig Topper [Tue, 17 Dec 2019 07:24:22 +0000 (23:24 -0800)]
[LegalizeTypes] Remove ScalarizeVecRes_STRICT_FP_ROUND in favor of just using ScalarizeVecRes_StrictFPOp. NFCI

It looks like ScalarizeVecRes_StrictFPOp can handle a variable
number of arguments with scalar and vector types so it should
be sufficient.

4 years ago[LegalizeTypes] Remove the call to SplitVecRes_UnaryOp from SplitVecRes_StrictFPOp...
Craig Topper [Tue, 17 Dec 2019 04:52:02 +0000 (20:52 -0800)]
[LegalizeTypes] Remove the call to SplitVecRes_UnaryOp from SplitVecRes_StrictFPOp. NFCI

It doesn't seem to do anything that SplitVecRes_StrictFPOp can't
do. SplitVecRes_StrictFPOp already handles nodes with a variable
number of arguments and a mix of scalar and vector arguments.

4 years ago[MC] Delete redundant alignment update from MCELFStreamer::EmitCommonSymbol. NFC
Fangrui Song [Tue, 17 Dec 2019 07:05:23 +0000 (23:05 -0800)]
[MC] Delete redundant alignment update from MCELFStreamer::EmitCommonSymbol. NFC

EmitValueToAlignment() updates the maximum alignment.

4 years ago[NFC][Test][PowerPC] Add the test to verify the mask with constant
QingShan Zhang [Tue, 17 Dec 2019 07:04:19 +0000 (07:04 +0000)]
[NFC][Test][PowerPC] Add the test to verify the mask with constant

4 years agogn build: Merge ec4749e3b8d
LLVM GN Syncbot [Tue, 17 Dec 2019 03:51:59 +0000 (03:51 +0000)]
gn build: Merge ec4749e3b8d

4 years agoRevert "[LoopUtils] Updated deleteDeadLoop() to handle loop nest."
Whitney Tsang [Tue, 17 Dec 2019 03:50:03 +0000 (03:50 +0000)]
Revert "[LoopUtils] Updated deleteDeadLoop() to handle loop nest."

This reverts commit cd09fee3d63296dd2df0bbb1fae363ca9f311d44.
This reverts commit c066ff11d84a7797503ad5a44c4129136926dc85.

4 years ago[Attributor][NFC] Clang format the Attributor
Johannes Doerfert [Tue, 17 Dec 2019 03:03:18 +0000 (21:03 -0600)]
[Attributor][NFC] Clang format the Attributor

The Attributor is always kept formatted so diffs are cleaner.

Sometime we get out of sync for various reasons so we need to format the
file once in a while.

4 years agoCheck whether the destination is a complete type in a static_cast (or
Richard Smith [Tue, 17 Dec 2019 02:26:19 +0000 (18:26 -0800)]
Check whether the destination is a complete type in a static_cast (or
C-style cast) to an enumeration type.

We previously forgot to check this, and happened to get away with it
(with bad diagnostics) only because we misclassified incomplete
enumeration types as not being unscoped enumeration types. This also
fixes the misclassification.

4 years ago[libomptarget][nfc] Move timer functions behind target_impl
Jon Chesterfield [Tue, 17 Dec 2019 02:22:28 +0000 (02:22 +0000)]
[libomptarget][nfc] Move timer functions behind target_impl

Summary: [libomptarget][nfc] Move timer functions behind target_impl

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: jvesely, openmp-commits

Tags: #openmp

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

4 years agoExplicitly specify -std=c++11 and include <mutex> and <condition_variable>.
Jim Ingham [Tue, 17 Dec 2019 02:08:21 +0000 (18:08 -0800)]
Explicitly specify -std=c++11 and include <mutex> and <condition_variable>.

These files built on macos but not on Debian Linux.  Let's see if this fixes it.

4 years ago[SelectionDAG] Add the fpexcept flag to the SelectionDAG dumping output so we can...
Craig Topper [Tue, 17 Dec 2019 02:04:25 +0000 (18:04 -0800)]
[SelectionDAG] Add the fpexcept flag to the SelectionDAG dumping output so we can better see when its not propagating.

We're currently losing this flag in type legalization and probably
other places when we expand strict fp nodes. This will make
reading logs easier.

4 years ago[c++20] P1959R0: Remove support for std::*_equality.
Richard Smith [Tue, 17 Dec 2019 01:40:03 +0000 (17:40 -0800)]
[c++20] P1959R0: Remove support for std::*_equality.

4 years agoIf constant evaluation fails due to an unspecified pointer comparison,
Richard Smith [Tue, 17 Dec 2019 01:08:46 +0000 (17:08 -0800)]
If constant evaluation fails due to an unspecified pointer comparison,
produce a note saying that rather than the default "evaluation failed"
note.

4 years ago[c++20] Add deprecation warnings for the expression forms deprecated by P1120R0.
Richard Smith [Mon, 16 Dec 2019 23:17:24 +0000 (15:17 -0800)]
[c++20] Add deprecation warnings for the expression forms deprecated by P1120R0.

This covers:
 * usual arithmetic conversions (comparisons, arithmetic, conditionals)
   between different enumeration types
 * usual arithmetic conversions between enums and floating-point types
 * comparisons between two operands of array type

The deprecation warnings are on-by-default (in C++20 compilations); it
seems likely that these forms will become ill-formed in C++23, so
warning on them now by default seems wise.

For the first two bullets, off-by-default warnings were also added for
all the cases where we didn't already have warnings (covering language
modes prior to C++20). These warnings are in subgroups of the existing
-Wenum-conversion (except that the first case is not warned on if either
enumeration type is anonymous, consistent with our existing
-Wenum-conversion warnings).

4 years agoRun all threads when extending a next range over a call.
Jim Ingham [Tue, 17 Dec 2019 01:38:13 +0000 (17:38 -0800)]
Run all threads when extending a next range over a call.

If you don't do this you end up running arbitrary code with
only one thread allowed to run, which can cause deadlocks.

<rdar://problem/56422478>

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

4 years ago[libomptarget][nfc] Wrap cuda min() in target_impl
Jon Chesterfield [Tue, 17 Dec 2019 01:30:04 +0000 (01:30 +0000)]
[libomptarget][nfc] Wrap cuda min() in target_impl

Summary:
[libomptarget][nfc] Wrap cuda min() in target_impl

nvptx forwards to cuda min, amdgcn implements directly.
Sufficient to build parallel.cu for amdgcn, added to CMakeLists.

All call sites are homogenous except one that passes a uint32_t and an
int32_t. This could be smoothed over by taking two type parameters
and some care over the return type, but overall I think the inline
<uint32_t> calling attention to what was an implicit sign conversion
is cleaner.

Reviewers: ABataev, jdoerfert

Reviewed By: jdoerfert

Subscribers: jvesely, mgorny, openmp-commits

Tags: #openmp

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

4 years agogn build: Merge c066ff11d84
LLVM GN Syncbot [Tue, 17 Dec 2019 01:17:52 +0000 (01:17 +0000)]
gn build: Merge c066ff11d84

4 years ago[LoopUtils] Updated deleteDeadLoop() to handle loop nest.
Whitney Tsang [Tue, 17 Dec 2019 01:14:14 +0000 (01:14 +0000)]
[LoopUtils] Updated deleteDeadLoop() to handle loop nest.

Reviewer: kariddi, sanjoy, reames, Meinersbur, bmahjour, etiotto,
kbarton
Reviewed By: Meinersbur
Subscribers: mgorny, hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D70939

4 years ago[LoopUtils] Updated deleteDeadLoop() to handle loop nest.
Whitney Tsang [Tue, 17 Dec 2019 00:03:04 +0000 (00:03 +0000)]
[LoopUtils] Updated deleteDeadLoop() to handle loop nest.

Reviewer: kariddi, sanjoy, reames, Meinersbur, bmahjour, etiotto,
kbarton
Reviewed By: Meinersbur
Subscribers: mgorny, hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D70939

4 years ago[llvm/runtimes] Add runtimes as a dependency of clang-bootstrap-deps
Xin-Xin Wang [Tue, 17 Dec 2019 00:08:07 +0000 (16:08 -0800)]
[llvm/runtimes] Add runtimes as a dependency of clang-bootstrap-deps

Summary: With the new LLVM_ENABLE_RUNTIMES option introduced in https://reviews.llvm.org/D40233, compiler-rt can now be included as a runtime. Since compiler-rt is needed for PGO, runtimes needs to be included as a dependency of clang-bootstrap-deps when building the stage1 compiler.

Reviewers: beanz, phosek, compnerd, smeenai, plotfi, xiaobai

Reviewed By: phosek

Subscribers: smeenai, beanz, phosek, mgorny, llvm-commits

Tags: #llvm

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

4 years agoChange `asan/TestCases/Darwin/malloc_zone-protected.cpp` to call abort so that it...
Dan Liew [Mon, 16 Dec 2019 22:20:16 +0000 (14:20 -0800)]
Change `asan/TestCases/Darwin/malloc_zone-protected.cpp` to call abort so that it **always crashes**.

Summary:
This is needed because on some platforms we can't install signal
handlers and so the application just traps (i.e. crashes) rather than being intercepted
by ASan's signal handler which in the default Darwin config doesn't
exit with a crashing exit code.

rdar://problem/57984547

Reviewers: yln, kubamracek, jfb

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[llvm] Add llvm-lipo dependency to runtimes
Xin-Xin Wang [Mon, 16 Dec 2019 23:46:02 +0000 (15:46 -0800)]
[llvm] Add llvm-lipo dependency to runtimes

Summary: Currently, llvm-lipo is not specified as a dependency, but it is needed when building Darwin-x86_64 runtimes, so I'm adding it to the dependencies lists.

Reviewers: alexshap, beanz, phosek, compnerd, smeenai, mtrent, plotfi, xiaobai

Reviewed By: phosek, smeenai

Subscribers: smeenai, mgorny, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Add __default_init_tag to basic_string constructors
Eric Fiselier [Tue, 17 Dec 2019 00:03:23 +0000 (19:03 -0500)]
[libc++] Add __default_init_tag to basic_string constructors

This removes unneeded zero initialization of string data.

For example, given the below code:

void Init(void *mem) {
    new (mem) std::string("Hello World");
}

Assembly before:

Init(void*):
        xorps   xmm0, xmm0
        movups  xmmword ptr [rdi], xmm0
        mov     qword ptr [rdi + 16], 0
        mov     byte ptr [rdi], 22
        movabs  rax, 8022916924116329800
        mov     qword ptr [rdi + 1], rax
        mov     dword ptr [rdi + 8], 1684828783
        mov     byte ptr [rdi + 12], 0
        ret

Assembly after:

Init():
        mov     byte ptr [rdi], 22
        movabs  rax, 8022916924116329800
        mov     qword ptr [rdi + 1], rax
        mov     dword ptr [rdi + 8], 1684828783
        mov     byte ptr [rdi + 12], 0
        ret

Patch by Martijn Vels (mvels@google.com)
Reviewed as https://reviews.llvm.org/D70621

4 years ago[NFC][llvm][MIRVRegNamerUtils] Moving some switch cases and altering comments.
Puyan Lotfi [Mon, 16 Dec 2019 23:49:03 +0000 (18:49 -0500)]
[NFC][llvm][MIRVRegNamerUtils] Moving some switch cases and altering comments.

4 years ago[libc++] Rework compressed pair constructors.
Eric Fiselier [Mon, 16 Dec 2019 23:23:39 +0000 (18:23 -0500)]
[libc++] Rework compressed pair constructors.

This patch de-duplicates most compressed pair constructors
to use the same code in C++11 and C++03.

Part of doing that is deleting the "__second_tag()" and replacing
it with a "__value_init_tag()" which has the same effect, but
allows for the removal of the special "one-arg" first element
constructor.

This patch is intended to have no semantic change.

4 years ago[llvm][MIRVRegNamerUtils] Adding hashing on CImm / FPImm MachineOperands.
Puyan Lotfi [Mon, 16 Dec 2019 18:23:03 +0000 (13:23 -0500)]
[llvm][MIRVRegNamerUtils] Adding hashing on CImm / FPImm MachineOperands.

This patch makes it so that cases where multiple instructions that
differ only in their ConstantInt or ConstantFP MachineOperand values no
longer collide. For instance:

%0:_(s1) = G_CONSTANT i1 true
%1:_(s1) = G_CONSTANT i1 false
%2:_(s32) = G_FCONSTANT float 1.0
%3:_(s32) = G_FCONSTANT float 0.0

Prior to this patch the first two instructions would collide together.
Also, the last two G_FCONSTANT instructions would also collide. Now they
will no longer collide.

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

4 years agoHonor -fuse-init-array when os is not specified on x86
Kamlesh Kumar [Mon, 16 Dec 2019 23:14:08 +0000 (15:14 -0800)]
Honor  -fuse-init-array when os is not specified on x86

Currently -fuse-init-array option is not effective when target triple
does not specify os, on x86,x86_64.
i.e.

// -fuse-init-array is not honored.
$ clang -target i386 -fuse-init-array test.c -S

// -fuse-init-array is honored.
$ clang -target i386-linux -fuse-init-array test.c -S

This patch fixes first case.
And does cleanup.

Reviewers: rnk, craig.topper, fhahn, echristo

Reviewed By: rnk

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

4 years ago[RISCV] Added isCompressibleInst() to estimate size in getInstSizeInBytes()
Ana Pazos [Mon, 16 Dec 2019 23:09:48 +0000 (15:09 -0800)]
[RISCV] Added isCompressibleInst() to estimate size in getInstSizeInBytes()

Summary:
Modified compression emitter tablegen backend to emit isCompressibleInst()
check which in turn is used by getInstSizeInBytes() to better estimate
instruction size. Note the generation of compressed instructions in RISC-V
happens late in the assembler therefore instruction size estimate might be off
if computed before.

Reviewers: lenary, asb, luismarques, lewis-revill

Reviewed By: asb

Subscribers: sameer.abuasal, lewis-revill, hiraditya, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

4 years ago[AArch64][SVE] Change pattern generation code to fix -Wimplicit-fallthrough after...
Fangrui Song [Mon, 16 Dec 2019 23:04:16 +0000 (15:04 -0800)]
[AArch64][SVE] Change pattern generation code to fix -Wimplicit-fallthrough after D71483

4 years ago[WebAssembly] Setting export_name implies llvm.used
Sam Clegg [Fri, 13 Dec 2019 22:44:06 +0000 (14:44 -0800)]
[WebAssembly] Setting export_name implies llvm.used

This change updates the clang front end to add symbols to llvm.used
when they have explicit export_name attribute.

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

4 years ago[coroutines][PR41909] Generalize fix from D62550
Brian Gesiak [Mon, 16 Dec 2019 22:19:16 +0000 (17:19 -0500)]
[coroutines][PR41909] Generalize fix from D62550

Summary:
In https://reviews.llvm.org/D62550 @rsmith pointed out that there are
many situations in which a coroutine body statement may be
transformed/rebuilt as part of a template instantiation, and my naive
check whether the coroutine was a generic lambda was insufficient.

This is indeed true, as I've learned by reading more of the
TreeTransform code. Most transformations are written in a way that
doesn't assume the resulting types are not dependent types. So the
assertion in 'TransformCoroutineBodyStmt', that the promise type must no
longer be dependent, is out of place.

This patch removes the assertion, spruces up some code comments, and
adds a test that would have failed with my naive check from
https://reviews.llvm.org/D62550.

Reviewers: GorNishanov, rsmith, lewissbaker

Reviewed By: rsmith

Subscribers: junparser, EricWF, rsmith, cfe-commits

Tags: #clang

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

4 years ago[lldb] Respect previously set values of LLDB_TABLEGEN_EXE
Alex Langford [Mon, 16 Dec 2019 22:29:46 +0000 (14:29 -0800)]
[lldb] Respect previously set values of LLDB_TABLEGEN_EXE

If you set LLDB_TABLEGEN_EXE in a CMake cache file or in the CMake
invocation line, your setting isn't respected. Setting up the tablegen
for the host will overwrite the value that we set LLDB_TABLEGEN_EXE to,
which defeats the whole point of setting it in the first place.

4 years ago[X86] Add x86 triple to command line in mxcsr-reg-usage.ll
Craig Topper [Mon, 16 Dec 2019 22:17:30 +0000 (14:17 -0800)]
[X86] Add x86 triple to command line in mxcsr-reg-usage.ll

I'm not sure how this hasn't been causing any issues.

4 years agoAdd default initialization to compressed_pair.
Eric Fiselier [Mon, 16 Dec 2019 22:00:10 +0000 (17:00 -0500)]
Add default initialization to compressed_pair.

This change introduces the __default_init_tag to memory, and a corresponding
element constructor to allow for default initialization of either of the pair
values. This is useful for classes such as std::string where most (all)
constructors explicitly initialize the values in the constructor.

Patch by Martijn Vels (mvels@google.com)
Reviewed as https://reviews.llvm.org/D70617

4 years agoRevert "[NFC-I] Remove hack for fp-classification builtins"
Erich Keane [Mon, 16 Dec 2019 22:01:51 +0000 (14:01 -0800)]
Revert "[NFC-I] Remove hack for fp-classification builtins"

This reverts commit b1e542f302c1ed796ad9f703d4d36e010afcb914.

The original 'hack' didn't chop out fp-16 to double conversions, so
systems that use FP16ConversionIntrinsics end up in IR-CodeGen with an
i16 type isntead of a float type (like PPC64-BE).  The bots noticed
this.

Reverting until I figure out how to fix this

4 years agogit-llvm: Add option to push to Github with SSH
Valentin Churavy [Mon, 16 Dec 2019 09:35:14 +0000 (04:35 -0500)]
git-llvm: Add option to push to Github with SSH

Summary:
For users with 2FA Github password challenge can be rather cumbersome
and I personally use key based authentication through SSH. This fixes
the SSH feature that was present and exposes it as a command line
option.

Reviewers: tstellar

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[AArch64][SVE] Add patterns for logical immediate operations.
Danilo Carvalho Grael [Fri, 13 Dec 2019 19:01:03 +0000 (14:01 -0500)]
[AArch64][SVE] Add patterns for logical immediate operations.

Summary:
Add pattern matching for the following SVE logical vector and immediate instructions:
- and/bic, orr/orn, eor/eon.

Reviewers: sdesmalen, huntergr, rengolin, efriedma, c-rhodes, mgudim, kmclaughlin

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits, amehsan

Tags: #llvm

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

4 years ago[TSan][Darwin] Avoid calling pthread_self() before libpthread is initialized
Julian Lettner [Thu, 12 Dec 2019 19:51:55 +0000 (11:51 -0800)]
[TSan][Darwin] Avoid calling pthread_self() before libpthread is initialized

This skips calling `pthread_self` when `main_thread_identity` hasn't
been initialized yet.  `main_thread_identity` is only ever assigned in
`__tsan::InitializePlatform`.  This change should be relatively safe; we
are not changing behavior other than skipping the call to `pthread_self`
when `main_thread_identity == 0`.

rdar://57822138

Reviewed By: kubamracek

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

4 years agoFix a bug in the property-based serialization of
John McCall [Mon, 16 Dec 2019 21:04:31 +0000 (16:04 -0500)]
Fix a bug in the property-based serialization of
dependent template names.

Apparently we didn't test this in the test suite because we have
a lot of redundant ways of representing this situation that kick
in in the more common situations.  For example, DependentTST stores
a qualifier + identifier pair rather than a TemplateName.

4 years ago[NFC-I] Remove hack for fp-classification builtins
Erich Keane [Mon, 16 Dec 2019 19:15:48 +0000 (11:15 -0800)]
[NFC-I] Remove hack for fp-classification builtins

The FP-classification builtins (__builtin_isfinite, etc) use variadic
packs in the definition file to mean an overload set.  Because of that,
floats were converted to doubles, which is incorrect. There WAS a patch
to remove the cast after the fact.

THis patch switches these builtins to just be custom type checking,
calls the implicit conversions for the integer members, and makes sure
the correct L->R casts are put into place, then does type checking like
normal.

A future direction (that wouldn't be NFC) would consider making
conversions for the floating point parameter legal.

4 years ago[LoopFusion] Restrict loop fusion to rotated loops.
Kit Barton [Mon, 16 Dec 2019 16:57:52 +0000 (11:57 -0500)]
[LoopFusion] Restrict loop fusion to rotated loops.

Summary:
This patch restricts loop fusion to only consider rotated loops as valid candidates.
This simplifies the analysis and transformation and aligns with other loop optimizations.

Reviewers: jdoerfert, Meinersbur, dmgreen, etiotto, Whitney, fhahn, hfinkel

Reviewed By: Meinersbur

Subscribers: ormris, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] Teach removeBitcastsFromLoadStoreOnMinMax not to change the size of...
Craig Topper [Mon, 16 Dec 2019 20:03:21 +0000 (12:03 -0800)]
[InstCombine] Teach removeBitcastsFromLoadStoreOnMinMax not to change the size of a store.

We can change the type as long as we don't change the size.

Fixes PR44306

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

4 years ago[WebAssembly] Replace SIMD int min/max builtins with patterns
Thomas Lively [Sat, 14 Dec 2019 01:08:04 +0000 (17:08 -0800)]
[WebAssembly] Replace SIMD int min/max builtins with patterns

Summary:
The instructions were originally implemented via builtins and
intrinsics so users would have to explicitly opt-in to using
them. This was useful while were validating whether these instructions
should have been merged into the spec proposal. Now that they have
been, we can use normal codegen patterns, so the intrinsics and
builtins are no longer useful.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years agoOnly run mangled_names.test if python3 is available.
Nico Weber [Mon, 16 Dec 2019 19:26:31 +0000 (14:26 -0500)]
Only run mangled_names.test if python3 is available.

The %update_cc_test_checks substitution only gets added if python3
is on path, so the test fails if it isn't. Don't run the test
when it would fail.

Also include the '%' in the arg to add_update_script_substition(),
to help greppability.

4 years ago[ELF] Delete unused declaration addIRelativeRelocs after D65995. NFC
Fangrui Song [Mon, 16 Dec 2019 19:19:22 +0000 (11:19 -0800)]
[ELF] Delete unused declaration addIRelativeRelocs after D65995. NFC

4 years ago[ELF] Delete relOff from TargetInfo::writePLT
Fangrui Song [Sat, 14 Dec 2019 23:09:43 +0000 (15:09 -0800)]
[ELF] Delete relOff from TargetInfo::writePLT

This change only affects EM_386. relOff can be computed from `index`
easily, so it is unnecessarily passed as a parameter.

Both in.plt and in.iplt entries are written by writePLT. For in.iplt,
the instruction `push reloc_offset` will change because `index` is now
different. Fortunately, this does not matter because `push; jmp` is only
used by PLT. IPLT does not need the code sequence.

Reviewed By: grimar, ruiu

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

4 years ago[ELF] De-template PltSection::addEntry. NFC
Fangrui Song [Mon, 16 Dec 2019 18:58:48 +0000 (10:58 -0800)]
[ELF] De-template PltSection::addEntry. NFC

4 years agogn build: (manually) merge c82e4ef69
Nico Weber [Mon, 16 Dec 2019 18:59:41 +0000 (13:59 -0500)]
gn build: (manually) merge c82e4ef69

4 years ago[OPENMP][DOCS]Claim simd nontemporal clause, NFC.
Alexey Bataev [Mon, 16 Dec 2019 18:38:12 +0000 (13:38 -0500)]
[OPENMP][DOCS]Claim simd nontemporal clause, NFC.

4 years agoForward {read,write}SomeEnumType to {read,write}Enum instead of
John McCall [Mon, 16 Dec 2019 18:31:44 +0000 (13:31 -0500)]
Forward {read,write}SomeEnumType to {read,write}Enum instead of
directly to {read,write}UInt32.

This will be useful for textual formats.  NFC.

4 years agoUse property-based serialization for TemplateArgument.
John McCall [Mon, 16 Dec 2019 16:57:23 +0000 (11:57 -0500)]
Use property-based serialization for TemplateArgument.

4 years agoAdd Optional::map.
John McCall [Mon, 16 Dec 2019 16:57:03 +0000 (11:57 -0500)]
Add Optional::map.

4 years agoUse property-based serialization for TemplateName.
John McCall [Mon, 16 Dec 2019 08:59:21 +0000 (03:59 -0500)]
Use property-based serialization for TemplateName.

4 years agoAdd the ability for properties to be conditional on other properties.
John McCall [Mon, 16 Dec 2019 08:51:16 +0000 (03:51 -0500)]
Add the ability for properties to be conditional on other properties.

This will be required by TemplateName.

4 years agoAdd the ability to declare helper variables when reading
John McCall [Mon, 16 Dec 2019 07:56:32 +0000 (02:56 -0500)]
Add the ability to declare helper variables when reading
properties from a value.

This is useful when the properties of a case are actually
read out of a specific structure, as with TemplateName.

4 years agoUse property-based serialization for DeclarationName.
John McCall [Mon, 16 Dec 2019 07:11:49 +0000 (02:11 -0500)]
Use property-based serialization for DeclarationName.

4 years agoAdd the ability to use property-based serialization for "cased" types.
John McCall [Mon, 16 Dec 2019 07:10:15 +0000 (02:10 -0500)]
Add the ability to use property-based serialization for "cased" types.

This patch doesn't actually use this serialization for anything,
but follow-ups will move the current handling of various standard
types over to this.

4 years agoReplace tabs with spaces.
John McCall [Mon, 16 Dec 2019 04:51:44 +0000 (23:51 -0500)]
Replace tabs with spaces.

4 years agoMove Basic{Reader,Writer} emission into ASTPropsEmitter; NFC.
John McCall [Sun, 15 Dec 2019 07:39:13 +0000 (02:39 -0500)]
Move Basic{Reader,Writer} emission into ASTPropsEmitter; NFC.

I'm going to introduce some uses of the property read/write methods.

4 years agoAlways -I clang/include when tblgen'ing in Clang.
John McCall [Sun, 15 Dec 2019 07:27:27 +0000 (02:27 -0500)]
Always -I clang/include when tblgen'ing in Clang.

4 years ago[OPENMP][DOCS]Mark if clause on simd done, NFC.
Alexey Bataev [Mon, 16 Dec 2019 18:25:58 +0000 (13:25 -0500)]
[OPENMP][DOCS]Mark if clause on simd done, NFC.

4 years ago[OPENMP50]Add if clause in target teams idistribute simd directive.
Alexey Bataev [Mon, 16 Dec 2019 16:16:46 +0000 (11:16 -0500)]
[OPENMP50]Add if clause in target teams idistribute simd directive.

According to OpenMP 5.0, if clause can be used in for simd directive. If
condition in the if clause if false, the non-vectorized version of the
loop must be executed.

4 years ago[lit] max_failures does not need to be stored in LitConfig
Julian Lettner [Tue, 26 Feb 2019 07:00:17 +0000 (23:00 -0800)]
[lit] max_failures does not need to be stored in LitConfig

4 years agoRevert "[clangd] Reapply b60896fad926 Fall back to selecting token-before-cursor...
Sam McCall [Mon, 16 Dec 2019 18:07:49 +0000 (19:07 +0100)]
Revert "[clangd] Reapply b60896fad926 Fall back to selecting token-before-cursor if token-after-cursor fails."

This reverts commit a0ff8cd631add513423fc2d8afa49e9650d01fe3.
Buildbot failures I can't chase further tonight.

4 years ago[SystemZ] Improve verification of MachineOperands.
Jonas Paulsson [Fri, 13 Dec 2019 16:06:28 +0000 (08:06 -0800)]
[SystemZ]  Improve verification of MachineOperands.

Now that the machine verifier will check for cases of register/immediate
MachineOperands and their correspondence to the MC instruction descriptor,
this patch adds the operand types to the descriptors where they were
previously missing. All MCOI::OPERAND_UNKNOWN operand types have been handled
to get a known type, except for G_... (global isel) instructions.

Review: Ulrich Weigand
https://reviews.llvm.org/D71494

4 years ago[llvm-cxxfilt] Correctly demangle COFF import thunk
Steven Wu [Mon, 16 Dec 2019 17:48:00 +0000 (09:48 -0800)]
[llvm-cxxfilt] Correctly demangle COFF import thunk

Summary:
llvm-cxxfilt wasn't correctly demangle COFF import thunk in those two
cases before:
* demangle in split mode (multiple words from commandline)
* the import thunk prefix was added no matter the later part of the
string can be demangled or not
Now llvm-cxxfilt should handle both case correctly.

Reviewers: compnerd, erik.pilkington, jhenderson

Reviewed By: jhenderson

Subscribers: jkorous, dexonsmith, ributzka, llvm-commits

Tags: #llvm

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

4 years ago[TLI] Support for per-Function TLI that overrides available libfuncs
Teresa Johnson [Mon, 4 Nov 2019 21:48:44 +0000 (13:48 -0800)]
[TLI] Support for per-Function TLI that overrides available libfuncs

Summary:

Follow-on to D66428 and D71193, to build the TLI per-function so
that -fno-builtin* handling can be migrated to use function attributes.
See discussion on D61634 for background. This is an enabler for fixing
handling of these options for LTO, for example.

With D71193, the -fno-builtin* flags are converted to function
attributes, so we can now set this information per-function on the TLI.

In this patch, the TLI constructor is changed to take a Function, which
can be used to override the available builtins. The TLI is augmented
with an array that can be used to specify which builtins are not
available for the corresponding function. The available function checks
are changed to consult this override before checking the underlying
module level baseline TLII. New code is added to set this override
array based on the attributes.

I also removed the code that sets availability in the TLII in clang from
the options, which is no longer needed.

I removed a per-Triple caching of TLII objects in the analysis object,
as it is based on the Module's Triple which is the same for all
functions in any case. Is there a case where we would be compiling
multiple Modules with different Triples in one compilation?

Finally, I have changed the legacy analysis wrapper to create and use
the new PM analysis class (TargetLibraryAnalysis) in getTLI. This is
consistent with the behavior of getTTI for the legacy
TargetTransformInfo analysis. This change means that getTLI now creates
a new TLI on each call (although that should be very cheap as we cache
the module level TLII, and computing the per-function
attribute based availability should also be reasonably efficient).
I measured the compile time for a large C++ file with tens of thousands
of functions and as expected there was no increase.

Reviewers: chandlerc, hfinkel, gchatelet

Subscribers: mehdi_amini, dexonsmith, llvm-commits

Tags: #llvm

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

4 years agoFixing a -Wcovered-switch diagnostic and changing tabs to spaces; NFC.
Aaron Ballman [Mon, 16 Dec 2019 16:37:51 +0000 (11:37 -0500)]
Fixing a -Wcovered-switch diagnostic and changing tabs to spaces; NFC.

4 years ago[libunwind][RISCV] Add 64-bit RISC-V support
Sam Elliott [Mon, 16 Dec 2019 16:35:17 +0000 (16:35 +0000)]
[libunwind][RISCV] Add 64-bit RISC-V support

Summary:
Add unwinding support for 64-bit RISC-V.

This is from the FreeBSD implementation with the following minor
changes:

- Renamed and renumbered DWARF registers to match the RISC-V ABI [1]
- Use the ABI mneumonics in getRegisterName() instead of the exact
   register names
- Include checks for __riscv_xlen == 64 to facilitate adding the 32-bit
   ABI in the future.

[1] https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md

Patch by Mitchell Horne (mhorne)

Reviewers: lenary, luismarques, compnerd, phosek

Reviewed By: lenary, luismarques

Subscribers: arichardson, sameer.abuasal, abidh, asb, aprantl, krytarowski, simoncook, kito-cheng, christof, shiva0217, rogfer01, rkruppe, PkmX, psnobl, benna, lenary, s.egerton, luismarques, emaste, cfe-commits

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

4 years ago[Bugpoint] Do not create illegal function attribute combos
David Greene [Mon, 28 Oct 2019 18:21:29 +0000 (13:21 -0500)]
[Bugpoint] Do not create illegal function attribute combos

If a function requires optnone to trigger a crash, it must also have noline,
otherwise it will fail a verifier check.

Differential revision: https://reviews.llvm.org/D69522

4 years agoRevert "Revert "[libomptarget] Move resource id functions into target specific code...
JonChesterfield [Mon, 16 Dec 2019 16:16:13 +0000 (16:16 +0000)]
Revert "Revert "[libomptarget] Move resource id functions into target specific code, implement for amdgcn""

Summary:
This reverts commit dd8a7fcdd73dd63529b81bf9f72c7529dfe99ec3.

Alexey reports undefined symbols for the new inline functions defined in target_impl.h
This does not reproduce for me for nvptx, or amdgcn, under release or debug builds.

I believe the patch is fine, based on:
 - the semantics of an inline function in C++ (the cuda INLINE functions end
   up as linkonce_odr in IR), which are only legal to drop if they have no uses
 - the code generated from a debug build of clang 9 does not show these undef symbols
 - the tests pass
 - the code is trivial

To progress from here I either need:
 - A tie break - someone to play the role of CI in determining whether the patch works
 - Alexey to provide sufficient information about his build for me to reproduce the failure
 - Alexey to debug why the symbols are disappearing for him and report back

Reviewers: ABataev, jdoerfert, grokos

Subscribers: jvesely, openmp-commits

Tags: #openmp

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

4 years ago[mips] Add an assert in getTargetStreamer()
Miloš Stojanović [Mon, 16 Dec 2019 16:03:18 +0000 (17:03 +0100)]
[mips] Add an assert in getTargetStreamer()

Check if the TargetStreamer can be accessed.

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

4 years agogn build: Merge 0add79aec2e
LLVM GN Syncbot [Mon, 16 Dec 2019 16:00:52 +0000 (16:00 +0000)]
gn build: Merge 0add79aec2e

4 years ago[llvm-exegesis][mips] Add SnippetGeneratorTest unit test
Miloš Stojanović [Mon, 16 Dec 2019 15:49:09 +0000 (16:49 +0100)]
[llvm-exegesis][mips] Add SnippetGeneratorTest unit test

Test latency with explicit register dependency, without and with
forbidden registers.

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

4 years ago[OPENMP50]Add if clause in target teams distribute parallel for simd directive.
Alexey Bataev [Mon, 16 Dec 2019 15:27:39 +0000 (10:27 -0500)]
[OPENMP50]Add if clause in target teams distribute parallel for simd directive.

According to OpenMP 5.0, if clause can be used in for simd directive. If
condition in the if clause if false, the non-vectorized version of the
loop must be executed.

4 years agoFix floating point builtins to not promote float->double
Erich Keane [Mon, 16 Dec 2019 15:18:18 +0000 (07:18 -0800)]
Fix floating point builtins to not promote float->double

As brought up in D71467, a group of floating point builtins
automatically promoted floats to doubles because they used the variadic
builtin tag to support an overload set. The result is that the
parameters were treated as a variadic pack, which always promots
float->double.

This resulted in the wrong answer being given in cases with certain
values of NaN.

4 years ago[clang][SystemZ] Add support for -march=native
Ulrich Weigand [Mon, 16 Dec 2019 15:09:09 +0000 (16:09 +0100)]
[clang][SystemZ] Add support for -march=native

Handle -march=native in systemz::getSystemZTargetCPU, similar to
how this is done on other platforms.  Also change the return type
to std::string instead of const char *.

4 years ago[clangd] Reapply b60896fad926 Fall back to selecting token-before-cursor if token...
Sam McCall [Mon, 16 Dec 2019 14:58:03 +0000 (15:58 +0100)]
[clangd] Reapply b60896fad926 Fall back to selecting token-before-cursor if token-after-cursor fails.

This reverts commit 8f876d5105507f874c0fb86bc779c9853eab3fe2.

4 years agoRevert "[clangd] Reapply b60896fad926 Fall back to selecting token-before-cursor...
Sam McCall [Mon, 16 Dec 2019 14:57:43 +0000 (15:57 +0100)]
Revert "[clangd] Reapply b60896fad926 Fall back to selecting token-before-cursor if token-after-cursor fails."

This reverts commit 2500a8d5d8813a3e31fc9ba8dd45e211439a1e3d.

4 years ago[clangd] Reapply b60896fad926 Fall back to selecting token-before-cursor if token...
Sam McCall [Mon, 16 Dec 2019 14:46:40 +0000 (15:46 +0100)]
[clangd] Reapply b60896fad926 Fall back to selecting token-before-cursor if token-after-cursor fails.

This reverts commit f0604e73a4daa35a10eb17a998657d6c4bd0e971
The issue with movability of Tweak::Selection was addressed in 7dc388bd9596bbf42633f8a8e450224e39740b60

4 years ago[clangd] Make Tweak::Selection movable. NFC
Sam McCall [Mon, 16 Dec 2019 14:46:40 +0000 (15:46 +0100)]
[clangd] Make Tweak::Selection movable. NFC

4 years agoSilence an MSVC "not all control paths" diagnostic; NFC.
Aaron Ballman [Mon, 16 Dec 2019 14:34:45 +0000 (09:34 -0500)]
Silence an MSVC "not all control paths" diagnostic; NFC.

4 years agoRevert "[clangd] Implement "textDocument/documentLink" protocol support"
Dmitri Gribenko [Mon, 16 Dec 2019 14:21:51 +0000 (15:21 +0100)]
Revert "[clangd] Implement "textDocument/documentLink" protocol support"

This reverts commit d6417f5584aa7673fa0212029a96cc9cacb1aad5. The tests
depend on builtin headers, which is not intentionally supported in
clangd tests; these tests are broken in some build environments.

4 years agoRevert "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove"
Guillaume Chatelet [Mon, 16 Dec 2019 14:19:09 +0000 (15:19 +0100)]
Revert "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove"

This reverts commit 181ab91efc9fb08dedda10a2fbc5fccb83ce8799.

4 years agogn build: (manually, belatedly) merge r358832
Nico Weber [Mon, 16 Dec 2019 14:02:41 +0000 (09:02 -0500)]
gn build: (manually, belatedly) merge r358832

4 years agogn build: (manually, belatedly) merge r371898
Nico Weber [Mon, 16 Dec 2019 14:01:55 +0000 (09:01 -0500)]
gn build: (manually, belatedly) merge r371898

4 years agoReland [AArch64][MachineOutliner] Return address signing for outlined functions
David Tellenbach [Mon, 16 Dec 2019 12:19:54 +0000 (13:19 +0100)]
Reland [AArch64][MachineOutliner] Return address signing for outlined functions

Summary:
Reland after fixing a bug that allowed outlining of SP modifying instructions
that invalidated return address signing.

During AArch64 frame lowering instructions to enable return address
signing are inserted into functions if needed. Functions generated during
machine outlining don't run through target frame lowering and hence are
missing such instructions.

This patch introduces the following changes:

1. If not all functions that potentially participate in function outlining agree
   on their return address signing scope and their return address signing key,
   outlining is disabled for these functions.
2. If not all functions that potentially participate in function outlining agree
   on their support for v8.3A features, outlining is disabled for these
   functions.
3. If an outlining candidate would outline instructions that modify sp in a way
   that invalidates return address signing, outlining is disabled for that
   particular candidate.
4. If all candidate functions agree on the signing scope, signing key and their
   support for v8.3 features, the outlined function behaves as if it had the
   same scope and key attributes and as if it would provide the same v8.3A
   support as the original functions.

Reviewers: ostannard, paquette

Reviewed By: ostannard

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years agofind_interesting_reviews.py: adapt to github monorepo
Kristof Beyls [Mon, 16 Dec 2019 13:31:12 +0000 (13:31 +0000)]
find_interesting_reviews.py: adapt to github monorepo

4 years ago[lldb] Use file-based synchronization in TestVSCode_attach
Pavel Labath [Mon, 16 Dec 2019 13:09:09 +0000 (14:09 +0100)]
[lldb] Use file-based synchronization in TestVSCode_attach

The is the best method we have at the moment for attach-style tests.

4 years ago[llvm-exegesis] Set up AsmTargetStreamer in readSnippets
Guillaume Chatelet [Fri, 13 Dec 2019 15:14:39 +0000 (16:14 +0100)]
[llvm-exegesis] Set up AsmTargetStreamer in readSnippets

Summary: This is a follow up on D71137 properly setting up the AsmTargetStreamer prior to AsmParser::Run call.

Reviewers: courbet, mstojanovic

Subscribers: tschuett, mikhail.ramalho, llvm-commits, petarj, atanasyan

Tags: #llvm

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

4 years ago[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove
Guillaume Chatelet [Fri, 13 Dec 2019 16:54:50 +0000 (17:54 +0100)]
[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove

Summary:
This patch introduces a set of functions to enable deprecation of IRBuilder functions without breaking out of tree clients.
Functions will be deprecated one by one and as in tree code is cleaned up.

This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AArch64][SVE2] Add intrinsics for binary narrowing operations
Andrzej Warzynski [Mon, 16 Dec 2019 12:22:42 +0000 (12:22 +0000)]
[AArch64][SVE2] Add intrinsics for binary narrowing operations

Summary:
The following intrinsics for binary narrowing add and sub operations are
added:
  * @llvm.aarch64.sve.addhnb
  * @llvm.aarch64.sve.addhnt
  * @llvm.aarch64.sve.raddhnb
  * @llvm.aarch64.sve.raddhnt
  * @llvm.aarch64.sve.subhnb
  * @llvm.aarch64.sve.subhnt
  * @llvm.aarch64.sve.rsubhnb
  * @llvm.aarch64.sve.rsubhnt

Reviewers: sdesmalen, rengolin, efriedma

Reviewed By: sdesmalen, efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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