OSDN Git Service

android-x86/external-llvm-project.git
3 years agoPR48587: is_constant_evaluated() should not evaluate to true during a
Richard Smith [Tue, 9 Feb 2021 01:32:52 +0000 (17:32 -0800)]
PR48587: is_constant_evaluated() should not evaluate to true during a
variable's destruction if it didn't do so during construction.

The standard doesn't give any guidance as to what to do here, but this
approach seems reasonable and conservative, and has been proposed to the
standard committee.

(cherry picked from commit c945dc4a5023d6a17d11fcda76509b94b36e34fc)

3 years ago[GlobalISel] Check if branches use the same MBB in matchOptBrCondByInvertingCond
Jessica Paquette [Tue, 2 Feb 2021 22:21:33 +0000 (14:21 -0800)]
[GlobalISel] Check if branches use the same MBB in matchOptBrCondByInvertingCond

If the G_BR + G_BRCOND in this combine use the same MBB, then it will infinite
loop. Don't allow that to happen.

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

(cherry picked from commit 02d4b365bf4f8c2cb56e5612902f6c3bb4316493)

3 years ago[clangd] Fix clang tidy provider when multiple config files exist in directory tree
Nathan James [Fri, 12 Feb 2021 16:55:44 +0000 (16:55 +0000)]
[clangd] Fix clang tidy provider when multiple config files exist in directory tree

Currently Clang tidy provider searches from the root directory up to the target directory, this is the opposite of how clang-tidy searches for config files.
The result of this is .clang-tidy files are ignored in any subdirectory of a directory containing a .clang-tidy file.

Reviewed By: sammccall

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

(cherry picked from commit ba3ea9c60f0f259f0ccc47e47daf8253a5885531)

3 years agoFix "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Wed, 27 Jan 2021 10:14:54 +0000 (10:14 +0000)]
Fix "not all control paths return a value" warning. NFCI.

3 years agoPR48606: The lifetime of a constexpr heap allocation always started
Richard Smith [Tue, 9 Feb 2021 01:58:05 +0000 (17:58 -0800)]
PR48606: The lifetime of a constexpr heap allocation always started
during the same evaluation.

It looks like the only case for which this matters is determining
whether mutable subobjects of a heap allocation can be modified during
constant evaluation.

(cherry picked from commit 21e8bb83253e1a2f4b6fad9b53cafe8c530a38e2)

3 years ago[AST] Update LVal before evaluating lambda decl fields.
Zequan Wu [Fri, 5 Feb 2021 01:00:09 +0000 (17:00 -0800)]
[AST] Update LVal before evaluating lambda decl fields.

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

(cherry picked from commit 96fb49c3ff8e08680127ddd4ec45a0e6c199243b)

3 years ago[lldb-vscode] correctly use Windows macros
Walter Erquinigo [Thu, 4 Feb 2021 18:07:07 +0000 (10:07 -0800)]
[lldb-vscode] correctly use Windows macros

@mstorsjo found a mistake that I made when trying to fix some Windows
compilation errors encountered by @stella.stamenova.

I was incorrectly using the LLVM_ON_UNIX macro. In any case, proper use
of

  #if defined(_WIN32)

should be the actual fix.

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

(cherry picked from commit 36496cc2992d6fa26e6024971efcfc7d15f69888)

3 years agoFix lldb-vscode builds on Windows targeting POSIX
Walter Erquinigo [Thu, 28 Jan 2021 17:24:30 +0000 (09:24 -0800)]
Fix lldb-vscode builds on Windows targeting POSIX

@stella.stamenova found out that lldb-vscode's Win32 macros were failing
when building on windows targetings POSIX platforms.

I'm changing these macros for LLVM_ON_UNIX, which should be more
accurate.

(cherry picked from commit 0bca9a7ce2eeaa9f1d732ffbc17769560a2b236e)

3 years agoFix runInTerminal failures on Windows
Walter Erquinigo [Wed, 27 Jan 2021 21:02:45 +0000 (13:02 -0800)]
Fix runInTerminal failures on Windows

stella.stemenova mentioned in https://reviews.llvm.org/D93951 failures on Windows for this test.

I'm fixing the macro definitions and disabling the tests for python
versions lower than 3.7. I'll figure out that actual issue with
python3.6 after the buildbots are fine again.

(cherry picked from commit ab5591e1d8f5abcfa9e75193d3e8a29087b61425)

3 years ago[🍒][libc++] Fix libcxx build on 32bit architectures with 64bit time_t defaults e...
Louis Dionne [Wed, 3 Feb 2021 22:00:20 +0000 (17:00 -0500)]
[🍒][libc++] Fix libcxx build on 32bit architectures with 64bit time_t defaults e.g. riscv32

Patch by Khem Raj.

(cherry pick of commit 85b9c5ccc172a1e61c7ecaaec4752587cb6f1e26)

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

3 years ago[🍒]Disable CFI in __get_elem to allow casting a pointer to uninitialized memory
Reid Kleckner [Mon, 1 Feb 2021 23:18:42 +0000 (15:18 -0800)]
[🍒]Disable CFI in __get_elem to allow casting a pointer to uninitialized memory

Fixes usage of shared_ptr with CFI enabled, which is llvm.org/pr48993.

(cherry pick of commit bab74864168bb5e28ecbc0294fe1095d8da7f569)

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

3 years ago[🍒][libc++] Rename include/support to include/__support
Louis Dionne [Tue, 2 Feb 2021 21:58:38 +0000 (16:58 -0500)]
[🍒][libc++] Rename include/support to include/__support

We do ship those headers, so the directory name should not be something
that can potentially conflict with user-defined directories.

This is a cherry-pick of b51756819a85563ae063e98eeb3d6af8e44c8f64.

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

3 years ago[OpenMP][libomptarget] Fixed an issue that device sync is skipped if the kernel doesn...
Shilei Tian [Fri, 5 Feb 2021 01:14:14 +0000 (20:14 -0500)]
[OpenMP][libomptarget] Fixed an issue that device sync is skipped if the kernel doesn't have any argument

Currently if there is not kernel argument, device synchronization will
be skipped. This can lead to two issues:
1. If there is any device error, it will not be captured;
2. The target region might end before the kernel is done, which is not spec
   conformant.

The test added in this patch only runs on NVPTX platform, although it will not
be executed by Phab at all. It also requires `not` which is not available on most
systems.

Reviewed By: jdoerfert

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

(cherry picked from commit b68a6b09e60a24733b923a0fc282746a855852da)

3 years ago[MemorySSA] Don't treat lifetime.end as NoAlias
Nikita Popov [Sun, 31 Jan 2021 16:55:24 +0000 (17:55 +0100)]
[MemorySSA] Don't treat lifetime.end as NoAlias

MemorySSA currently treats lifetime.end intrinsics as not aliasing
anything. This breaks MemorySSA-based MemCpyOpt, because we'll happily
move a read of a pointer below a lifetime.end intrinsic, as no clobber
is reported.

I think the MemorySSA modelling here isn't correct: lifetime.end(p)
has approximately the same effect as doing a memcpy(p, undef), and
should be treated as a clobber.

This patch removes the special handling of lifetime.end, leaving
alias analysis to handle it appropriately.

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

3 years ago[MemCpyOpt] Add test for incorrect optimization across lifetime (NFC)
Nikita Popov [Fri, 29 Jan 2021 11:56:23 +0000 (12:56 +0100)]
[MemCpyOpt] Add test for incorrect optimization across lifetime (NFC)

This only affects the MemorySSA-based implementation.

3 years agoworkflows: Update libclang-abi-tests to work with minor release baselines
Tom Stellard [Fri, 5 Feb 2021 01:40:33 +0000 (01:40 +0000)]
workflows: Update libclang-abi-tests to work with minor release baselines

3 years agoAdd a release note about deprecating the clang-cl /fallback flag
Hans Wennborg [Thu, 4 Feb 2021 12:26:59 +0000 (13:26 +0100)]
Add a release note about deprecating the clang-cl /fallback flag

As discussed in
https://lists.llvm.org/pipermail/cfe-dev/2021-January/067524.html

The flag has been removed on the main branch in D95876.

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

3 years ago[OpenMP] Disabled profiling in `libomp` by default to unblock link errors
Shilei Tian [Thu, 28 Jan 2021 12:24:19 +0000 (07:24 -0500)]
[OpenMP] Disabled profiling in `libomp` by default to unblock link errors

Link error occurred when time profiling in libomp is enabled by default
because `libomp` is assumed to be a C library but the dependence on
`libLLVMSupport` for profiling is a C++ library. Currently the issue blocks all
OpenMP tests in Phabricator.

This patch set a new CMake option `OPENMP_ENABLE_LIBOMP_PROFILING` to
enable/disable the feature. By default it is disabled. Note that once time
profiling is enabled for `libomp`, it becomes a C++ library.

Reviewed By: jdoerfert

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

(cherry picked from commit c571b168349fdf22d1dc8b920bcffa3d5161f0a2)

3 years ago[OpenMP] Fix building using LLVM_ENABLE_RUNTIMES
Giorgis Georgakoudis [Mon, 25 Jan 2021 22:10:50 +0000 (14:10 -0800)]
[OpenMP] Fix building using LLVM_ENABLE_RUNTIMES

Fix when time profiling is enabled.

Related to: D94855

Reviewed By: JonChesterfield

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

(cherry picked from commit bb40e6731843de92f1c73ad6efceb8a89e045ea6)

3 years ago[clang][aarch64][WOA64][docs] Release note for longjmp crash with /guard:cf
Peter Waller [Tue, 26 Jan 2021 11:55:24 +0000 (11:55 +0000)]
[clang][aarch64][WOA64][docs] Release note for longjmp crash with /guard:cf

Add a release note workaround for PR47463.

Bug: https://bugs.llvm.org/show_bug.cgi?id=47463

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

3 years agoRevert "[OpenMP] Disabled profiling in `libomp` by default to unblock link errors"
Shilei Tian [Thu, 4 Feb 2021 13:44:20 +0000 (08:44 -0500)]
Revert "[OpenMP] Disabled profiling in `libomp` by default to unblock link errors"

This reverts commit f5602e0bf31ab590da19fa357980a753dbfd666e.

3 years ago[X86] Accept 64-bit GPRs for vextractps when using a register that requires EVEX.
Craig Topper [Mon, 1 Feb 2021 18:56:09 +0000 (10:56 -0800)]
[X86] Accept 64-bit GPRs for vextractps when using a register that requires EVEX.

This is consistent with the VEX version. It also fixes a sorting
issue in the matching table that caused the EVEX version to be
prioritized over VEX in intel syntax.

Fixes issue [2] from PR48991.

(cherry picked from commit c691fe14da93a7c9eff466231515d6d4d16124fa)

3 years ago[OpenMP][NVPTX] Take functions in `deviceRTLs` as `convergent`
Shilei Tian [Thu, 4 Feb 2021 01:57:59 +0000 (20:57 -0500)]
[OpenMP][NVPTX] Take functions in `deviceRTLs` as `convergent`

OpenMP device compiler (similar to other SPMD compilers) assumes that
functions are convergent by default to avoid invalid transformations, such as
the bug (https://bugs.llvm.org/show_bug.cgi?id=49021).

Reviewed By: jdoerfert

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

(cherry picked from commit 0f0ce3c12edefd25448e39c4d20718a10d3d42c1)

3 years ago[CSSPGO] Introducing distribution factor for pseudo probe.
Hongtao Yu [Fri, 11 Dec 2020 20:18:31 +0000 (12:18 -0800)]
[CSSPGO] Introducing distribution factor for pseudo probe.

Sample re-annotation is required in LTO time to achieve a reasonable post-inline profile quality. However, we have seen that such LTO-time re-annotation degrades profile quality. This is mainly caused by preLTO code duplication that is done by passes such as loop unrolling, jump threading, indirect call promotion etc, where samples corresponding to a source location are aggregated multiple times due to the duplicates. In this change we are introducing a concept of distribution factor for pseudo probes so that samples can be distributed for duplicated probes scaled by a factor. We hope that optimizations duplicating code well-maintain the branch frequency information (BFI) based on which probe distribution factors are calculated. Distribution factors are updated at the end of preLTO pipeline to reflect an estimated portion of the real execution count.

This change also introduces a pseudo probe verifier that can be run after each IR passes to detect duplicated pseudo probes.

A saturated distribution factor stands for 1.0. A pesudo probe will carry a factor with the value ranged from 0.0 to 1.0. A 64-bit integral distribution factor field that represents [0.0, 1.0] is associated to each block probe. Unfortunately this cannot be done for callsite probes due to the size limitation of a 32-bit Dwarf discriminator. A 7-bit distribution factor is used instead.

Changes are also needed to the sample profile inliner to deal with prorated callsite counts. Call sites duplicated by PreLTO passes, when later on inlined in LTO time, should have the callees’s probe prorated based on the Prelink-computed distribution factors. The distribution factors should also be taken into account when computing hotness for inline candidates. Also, Indirect call promotion results in multiple callisites. The original samples should be distributed across them. This is fixed by adjusting the callisites' distribution factors.

Reviewed By: wmi

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

(cherry picked from commit 3d89b3cbec230633e8228787819b15116c1a1730)

3 years ago[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline
Wenlei He [Wed, 20 Jan 2021 07:29:14 +0000 (23:29 -0800)]
[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline

Refactoring SampleProfileLoader::inlineHotFunctions to use helpers from CSSPGO inlining and reduce similar code in the inlining loop, plus minor cleanup for AFDO path.

This is resubmit of D95024, with build break and overtighten assertion fixed.

Test Plan:

(cherry picked from commit 1645f465be85223e9f5b6303a3e5e0e491fd819f)

3 years ago[CSSPGO] Call site prioritized inlining for sample PGO
Wenlei He [Mon, 4 Jan 2021 00:43:06 +0000 (16:43 -0800)]
[CSSPGO] Call site prioritized inlining for sample PGO

This change implemented call site prioritized BFS profile guided inlining for sample profile loader. The new inlining strategy maximize the benefit of context-sensitive profile as mentioned in the follow up discussion of CSSPGO RFC. The change will not affect today's AutoFDO as it's opt-in. CSSPGO now defaults to the new FDO inliner, but can fall back to today's replay inliner using a switch (`-sample-profile-prioritized-inline=0`).

Motivation

With baseline AutoFDO, the inliner in sample profile loader only replays previous inlining, and the use of profile is only for pruning previous inlining that turned out to be cold. Due to the nature of replay, the FDO inliner is simple with hotness being the only decision factor. It has the following limitations that we're improving now for CSSPGO.
 - It doesn't take inline candidate size into account. Since it's doing replay, the size growth is bounded by previous CGSCC inlining. With context-sensitive profile, FDO inliner is no longer limited by previous inlining, so we need to take size into account to avoid significant size bloat.
 - The way it looks at hotness is not accurate. It uses total samples in an inlinee as proxy for hotness, while what really matters for an inline decision is the call site count. This is an unfortunate fall back because call site count and callee entry count are not reliable due to dwarf based correlation, especially for inlinees. Now paired with pseudo-probe, we have accurate call site count and callee's entry count, so we can use that to gauge hotness more accurately.
 - It treats all call sites from a block as hot as long as there's one call site considered hot. This is normally true, but since total samples is used as hotness proxy, this transitiveness within block magnifies the inacurate hotness heuristic. With pseduo-probe and the change above, this is no longer an issue for CSSPGO.

New FDO Inliner

Putting all the requirement for CSSPGO together, we need a top-down call site prioritized BFS inliner. Here're reasons why each component is needed.
 - Top-down: We need a top-down inliner to better leverage context-sensitive profile, so inlining is driven by accurate context profile, and post-inline is also accurate. This is already implemented in https://reviews.llvm.org/D70655.
 - Size Cap: For top-down inliner, taking function size into account for inline decision alone isn't sufficient to control size growth. We also need to explicitly cap size growth because with top-down inlining, we can grow inliner size significantly with large number of smaller inlinees even if each individually passes the cost/size check.
 - Prioritize call sites: With size cap, inlining order also becomes important, because if we stop inlining due to size budget limit, we'd want to use budget towards the most beneficial call sites.
 - BFS inline: Same as call site prioritization, if we stop inlining due to size budget limit, we want a balanced inline tree, rather than going deep on one call path.

Note that the new inliner avoids repeatedly evaluating same set of call site, so it should help with compile time too. For this reason, we could transition today's FDO inliner to use a queue with equal priority to avoid wasted reevaluation of same call site (TODO).

Speculative indirect call promotion and inlining is also supported now with CSSPGO just like baseline AutoFDO.

Tunings and knobs

I created tuning knobs for size growth/cap control, and for hot threshold separate from CGSCC inliner. The default values are selected based on initial tuning with CSSPGO.

Results

Evaluated with an internal LLVM fork couple months ago, plus another change to adjust hot-threshold cutoff for context profile (will send up after this one), the new inliner show ~1% geomean perf win on spec2006 with CSSPGO, while reducing code size too. The measurement was done using train-train setup, MonoLTO w/ new pass manager and pseudo-probe. Note that this is just a starting point - we hope that the new inliner will open up more opportunity with CSSPGO, but it will certainly take more time and effort to make it fully calibrated and ready for bigger workloads (we're working on it).

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

(cherry picked from commit 6bae5973c476e16dbbc82030d65c7859a6628e89)

3 years ago[CSSPGO] Passing the clang driver switch -fpseudo-probe-for-profiling to the linker.
Hongtao Yu [Fri, 22 Jan 2021 23:52:46 +0000 (15:52 -0800)]
[CSSPGO] Passing the clang driver switch -fpseudo-probe-for-profiling to the linker.

As titled.

Reviewed By: wmi, wenlei

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

(cherry picked from commit d3e2e3740d0730cb6788c771bb01a8f3e935bf2e)

3 years ago[CSSPGO] Tweaking inlining with pseudo probes.
Hongtao Yu [Mon, 1 Feb 2021 06:31:51 +0000 (22:31 -0800)]
[CSSPGO] Tweaking inlining with pseudo probes.

Fixing up a couple places where `getCallSiteIdentifier` is needed to support pseudo-probe-based callsites.

Also fixing an issue in the extbinary profile reader where the metadata section is not fully scanned based on the number of profiles loaded only for the current module.

Reviewed By: wmi, wenlei

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

(cherry picked from commit 224fee8219bb3aed34f13ce40935e1b3ede90a0f)

3 years ago[CSSPGO] Support of CS profiles in extended binary format.
Hongtao Yu [Thu, 28 Jan 2021 00:04:11 +0000 (16:04 -0800)]
[CSSPGO] Support of CS profiles in extended binary format.

This change brings up support of context-sensitive profiles in the format of extended binary. Existing sample profile reader/writer/merger code is being tweaked to reflect the fact of bracketed input contexts, like (`[...]`). The paired brackets are also needed in extbinary profiles because we don't yet have an otherwise good way to tell calling contexts apart from regular function names since the context delimiter `@` can somehow serve as a part of the C++ mangled names.

Reviewed By: wmi, wenlei

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

(cherry picked from commit 7e99bddfeaab2713a8bb6ca538da25b66e6efc59)

3 years ago[OpenMP] Disabled profiling in `libomp` by default to unblock link errors
Shilei Tian [Thu, 28 Jan 2021 12:24:19 +0000 (07:24 -0500)]
[OpenMP] Disabled profiling in `libomp` by default to unblock link errors

Link error occurred when time profiling in libomp is enabled by default
because `libomp` is assumed to be a C library but the dependence on
`libLLVMSupport` for profiling is a C++ library. Currently the issue blocks all
OpenMP tests in Phabricator.

This patch set a new CMake option `OPENMP_ENABLE_LIBOMP_PROFILING` to
enable/disable the feature. By default it is disabled. Note that once time
profiling is enabled for `libomp`, it becomes a C++ library.

Reviewed By: jdoerfert

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

(cherry picked from commit c571b168349fdf22d1dc8b920bcffa3d5161f0a2)

3 years agoExtend release notes for AST Matchers changes
Stephen Kelly [Wed, 3 Feb 2021 23:04:12 +0000 (23:04 +0000)]
Extend release notes for AST Matchers changes

3 years agoPR44325 (and duplicates): don't issue -Wzero-as-null-pointer-constant
Richard Smith [Wed, 3 Feb 2021 22:57:19 +0000 (14:57 -0800)]
PR44325 (and duplicates): don't issue -Wzero-as-null-pointer-constant
when rewriting 'a < b' as '(a <=> b) < 0'.

It's pretty common for comparison category types to use a pointer or
pointer-to-member type as their '0' parameter.

(cherry picked from commit 1f06f41993b6363e6b2c4f22a13488a3e687f31b)

3 years ago[OpenMP] Fix seg fault in libomptarget when using Info with multiple threads
Joseph Huber [Mon, 1 Feb 2021 15:31:09 +0000 (10:31 -0500)]
[OpenMP] Fix seg fault in libomptarget when using Info with multiple threads

Summary:
One option for the LIBOMPTARGET_INFO environment variable is to print the current status of the device's data mappings. These are a shared resource among threads so this needs to be protected when using multiple streams.

Reviewed By: jdoerfert

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

(cherry picked from commit fda48539988d2a1bdb6395799151e9090312a20b)

3 years ago[OpenMP][NFC] Added release note for new `deviceRTLs` and hidden helper task
Shilei Tian [Fri, 29 Jan 2021 18:12:47 +0000 (13:12 -0500)]
[OpenMP][NFC] Added release note for new `deviceRTLs` and hidden helper task

Added release note for new `deviceRTLs` and hidden helper task for LLVM
12.

Reviewed By: jdoerfert

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

(cherry picked from commit 7bc31018f71cac22b7060c49cefb6f3d0d2e2069)

3 years ago[OpenMP][deviceRTLs] Added `[[clang::loader_uninitialized]]` explicitly
Shilei Tian [Thu, 28 Jan 2021 13:12:39 +0000 (08:12 -0500)]
[OpenMP][deviceRTLs] Added `[[clang::loader_uninitialized]]` explicitly

`[[clang::loader_uninitialized]]` is in macro `SHARED` but it doesn't
work for array like `parallelLevel`, so the variable will be zero initialized.
There is also a similar issue for `omptarget_nvptx_device_State` which is in
global address space. Its c'tor is also generated, which was not in the past when
building the `deviceRTLs` with CUDA. In this patch, we added the attribute to
the two variables explicitly.

Reviewed By: jdoerfert

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

(cherry picked from commit 19248d30e4ed5250fa84abbbd52fc7b835918a45)

3 years ago[OpenMP][NVPTX] Added the missing -O1 when building NVPTX bitcode libraries
Shilei Tian [Thu, 28 Jan 2021 13:13:28 +0000 (08:13 -0500)]
[OpenMP][NVPTX] Added the missing -O1 when building NVPTX bitcode libraries

In the past `-O1` was used when building NVPTX bitcode libraries. After
we switched to OpenMP, `-O1` was missing by mistake, leading to a huge performance
regression.

Reviewed By: JonChesterfield

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

(cherry picked from commit 5a64794bbad4010778406dfee7748e6080258dbf)

3 years ago[OpenMP][Libomptarget] Fix conditional in CMake for remote plugin
Atmn Patel [Wed, 27 Jan 2021 23:49:41 +0000 (18:49 -0500)]
[OpenMP][Libomptarget] Fix conditional in CMake for remote plugin

The remote offloading plugin's CMakeLists was trying to build if its
flag was enabled even if it didn't find gRPC/protobuf. The conditional
was wrong, it's fixed by this.

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

(cherry picked from commit 8a77056256d9970387595a5c729d894e3fe07131)

3 years ago[elfabi] Fix tests which failed on different timezones
Haowei Wu [Thu, 28 Jan 2021 22:13:20 +0000 (14:13 -0800)]
[elfabi] Fix tests which failed on different timezones

This patch fixes elfabi tests on machines using a GMT+X timezone
settings.

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

(cherry picked from commit 771b35965457ebd5faaed8a1c3d2bcefffe721a3)

3 years ago[X86] Fix disassembly of x86-64 GDTLS code sequence
Andrew Ng [Wed, 27 Jan 2021 16:47:21 +0000 (16:47 +0000)]
[X86] Fix disassembly of x86-64 GDTLS code sequence

For x86-64 the REX.w prefix takes precedence over any other size
override (i.e. 0x66). Therefore, for x86-64 when REX.w is present set
'hasOpSize' to false to ensure that any size override is ignored.

Fixes PR48901.

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

(cherry picked from commit 94fedd266125a5425aa33e11332bf414f0b6dc35)

3 years ago[LV] Fix crash when computing max VF too early
Cullen Rhodes [Sat, 16 Jan 2021 16:08:40 +0000 (16:08 +0000)]
[LV] Fix crash when computing max VF too early

D90687 introduced a crash:

  llvm::LoopVectorizationCostModel::computeMaxVF(llvm::ElementCount, unsigned int):
    Assertion `WideningDecisions.empty() && Uniforms.empty() && Scalars.empty() &&
    "No decisions should have been taken at this point"' failed.

when compiling the following C code:

  typedef struct {
  char a;
  } b;

  b *c;
  int d, e;

  int f() {
    int g = 0;
    for (; d; d++) {
      e = 0;
      for (; e < c[d].a; e++)
        g++;
    }
    return g;
  }

with:

  clang -Os -target hexagon -mhvx -fvectorize -mv67 testcase.c -S -o -

This occurred since prior to D90687 computeFeasibleMaxVF would only be
called in computeMaxVF when a scalar epilogue was allowed, but now it's
always called. This causes the assert above since computeFeasibleMaxVF
collects all viable VFs larger than the default MaxVF, and for each VF
calculates the register usage which results in analysis being done the
assert above guards against. This can occur in computeFeasibleMaxVF if
TTI.shouldMaximizeVectorBandwidth and this target hook is implemented in
the hexagon backend to always return true.

Reported by @iajbar.

Reviewed By: fhahn

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

(cherry picked from commit 8cda227432f1c9ceb63b88802ed8136da97274f1)

3 years ago[RISCV] Update the version number to v0.10 for vector.
Hsiangkai Wang [Fri, 29 Jan 2021 23:54:41 +0000 (07:54 +0800)]
[RISCV]  Update the version number to v0.10 for vector.

(cherry picked from commit 9847023660467a4469b5667bcf7a4c73a4780037)

3 years ago[RISCV] Update the version number to v0.10 for vector.
Hsiangkai Wang [Fri, 29 Jan 2021 13:59:49 +0000 (21:59 +0800)]
[RISCV] Update the version number to v0.10 for vector.

v0.10 is tagged in V specification. Update the version to v0.10.

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

(cherry picked from commit 282aca10aeb03bdaef0a8d4f3faa4c2ff236e527)

3 years ago[PowerPC][Power10] Fix XXSPLI32DX not correctly exploiting specific cases
Albion Fung [Thu, 28 Jan 2021 20:17:18 +0000 (15:17 -0500)]
[PowerPC][Power10] Fix XXSPLI32DX not correctly exploiting specific cases

Some cases may be transformed into 32 bit splats before hitting the boolean statement, which may cause incorrect behaviour and provide XXSPLTI32DX with the incorrect values of splat. The condition was reversed so that the shortcut prevents this problem.

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

(cherry picked from commit 2e470e03b49f1d79ebc315ca9d62a690a633c0cd)

3 years ago[PowerPC] Do not emit XXSPLTI32DX for sub 64-bit constants
Nemanja Ivanovic [Thu, 28 Jan 2021 05:08:39 +0000 (23:08 -0600)]
[PowerPC] Do not emit XXSPLTI32DX for sub 64-bit constants

If the APInt returned by BuildVectorSDNode::isConstantSplat() is narrower than
64 bits, the result produced by XXSPLTI32DX is incorrect. The result returned
by the function appears to be incorrect and we'll investigate/fix it in a
follow-up commit. However, since this causes miscompiles, we must
temporarily disable emitting this instruction for such values.

(cherry picked from commit 54e570d94af995ff58287a8288389641910a8239)

3 years ago[VE] Change inetger constants 32-bit friendly
Kazushi (Jam) Marukawa [Sat, 30 Jan 2021 03:34:06 +0000 (12:34 +0900)]
[VE] Change inetger constants 32-bit friendly

Correct integer constants like `1UL << 63` to `UINT64_C(1) << 63` in
order to make them work on 32-bit machines.  Tested on both an i386
and x86_64 machines.

Reviewed By: mgorny

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

(cherry picked from commit 4648098f97fa2a7c08c04632c70cf29293528812)

3 years ago[OpenMP] Fix python3 compatibility in openmp's lit.cfg
Tobias Hieta [Fri, 29 Jan 2021 07:44:56 +0000 (08:44 +0100)]
[OpenMP] Fix python3 compatibility in openmp's lit.cfg

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

(cherry picked from commit c3c02d0d5a313272f6d35926bdf678fc6b884c02)

3 years ago[X86][AVX] canonicalizeLaneShuffleWithRepeatedOps - don't merge VPERMILPD ops with...
Simon Pilgrim [Thu, 28 Jan 2021 12:11:31 +0000 (12:11 +0000)]
[X86][AVX] canonicalizeLaneShuffleWithRepeatedOps - don't merge VPERMILPD ops with different low/high masks.

Unlike VPERMILPS, VPERMILPD can have non-repeating masks in each 128-bit subvector, we weren't accounting for this when folding vperm2f128(vpermilpd(x,c),vpermilpd(y,c)) -> vpermilpd(vperm2f128(x,y),c).

I'm intending to add support for this but wanted to get a minimal fix in first for merging into 12.xx.

Fixes PR48908

(cherry picked from commit 6663330bc8c84a75ea092272297b557bfc310380)

3 years ago[X86][AVX] Add PR48908 shuffle test case
Simon Pilgrim [Thu, 28 Jan 2021 11:21:21 +0000 (11:21 +0000)]
[X86][AVX] Add PR48908 shuffle test case

(cherry picked from commit da8845fc3d3bb0b0e133f020931440511fa72723)

3 years agoworkflows: Add job to check for ABI changes in libclang.so and libclang-cpp.so
Tom Stellard [Mon, 1 Feb 2021 13:05:19 +0000 (13:05 +0000)]
workflows: Add job to check for ABI changes in libclang.so and libclang-cpp.so

3 years agoworkflows: Fix actions repository name for llvm tests
Tom Stellard [Wed, 3 Feb 2021 03:09:24 +0000 (03:09 +0000)]
workflows: Fix actions repository name for llvm tests

3 years agoworkflows: Re-enable lldb test on Mac OS X
Tom Stellard [Wed, 3 Feb 2021 02:41:49 +0000 (18:41 -0800)]
workflows: Re-enable lldb test on Mac OS X

3 years agoRevert "[ConstantFold] Fold more operations to poison"
Juneyoung Lee [Wed, 3 Feb 2021 15:07:04 +0000 (00:07 +0900)]
Revert "[ConstantFold] Fold more operations to poison"

This reverts commit 53040a968dc2ff20931661e55f05da2ef8b964a0 due to its
bad interaction with select i1 -> and/or i1 transformation.

This fixes:
https://bugs.llvm.org/show_bug.cgi?id=49005
https://bugs.llvm.org/show_bug.cgi?id=48435

(cherry picked from commit 06829034ca64b8c83a5b20d8abe5ddbfe7af0004)

3 years ago[OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy
Atmn Patel [Mon, 1 Feb 2021 00:18:41 +0000 (19:18 -0500)]
[OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy

From https://bugs.llvm.org/show_bug.cgi?id=48973, we know that
`std::call_once(PM->RTLs.initFlag, &RTLsTy::LoadRTLs, PM->RTLs)` causes compile
time problems in libstdc++v3 5.3.1. This is because there was a defect in the
standard regarding the `call_once` (LWG 2442). This was fixed in libstdc++ soon
thereafter, but there are likely other standard libraries where this will fail.

By matching this function call with the other one, we fix this bug.

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

3 years agoworkflows: Fix libclc tests
Tom Stellard [Mon, 1 Feb 2021 18:48:29 +0000 (10:48 -0800)]
workflows: Fix libclc tests

3 years ago[docs] Add release notes for things I've done for the 12.x release branch.
Martin Storsjö [Tue, 2 Feb 2021 13:08:17 +0000 (15:08 +0200)]
[docs] Add release notes for things I've done for the 12.x release branch.

3 years agoworkflows: Fix LLVM ABI checks to work for X.0.0 releases
Tom Stellard [Wed, 27 Jan 2021 03:09:20 +0000 (03:09 +0000)]
workflows: Fix LLVM ABI checks to work for X.0.0 releases

3 years ago[LoopUnswitch] Properly update MSSA if header has non-clobbering stores.
Florian Hahn [Sat, 30 Jan 2021 13:30:48 +0000 (13:30 +0000)]
[LoopUnswitch] Properly update MSSA if header has non-clobbering stores.

This patch fixes updating MemorySSA if the header contains memory
defs that do not clobber a duplicated instruction. We need to find the
first defining access outside the loop body and use that as defining
access of the duplicated instruction.

This fixes a crash caused by bee486851c1a.

(Cherry-picked on the 12.x release branch from
10c57268c074c3ad48f76da38fa2ba575ee3d1f9)

3 years ago[OpenMP][NVPTX] Disable building NVPTX deviceRTL by default on a non-CUDA system
Shilei Tian [Wed, 27 Jan 2021 22:06:05 +0000 (17:06 -0500)]
[OpenMP][NVPTX] Disable building NVPTX deviceRTL by default on a non-CUDA system

D95466 dropped CUDA to build NVPTX deviceRTL and enabled it by default.
However, the building requires some libraries that are not available on non-CUDA
system by default, which could break the compilation. This patch disabled the
build by default. It can be enabled with `LIBOMPTARGET_BUILD_NVPTX_BCLIB=ON`.

Reviewed By: kparzysz

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

(cherry picked from commit fb12df4a8e33d759938057718273dfb434b2d9c4)

3 years ago[clang-tidy] Fix linking tests to LLVMTestingSupport
Michał Górny [Fri, 29 Jan 2021 01:14:47 +0000 (02:14 +0100)]
[clang-tidy] Fix linking tests to LLVMTestingSupport

LLVMTestingSupport is not part of libLLVM, and therefore can not
be linked to via LLVM_LINK_COMPONENTS.  Instead, it needs to be
specified explicitly to ensure that it is linked explicitly
even if LLVM_LINK_LLVM_DYLIB is used.  This is consistent with handling
in clangd.

Fixes PR#48931

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

(cherry picked from commit 632545e8ce846ccaeca8df15a3dc5e36d01a1275)

3 years agoMake the profile-filter.c test compatible with 32-bit systems
Petr Hosek [Fri, 29 Jan 2021 03:01:41 +0000 (19:01 -0800)]
Make the profile-filter.c test compatible with 32-bit systems

This addresses PR48930.

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

(cherry picked from commit 0217f1c7a31ba44715bc083a60cddc2192ffed96)

3 years ago[sanitizer] Fix msan test build on FreeBSD after 7afdc89c2054
Dimitry Andric [Thu, 28 Jan 2021 22:53:45 +0000 (23:53 +0100)]
[sanitizer] Fix msan test build on FreeBSD after 7afdc89c2054

This commit accidentally enabled fgetgrent_r() in the msan tests under
FreeBSD, but this function is not supported. Also remove FreeBSD from
the SANITIZER_INTERCEPT_FGETGRENT_R macro.

(cherry picked from commit e056fc6cb676f72d5b7dfe7ca540b3275bd1a46f)

3 years ago[AMDGPU] Avoid an illegal operand in si-shrink-instructions
Piotr Sobczak [Wed, 27 Jan 2021 15:02:49 +0000 (16:02 +0100)]
[AMDGPU] Avoid an illegal operand in si-shrink-instructions

Before the patch it was possible to trigger a constant bus
violation when folding immediates into a shrunk instruction.

The patch adds a check to enforce the legality of the new operand.

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

(cherry picked from commit fc8e7411218c846386650cfba111b62827c71da0)

3 years agoRelax test expectations in debug-info-gline-tables-only-codeview.cpp
Hans Wennborg [Thu, 28 Jan 2021 13:37:33 +0000 (14:37 +0100)]
Relax test expectations in debug-info-gline-tables-only-codeview.cpp

To make it pass also on 32-bit Windows, see PR48920.

(cherry picked from commit 0024efc69ea6cd0b630cd11cef5991b7edb73ffc)

3 years ago[OpenMP] libomp: fix build by cl with vs2019
AndreyChurbanov [Fri, 29 Jan 2021 10:16:41 +0000 (13:16 +0300)]
[OpenMP] libomp: fix build by cl with vs2019

Replace VLA with dynamic allocation using alloca().
This fixes https://bugs.llvm.org/show_bug.cgi?id=48919.

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

(cherry picked from commit 7f5ad0e07162e0c19e569986ee37a17c147c9a27)

3 years ago[clangd] Parse Diagnostics block, and nest ClangTidy block under it.
Sam McCall [Mon, 25 Jan 2021 15:16:22 +0000 (16:16 +0100)]
[clangd] Parse Diagnostics block, and nest ClangTidy block under it.

(ClangTidy configuration block hasn't been in any release, so we should be OK
to move it around like this)

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

(cherry picked from commit c3df9d58c75e0f89ca95e947804d65e79a491adc)

3 years ago[clangd] Log warning when using legacy (theia) semantic highlighting.
Sam McCall [Wed, 20 Jan 2021 11:38:32 +0000 (12:38 +0100)]
[clangd] Log warning when using legacy (theia) semantic highlighting.

The legacy protocol will be removed on trunk after the 12 branch cut,
and gone in clangd 13.

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

(cherry picked from commit 29472bb76915c4929aecc938300f6df31f63ac29)

3 years agoclang: Fix static_assert in a few contexts in microsoft mode
Nico Weber [Wed, 27 Jan 2021 21:51:27 +0000 (16:51 -0500)]
clang: Fix static_assert in a few contexts in microsoft mode

Follow-up to D17444. Fixes PR48904. See bug for details.

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

(cherry picked from commit 764a7a2155c6747ec8d0b38d8edbb65960eae874)

3 years ago[clang-format] Avoid considering include directive as a template closer.
Marek Kurdej [Wed, 27 Jan 2021 08:14:22 +0000 (09:14 +0100)]
[clang-format] Avoid considering include directive as a template closer.

This fixes a bug [[ http://llvm.org/PR48891 | PR48891 ]] introduced in D93839 where:
```
#include <stdint.h>
namespace rep {}
```
got formatted as
```
#include <stdint.h>
namespace rep {
}
```

Reviewed By: MyDeveloperDay, leonardchan

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

(cherry picked from commit e3713f156b8cb65a2b74f150afb824ce1e2a2fab)

3 years agoworkflows: Update branch names
Tom Stellard [Thu, 28 Jan 2021 23:30:21 +0000 (15:30 -0800)]
workflows: Update branch names

Also remove main-brancy-sync workflow that was removed from the main branch.

3 years agoItanium Mangling: In 'enable_if', omit X/E around <expr-primary>.
James Y Knight [Sun, 24 Jan 2021 21:23:58 +0000 (16:23 -0500)]
Itanium Mangling: In 'enable_if', omit X/E around <expr-primary>.

The Clang enable_if extension is mangled as an <extended-qualifier>,
which is supposed to contain <template-args>. However, we were
unconditionally emitting X/E around its arguments, neglecting the fact
that <expr-primary> should be emitted directly without the surrounding
X/E.

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

(cherry picked from commit a7246ba02a8923f316419a62d836dbe1c0b437bd)

3 years agoItanium Mangling: Fix handling of <expr-primary> in <template-arg>.
James Y Knight [Sun, 24 Jan 2021 20:50:15 +0000 (15:50 -0500)]
Itanium Mangling: Fix handling of <expr-primary> in <template-arg>.

Previously, we were emitting an extraneous X .. E in <template-arg>
around an <expr-primary> if the template argument was constructed from
an expression (rather than an already-evaluated literal value).  In
such a case, we would then e.g. emit 'XLi0EE' instead of 'Li0E'.

We had one special-case for DeclRefExpr expressions, in particular, to
omit them the mangled-name without the surrounding X/E. However,
unfortunately, that special case also triggered for ParmVarDecl (a
subtype of VarDecl), and _incorrectly_ emitted 'L_Z .. E' instead of
the proper 'Xfp_E'.

This change causes mangleExpression itself to be responsible for
emitting X/E around non-primary expressions, which removes the
special-case, and corrects both these problems.

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

(cherry picked from commit 8ca33605ff0cfc536f5c6710fb5f6378bf11959a)

3 years agoItanium Mangling: Mangle `__alignof__` differently than `alignof`.
James Y Knight [Mon, 7 Dec 2020 15:26:49 +0000 (10:26 -0500)]
Itanium Mangling: Mangle `__alignof__` differently than `alignof`.

The two operations have acted differently since Clang 8, but were
unfortunately mangled the same. The new mangling uses new "vendor
extended expression" syntax proposed in
https://github.com/itanium-cxx-abi/cxx-abi/issues/112

GCC had the same mangling problem, https://gcc.gnu.org/PR88115, and
will hopefully be switching to the same mangling as implemented here.

Additionally, fix the mangling of `__uuidof` to use the new extension
syntax, instead of its previous nonstandard special-case.

Adjusts the demangler accordingly.

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

(cherry picked from commit 9c7aeaebb3ac1b94200b59b111742cb6b8f090c2)

3 years agoRevert "Suppress non-conforming GNU paste extension in all standard-conforming modes"
Reid Kleckner [Wed, 27 Jan 2021 18:59:28 +0000 (10:59 -0800)]
Revert "Suppress non-conforming GNU paste extension in all standard-conforming modes"

This reverts commit f4537935dcdbf390c863591cf556e76c3abab9c1.
This reverts commit b43c26d036dcbf7a6881f39e4434cf059364022a.

This GNU and MSVC extension turns out to be very popular. Most projects
are not using C++20, so cannot use the new __VA_OPT__ feature to be
standards conformant. The other workaround, using -std=gnu*, enables too
many language extensions and isn't viable.

Until there is a way for users to get the behavior provided by the
`, ## __VA_ARGS__` extension in the -std=c++17 and earlier language
modes, we need to revert this.

(cherry picked from commit 61a66e4b5ec18e9e73c2f6334f6b7f7dd4bca77e)

3 years ago[llvm-c] Move LLVMX86_AMXTypeKind & LLVMPoisonValueValueKind to the bottom to avoid...
Fangrui Song [Thu, 28 Jan 2021 00:28:04 +0000 (16:28 -0800)]
[llvm-c] Move LLVMX86_AMXTypeKind & LLVMPoisonValueValueKind to the bottom to avoid value changes compared with LLVM<=11

Fixes PR48905

(cherry picked from commit 6612c2bb68becda5504099b48082c844503c6d4c)

3 years ago[cxx_status] Mark P0732R2 as only 'partial', not 'Clang 12', as some of
Richard Smith [Thu, 28 Jan 2021 00:07:51 +0000 (16:07 -0800)]
[cxx_status] Mark P0732R2 as only 'partial', not 'Clang 12', as some of
the changes were reverted.

(cherry picked from commit 727fc31a9898dfb89610ca1bc05ff86204a77177)

3 years agoDon't allow __VA_OPT__ to be detected by #ifdef.
Richard Smith [Wed, 27 Jan 2021 21:14:02 +0000 (13:14 -0800)]
Don't allow __VA_OPT__ to be detected by #ifdef.

More study has discovered this to not actually be useful: because
current C++20 implementations reject `#ifdef __VA_OPT__`, this can't
really be used as a feature-test mechanism. And it's not too hard to
detect __VA_OPT__ without this, for example:

  #define THIRD_ARG(a, b, c, ...) c
  #define HAS_VA_OPT(...) THIRD_ARG(__VA_OPT__(,), 1, 0, )
  #if HAS_VA_OPT(?)

Partially reverts 0436ec2128c9775ba13b0308937238fc79673fdd.

(cherry picked from commit 5dfa37a76153f2a18ac7fe30721cc1332b672ea2)

3 years agoPermit __VA_OPT__ in all language modes and allow it to be detected with #ifdef.
Richard Smith [Wed, 27 Jan 2021 20:24:30 +0000 (12:24 -0800)]
Permit __VA_OPT__ in all language modes and allow it to be detected with #ifdef.

These changes are intended to give code a path to move away from the GNU
,##__VA_ARGS__ extension, which is non-conforming in some situations and
which we'd like to disable in our conforming mode in those cases.

(cherry picked from commit 0436ec2128c9775ba13b0308937238fc79673fdd)

3 years ago[clangd] Work around GCC bug 66735
Sam McCall [Wed, 27 Jan 2021 14:32:05 +0000 (15:32 +0100)]
[clangd] Work around GCC bug 66735

(cherry picked from commit 12de8e1399fecf691639ba430b3824acb1311e70)

3 years agoImport workflows from release/11.x branch
Tom Stellard [Wed, 27 Jan 2021 23:17:48 +0000 (15:17 -0800)]
Import workflows from release/11.x branch

3 years agoDrop the 'git' suffix from various version variables
Tom Stellard [Wed, 27 Jan 2021 23:21:13 +0000 (15:21 -0800)]
Drop the 'git' suffix from various version variables

3 years agoFrontend: Use early returns in CompilerInstance::clearOutputFiles, NFC
Duncan P. N. Exon Smith [Wed, 27 Jan 2021 03:27:32 +0000 (19:27 -0800)]
Frontend: Use early returns in CompilerInstance::clearOutputFiles, NFC

Use early returns in `CompilerInstance::clearOutputFiles` to clarify the
logic, and rename `ec` to `EC` as a drive-by.

No functionality change.

3 years agoRename clang/test/Frontend/output-{failures,paths}.c, NFC
Duncan P. N. Exon Smith [Wed, 27 Jan 2021 03:26:24 +0000 (19:26 -0800)]
Rename clang/test/Frontend/output-{failures,paths}.c, NFC

A follow up patch will add a few success cases here; rename it to
`output-paths.c` instead of `output-failures.c`.

3 years ago[gn build] Port bb9eb1982980
LLVM GN Syncbot [Wed, 27 Jan 2021 01:23:23 +0000 (01:23 +0000)]
[gn build] Port bb9eb1982980

3 years ago[OpenMP][NVPTX] Drop dependence on CUDA to build NVPTX `deviceRTLs`
Shilei Tian [Wed, 27 Jan 2021 01:21:27 +0000 (20:21 -0500)]
[OpenMP][NVPTX] Drop dependence on CUDA to build NVPTX `deviceRTLs`

With D94745, we no longer use CUDA SDK to compile `deviceRTLs`. Therefore,
many CMake code in the project is useless. This patch cleans up unnecessary code
and also drops the requirement to build NVPTX `deviceRTLs`. CUDA detection is
still being used however to determine whether we need to involve the tests. Auto
detection of compute capability is enabled by default and can be disabled by
setting CMake variable `LIBOMPTARGET_NVPTX_AUTODETECT_COMPUTE_CAPABILITY=OFF`.
If auto detection is enabled, and CUDA is also valid, it will only build the
bitcode library for the detected version; otherwise, all variants supported will
be generated. One drawback of this patch is, we now generate 96 variants of
bitcode library, and totally 1485 files to be built with a clean build on a
non-CUDA system. `LIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=""` can be used to
disable building NVPTX `deviceRTLs`.

Reviewed By: JonChesterfield

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

3 years ago[RISCV] Add rv64 run lines to rv32 MC layer tests for B extension
Craig Topper [Wed, 27 Jan 2021 01:03:21 +0000 (17:03 -0800)]
[RISCV] Add rv64 run lines to rv32 MC layer tests for B extension

Remove common instructions from rv64 tests since they are now
covered by the rv64 run lines in the rv32 tests.

Add rv32-only* tests for a few cases that aren't common between
r32 and rv64.

Addresses review feedback from D95150.

Reviewed By: frasercrmck

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

3 years agoSupport for instrumenting only selected files or functions
Petr Hosek [Fri, 15 Jan 2021 09:14:37 +0000 (01:14 -0800)]
Support for instrumenting only selected files or functions

This change implements support for applying profile instrumentation
only to selected files or functions. The implementation uses the
sanitizer special case list format to select which files and functions
to instrument, and relies on the new noprofile IR attribute to exclude
functions from instrumentation.

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

3 years ago[libc++] Give `MoveOnly` all six comparison operators, not just == and <.
Arthur O'Dwyer [Mon, 25 Jan 2021 22:00:14 +0000 (17:00 -0500)]
[libc++] Give `MoveOnly` all six comparison operators, not just == and <.

Split out of D93512.

3 years ago[OpenMP] Modify OMP_ALLOCATOR environment variable
Nawrin Sultana [Mon, 2 Nov 2020 22:17:37 +0000 (16:17 -0600)]
[OpenMP] Modify OMP_ALLOCATOR environment variable

This patch sets the def-allocator-var ICV based on the environment variables
provided in OMP_ALLOCATOR. Previously, only allowed value for OMP_ALLOCATOR
was a predefined memory allocator. OpenMP 5.1 specification allows predefined
memory allocator, predefined mem space, or predefined mem space with traits in
OMP_ALLOCATOR. If an allocator can not be created using the provided environment
variables, the def-allocator-var is set to omp_default_mem_alloc.

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

3 years ago[libomptarget][cuda] Handle missing _v2 symbols gracefully
Jon Chesterfield [Wed, 27 Jan 2021 00:22:28 +0000 (00:22 +0000)]
[libomptarget][cuda] Handle missing _v2 symbols gracefully

[libomptarget][cuda] Handle missing _v2 symbols gracefully

Follow on from D95367. Dlsym the _v2 symbols if present, otherwise use the
unsuffixed version. Builds a hashtable for the check, can revise for zero
heap allocations later if necessary.

Reviewed By: jdoerfert

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

3 years ago[gn build] fix get.py change
Nico Weber [Wed, 27 Jan 2021 00:20:23 +0000 (19:20 -0500)]
[gn build] fix get.py change

3 years ago[gn build] restore build command removed in 9595a7ff55b6 for platforms without prebuilts
Nico Weber [Wed, 27 Jan 2021 00:19:19 +0000 (19:19 -0500)]
[gn build] restore build command removed in 9595a7ff55b6 for platforms without prebuilts

3 years agoDisable rosegment for old Android versions.
Dan Albert [Wed, 27 Jan 2021 00:04:56 +0000 (16:04 -0800)]
Disable rosegment for old Android versions.

The unwinder used by the crash handler on versions of Android prior to
API 29 did not correctly handle binaries built with rosegment, which is
enabled by default for LLD. Android only supports LLD, so it's not an
issue that this flag is not accepted by other linkers.

Reviewed By: srhines

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

3 years agollvm-lib: Pull error printing code out of two functions
Nico Weber [Wed, 27 Jan 2021 00:11:56 +0000 (19:11 -0500)]
llvm-lib: Pull error printing code out of two functions

Slightly changes the output in error code, but no behavior change in
normal use. This is for preparation for using these two functions
elsewhere.

3 years ago[libomptarget][NFC] Avoid gcc 5/6 issue with lambda captures.
Vyacheslav Zakharin [Tue, 26 Jan 2021 22:45:40 +0000 (14:45 -0800)]
[libomptarget][NFC] Avoid gcc 5/6 issue with lambda captures.

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

3 years agoFrontend: Fix layering between create{,Default}OutputFile, NFC
Duncan P. N. Exon Smith [Sat, 21 Nov 2020 02:04:32 +0000 (18:04 -0800)]
Frontend: Fix layering between create{,Default}OutputFile, NFC

Fix layering between `CompilerInstance::createDefaultOutputFile` and the
two versions of `createOutputFile`.

- Add missing configuration flags to `createDefaultOutputFile` so that
  GeneratePCHAction and GenerateModuleFromModuleMapAction can use it.
  They previously promised that temporary files were turned on; now
  `createDefaultOutputFile` handles that logic.
- Lift the logic handling `InFile` and `Extension` to
  `createDefaultOutputFile`, since it's only the callers of that
  function that are using it.
- Rename the deeper of the two `createOutputFile`s to
  `createOutputFileImpl` and make it private to `CompilerInstance` (to
  prove that no one else is using it).
- Sink the logic for adding to `CompilerInstance::OutputFiles` down to
  `createOutputFileImpl`, allowing two "optional" (but always used)
  `std::string*` out parameters to be removed.
- Instead of passing a `std::error_code` out parameter into
  `createOutputFileImpl`, have it return `Expected<>`.
- As a drive-by, inline `CompilerInstance::addOutputFile` into its only
  caller, `createOutputFileImpl`.

Clean layering makes it easier for a future commit to extract
`createOutputFileImpl` out of `CompilerInstance`.

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

3 years ago[llc] Add reportError helper and canonicalize error messages
Fangrui Song [Tue, 26 Jan 2021 23:33:37 +0000 (15:33 -0800)]
[llc] Add reportError helper and canonicalize error messages

3 years agoFrontend: Simplify handling of non-seeking streams in CompilerInstance, NFC
Duncan P. N. Exon Smith [Tue, 15 Dec 2020 01:46:11 +0000 (17:46 -0800)]
Frontend: Simplify handling of non-seeking streams in CompilerInstance, NFC

Add a new `raw_pwrite_ostream` variant, `buffer_unique_ostream`, which
is like `buffer_ostream` but with unique ownership of the stream it's
wrapping. Use this in CompilerInstance to simplify the ownership of
non-seeking output streams, avoiding logic sprawled around to deal with
them specially.

This also simplifies future work to encapsulate output files in a
different class.

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

3 years ago[GlobalISel] Implement computeKnownBits for G_SEXT_INREG
Jessica Paquette [Tue, 26 Jan 2021 22:39:39 +0000 (14:39 -0800)]
[GlobalISel] Implement computeKnownBits for G_SEXT_INREG

Just use the existing `Known.sextInReg` implementation.

- Update KnownBitsTest.cpp.
- Update combine-redundant-and.mir for a more concrete example.

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

3 years agoSalvage debug info for function arguments in coro-split funclets.
Adrian Prantl [Tue, 26 Jan 2021 22:30:10 +0000 (14:30 -0800)]
Salvage debug info for function arguments in coro-split funclets.

This patch improves the availability for variables stored in the
coroutine frame by emitting an alloca to hold the pointer to the frame
object and rewriting dbg.declare intrinsics to point inside the frame
object using salvaged DIExpressions. Finally, a new alloca is created
in the funclet to hold the FramePtr pointer to ensure that it is
available throughout the entire function at -O0.

This path also effectively reverts D90772. The testcase updates
highlight nicely how every removed CHECK for a dbg.value is preceded
by a new CHECK for a dbg.declare.

Thanks to JunMa, Yifeng, and Bruno for their thoughtful reviews!

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

rdar://71866936

3 years agoFrontend: Fix memory leak in CompilerInstance::setVerboseOutputStream
Duncan P. N. Exon Smith [Sat, 21 Nov 2020 03:13:19 +0000 (19:13 -0800)]
Frontend: Fix memory leak in CompilerInstance::setVerboseOutputStream

Found this memory leak in `CompilerInstance::setVerboseOutputStream` by
inspection; it looks like this wasn't previously exercised, since it was
never called twice.

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