platform/upstream/llvm.git
2 years agoFix unused variable warning by embedding inside assertion
Simon Pilgrim [Thu, 24 Mar 2022 17:41:24 +0000 (17:41 +0000)]
Fix unused variable warning by embedding inside assertion

2 years ago[Support/BLAKE3] LLVM-specific changes over the original BLAKE3 C implementation
Argyrios Kyrtzidis [Thu, 24 Mar 2022 01:16:56 +0000 (18:16 -0700)]
[Support/BLAKE3] LLVM-specific changes over the original BLAKE3 C implementation

Changes from original BLAKE3 sources:

* `blake.h`:
    * Changes to avoid conflicts if a client also links with its own BLAKE3 version:
        * Renamed the header macro guard with `LLVM_C_` prefix
        * Renamed the C symbols to add the `llvm_` prefix
    * Added a top header comment that references the CC0 license and points to the `LICENSE` file in the repo.
* `blake3_impl.h`: Added `#define`s to remove some of `llvm_` prefixes for the rest of the internal implementation.
* Implementation files:
    * Added a top header comment for `blake.c`
    * Used `llvm_` prefix for the C public API functions
    * Used `LLVM_LIBRARY_VISIBILITY` for internal implementation functions
    * Added `.private_extern`/`.hidden` in assembly files to reduce visibility of the internal implementation functions
* `README.md`:
    * added a note about where the sources originated from
    * Used the C++ BLAKE3 class and `llvm_` prefixed C API in place of examples and API documentation.
    * Removed instructions about how to build the files.

2 years ago[Support] Introduce the BLAKE3 hashing function implementation
Argyrios Kyrtzidis [Sat, 12 Mar 2022 01:32:27 +0000 (17:32 -0800)]
[Support] Introduce the BLAKE3 hashing function implementation

BLAKE3 is a cryptographic hash function that is secure and very performant.
The C implementation originates from https://github.com/BLAKE3-team/BLAKE3/tree/1.3.1/c
License is at https://github.com/BLAKE3-team/BLAKE3/blob/1.3.1/LICENSE

This patch adds:

* `llvm/include/llvm-c/blake3.h`: The BLAKE3 C API
* `llvm/include/llvm/Support/BLAKE3.h`: C++ wrapper of the C API
* `llvm/lib/Support/BLAKE3`: Directory containing the BLAKE3 C implementation files, including the `LICENSE` file
* `llvm/unittests/Support/BLAKE3Test.cpp`: unit tests for the BLAKE3 C++ wrapper

This initial patch contains the pristine BLAKE3 sources, a follow-up patch will introduce
LLVM-specific prefixes to avoid conflicts if a client also links with its own BLAKE3 version.

And here's some timings comparing BLAKE3 with LLVM's SHA1/SHA256/MD5.
Timings include `AVX512`, `AVX2`, `neon`, and the generic/portable implementations.
The table shows the speed-up multiplier of BLAKE3 for hashing 100 MBs:

|        Processor        | SHA1  | SHA256 |  MD5 |
|-------------------------|-------|--------|------|
| Intel Xeon W (AVX512)   | 10.4x |   27x  | 9.4x |
| Intel Xeon W (AVX2)     | 6.5x  |   17x  | 5.9x |
| Intel Xeon W (portable) | 1.3x  |  3.3x  | 1.1x |
|      M1Pro (neon)       | 2.1x  |  4.7x  | 2.8x |
|      M1Pro (portable)   | 1.1x  |  2.4x  | 1.5x |

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

2 years ago[mlir][OpenMP][IRBuilder] Add support for nowait on single construct
Shraiysh Vaishay [Thu, 24 Mar 2022 16:46:43 +0000 (22:16 +0530)]
[mlir][OpenMP][IRBuilder] Add support for nowait on single construct

This patch adds the nowait parameter to `createSingle` in
OpenMPIRBuilder and handling for IR generation from OpenMP Dialect.

Also added tests for the same.

Reviewed By: ftynse

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

2 years ago[X86] Add additional 'add/sub single bit' patterns
Simon Pilgrim [Thu, 24 Mar 2022 17:16:46 +0000 (17:16 +0000)]
[X86] Add additional 'add/sub single bit' patterns

InstCombine can convert some cases to 'splat bit' sra(shl(x,y),bw-1) patterns which we need to handle as well

2 years ago[libc][obvious] only test FILE on working platforms
Michael Jones [Thu, 24 Mar 2022 00:00:45 +0000 (17:00 -0700)]
[libc][obvious] only test FILE on working platforms

The main code for the FILE struct is only enabled on platforms that it
works on, but before this patch the tests were included unconditionally.

Reviewed By: sivachandra, lntue

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

2 years ago[libc++] Audit all uses of _LIBCPP_ASSERT and _LIBCPP_DEBUG_ASSERT
Louis Dionne [Thu, 24 Mar 2022 13:03:56 +0000 (09:03 -0400)]
[libc++] Audit all uses of _LIBCPP_ASSERT and _LIBCPP_DEBUG_ASSERT

I audited all uses of _LIBCPP_ASSERT to make sure that we only used it
for "basic assertions", i.e. assertions with constant-time conditions.
I also audited all uses of _LIBCPP_DEBUG_ASSERT to make sure we used it
only for debug-mode assertions, and in one case had to change for
_LIBCPP_ASSERT instead.

As a fly-by, I also changed a couple of tests against nullptr or 0 to
be more explicit.

After this patch, all uses of _LIBCPP_ASSERT should be with constant-time
conditions, and all uses of _LIBCPP_DEBUG_ASSERT should be with conditions
that we only want to check when the debug mode is enabled.

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

2 years ago[LLDB] Cleanup for Fixing DWARFExpression handling of ValueType::FileAddress case...
Shafik Yaghmour [Thu, 24 Mar 2022 16:58:58 +0000 (09:58 -0700)]
[LLDB] Cleanup for Fixing DWARFExpression handling of ValueType::FileAddress case for DW_OP_deref_size

Late review on https://reviews.llvm.org/D121408 spotted some nice quick clean-ups on this code.

2 years ago[polly] Remove last instances of -analyze
Arthur Eubanks [Tue, 22 Mar 2022 00:41:06 +0000 (17:41 -0700)]
[polly] Remove last instances of -analyze

As mentioned in D120782, the loop block order can be different depending
on if LoopInfo is incrementally updated or freshly computed.

Reviewed By: Meinersbur

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

2 years ago[TSan] Add a runtime flag to print full thread creation stacks up to the main thread
Dmitry Vyukov [Thu, 24 Mar 2022 16:07:32 +0000 (17:07 +0100)]
[TSan] Add a runtime flag to print full thread creation stacks up to the main thread

Currently, we only print how threads involved in data race are created from their parent threads.
Add a runtime flag 'print_full_thread_history' to print thread creation stacks for the threads involved in the data race and their ancestors up to the main thread.

Reviewed By: dvyukov

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

2 years ago[OpenMP] Initial parsing/sema for the 'omp target parallel loop' construct
Mike Rice [Wed, 23 Mar 2022 22:37:06 +0000 (15:37 -0700)]
[OpenMP] Initial parsing/sema for the 'omp target parallel loop' construct

 Adds basic parsing/sema/serialization support for the
 #pragma omp target parallel loop directive.

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

2 years ago[AArch64] Async unwind - function prologues
Momchil Velikov [Thu, 24 Mar 2022 15:27:04 +0000 (15:27 +0000)]
[AArch64] Async unwind - function prologues

Re-commit of 32e8b550e5439c7e4aafa73894faffd5f25d0d05

This patch rearranges emission of CFI instructions, so the resulting
DWARF and `.eh_frame` information is precise at every instruction.

The current state is that the unwind info is emitted only after the
function prologue. This is fine for synchronous (e.g. C++) exceptions,
but the information is generally incorrect when the program counter is
at an instruction in the prologue or the epilogue, for example:

```
stp x29, x30, [sp, #-16]!           // 16-byte Folded Spill
mov x29, sp
.cfi_def_cfa w29, 16
...
```

after the `stp` is executed the (initial) rule for the CFA still says
the CFA is in the `sp`, even though it's already offset by 16 bytes

A correct unwind info could look like:
```
stp x29, x30, [sp, #-16]!           // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
.cfi_def_cfa w29, 16
...
```

Having this information precise up to an instruction is useful for
sampling profilers that would like to get a stack backtrace. The end
goal (towards this patch is just a step) is to have fully working
`-fasynchronous-unwind-tables`.

Reviewed By: danielkiss, MaskRay

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

2 years ago[flang[OpenACC] Lower wait directive
Valentin Clement [Thu, 24 Mar 2022 16:15:00 +0000 (17:15 +0100)]
[flang[OpenACC] Lower wait directive

This patch adds lowering for the `!$acc wait` directive
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

2 years ago[SelectionDAG] Add AssertAlign to AddNodeIDCustom so that it will CSE properly.
Craig Topper [Thu, 24 Mar 2022 15:59:00 +0000 (08:59 -0700)]
[SelectionDAG] Add AssertAlign to AddNodeIDCustom so that it will CSE properly.

The alignment needs to be part of the folding set hash. This is
handled by getAssertAlign when nodes are created, but needs to repeated here.

No test case as I found it as part of a very early experimental patch.

Reviewed By: spatel

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

2 years ago[llvm] Initialize and move UseUpRegs outside of `union` MemOp struct.
Alexander Belyaev [Thu, 24 Mar 2022 15:29:21 +0000 (16:29 +0100)]
[llvm] Initialize and move UseUpRegs outside of `union` MemOp struct.

Asan complained about uninitialized bool

`invalid-bool-load`
llvm/lib/Target/X86/AsmParser/X86Operand.h:389:12: runtime error: load
of value 171, which is not a valid value for type 'bool'

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

2 years agoDiagnose use of a naked attribute on a member function in ms-mode
Aaron Ballman [Thu, 24 Mar 2022 15:51:31 +0000 (11:51 -0400)]
Diagnose use of a naked attribute on a member function in ms-mode

This matches the behavior of cl.exe.

2 years agoReland "[ELF] Enable new passmanager plugin support for LTO"
Jakob Koschel [Thu, 24 Mar 2022 06:52:16 +0000 (07:52 +0100)]
Reland "[ELF] Enable new passmanager plugin support for LTO"

This is the orignal patch + a check that LLVM_BUILD_EXAMPLES is enabled before
adding a dependency on the 'Bye' example pass.

Original summary:

Add cli options for new passmanager plugin support to lld.

Currently it is not possible to load dynamic NewPM plugins with lld. This is an
incremental update to D76866. While that patch only added cli options for
llvm-lto2, this adds them for lld as well. This is especially useful for running
dynamic plugins on the linux kernel with LTO.

Reviewed By: MaskRay

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

2 years ago[VPlan] Add VPWidenPointerInductionRecipe.
Florian Hahn [Thu, 24 Mar 2022 14:58:23 +0000 (14:58 +0000)]
[VPlan] Add VPWidenPointerInductionRecipe.

This patch moves pointer induction handling from VPWidenPHIRecipe to its
own recipe. In the process, it adds all information required to generate
code for pointer inductions without relying on Legal to access the list
of induction phis.

Alternatively VPWidenPHIRecipe could also take an optional pointer to InductionDescriptor.

Reviewed By: Ayal

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

2 years agoFix a crash with variably-modified parameter types in a naked function
Aaron Ballman [Thu, 24 Mar 2022 14:38:37 +0000 (10:38 -0400)]
Fix a crash with variably-modified parameter types in a naked function

Naked functions have no prolog, so it's not valid to emit prolog code
to evaluate the variably-modified type. This fixes Issue 50541.

2 years ago[flang[OpenACC] Lower data directive
Valentin Clement [Thu, 24 Mar 2022 14:29:59 +0000 (15:29 +0100)]
[flang[OpenACC] Lower data directive

This patch adds lowering for the `!$acc data`
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D122384

Reviewed By: PeteSteinfeld

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

2 years ago[InstCombine] merge shuffled vector negate and multiply
Sanjay Patel [Thu, 24 Mar 2022 14:01:41 +0000 (10:01 -0400)]
[InstCombine] merge shuffled vector negate and multiply

Add the "(0 - X) --> (X * -1)" reverse identity to the list of alternate form binops.

We need a little hack to make the existing logic work because it does not expect to
move constants from op0 to op1, but the code comment hopefully makes that clear.
I don't think there are any other identities like that.

Fixes #54364

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

2 years ago[libc++][NFC] Refactor the ABI changelog
Louis Dionne [Thu, 24 Mar 2022 14:00:23 +0000 (10:00 -0400)]
[libc++][NFC] Refactor the ABI changelog

Add missing commit SHAs in a few cases, and use "All Platforms" when
the change affected all platforms instead of explicitly listing the
platforms, since there's too many to list exhaustively.

2 years ago[clangd] Retain main file fixes attached to diags from preamble
Kadir Cetinkaya [Wed, 23 Mar 2022 14:22:47 +0000 (15:22 +0100)]
[clangd] Retain main file fixes attached to diags from preamble

Clangd ignores fixits if the diagnsotics is outside the main file (e.g.
a note on a declaration from a header), but the fix might still be inside the
main file (e.g. change the function call).

This patch changes the logic to retain fixes that touch main file, if the
diagnostic owning them is still inside main file, even if they are attached to a
note outside the main file.

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

2 years ago[flang][OpenACC] Lower update directive
Valentin Clement [Thu, 24 Mar 2022 14:18:29 +0000 (15:18 +0100)]
[flang][OpenACC] Lower update directive

This patch adds lowering for the `!$acc update`
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D122387

Reviewed By: PeteSteinfeld

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

2 years ago[flang][OpenACC] Lower init/shutdown directive
Valentin Clement [Thu, 24 Mar 2022 14:16:46 +0000 (15:16 +0100)]
[flang][OpenACC] Lower init/shutdown directive

This patch adds lowering for the `!$acc init` and `!$acc shutdown`
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D122384

Reviewed By: PeteSteinfeld

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

2 years ago[flang][OpenACC] Lower exit data directive
Valentin Clement [Thu, 24 Mar 2022 14:15:40 +0000 (15:15 +0100)]
[flang][OpenACC] Lower exit data directive

This patch adds lowering for the `!$acc exit data` directive
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D122384

Reviewed By: PeteSteinfeld

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

2 years ago[flang][OpenACC] Lower enter data directive
Valentin Clement [Thu, 24 Mar 2022 14:00:52 +0000 (15:00 +0100)]
[flang][OpenACC] Lower enter data directive

This patch adds lowering for the `!$acc enter data` directive
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

2 years ago[flang][NFC] Add lowering test for array expression
Valentin Clement [Thu, 24 Mar 2022 13:58:27 +0000 (14:58 +0100)]
[flang][NFC] Add lowering test for array expression

This patches adds lowering tests for some array
expressions use cases.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[libc++][NFC] Update ABI changelog to account for new assertion handler
Louis Dionne [Thu, 24 Mar 2022 13:57:28 +0000 (09:57 -0400)]
[libc++][NFC] Update ABI changelog to account for new assertion handler

2 years ago[OpenCL] opencl-c.h: remove x/y/z arg names
Sven van Haastregt [Thu, 24 Mar 2022 13:55:41 +0000 (13:55 +0000)]
[OpenCL] opencl-c.h: remove x/y/z arg names

This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" the identifiers "x", "y" and
"z".

Continues the direction set out in D119560.

2 years ago[gn build] Port 62d5f254ccd0
LLVM GN Syncbot [Thu, 24 Mar 2022 13:50:02 +0000 (13:50 +0000)]
[gn build] Port 62d5f254ccd0

2 years ago[pseudo] Introduce parse forest.
Haojian Wu [Mon, 21 Mar 2022 14:32:15 +0000 (15:32 +0100)]
[pseudo] Introduce parse forest.

Parse forest is the output of the GLR parser, it is a tree-like DAG
which presents all possible parse trees without duplicating subparse structures.

This is a patch split from https://reviews.llvm.org/D121150.

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

2 years agoNFC: [LICM] Update some stale comments
Djordje Todorovic [Wed, 23 Mar 2022 15:00:03 +0000 (16:00 +0100)]
NFC: [LICM] Update some stale comments

After removing the MaybePromotable, some comments
became stale. This improves them.

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

2 years ago[pseudo] Sort nonterminals based on their reduction order.
Haojian Wu [Wed, 23 Mar 2022 10:38:49 +0000 (11:38 +0100)]
[pseudo] Sort nonterminals based on their reduction order.

Reductions need to be performed in a careful order in GLR parser, to
make sure we gather all alternatives before creating an ambigous forest
node.

This patch encodes the nonterminal order into the rule id, so that we
can efficiently to determinal ordering of reductions in GLR parser.

This patch also abstracts to a TestGrammar, which is shared among tests.

This is a part of the GLR parser, https://reviews.llvm.org/D121368,
https://reviews.llvm.org/D121150

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

2 years ago[NFC] Format and uglify PowerPC intrinsics headers
Qiu Chaofan [Thu, 24 Mar 2022 12:46:35 +0000 (20:46 +0800)]
[NFC] Format and uglify PowerPC intrinsics headers

This change formats PowerPC intrinsics wrapper headers into LLVM style,
and add extra prefix '__' to all variables to prevent conflict with user
code.

2 years ago[gn build] remove a "from __future__" import not needed after 0ff3cc2087b9
Nico Weber [Thu, 24 Mar 2022 13:07:46 +0000 (09:07 -0400)]
[gn build] remove a "from __future__" import not needed after 0ff3cc2087b9

2 years ago[SLP][NFC]Fix param name in comments, NFC.
Alexey Bataev [Thu, 24 Mar 2022 12:48:35 +0000 (05:48 -0700)]
[SLP][NFC]Fix param name in comments, NFC.

2 years ago[clang] Reformat
Nathan Sidwell [Wed, 23 Mar 2022 14:27:43 +0000 (07:27 -0700)]
[clang] Reformat

Reformat some misindentation that is coincidentally close to a piece
being worked on.

Reviewed By: dblaikie

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

2 years agoTypo fix in the documentation; NFC
Aaron Ballman [Thu, 24 Mar 2022 12:55:43 +0000 (08:55 -0400)]
Typo fix in the documentation; NFC

2 years ago[compiler-rt] [cmake] Fix a typo in a variable name
Martin Storsjö [Thu, 24 Mar 2022 11:05:30 +0000 (13:05 +0200)]
[compiler-rt] [cmake] Fix a typo in a variable name

There's no other references to this variable name, but other files
refer to the same with the same name but with double Fs.

2 years ago[trace][intelpt] Server side changes for TSC to wall time conversion
Jakob Johnson [Tue, 22 Mar 2022 13:15:56 +0000 (06:15 -0700)]
[trace][intelpt] Server side changes for TSC to wall time conversion

Update the response schema of the TraceGetState packet and add
Intel PT specific response structure that contains the TSC conversion,
if it exists. The IntelPTCollector loads the TSC conversion and caches
it to prevent unnecessary calls to perf_event_open. Move the TSC conversion
calculation from Perf.h to TraceIntelPTGDBRemotePackets.h to remove
dependency on Linux specific headers.

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

2 years ago[gn build] Port 406bde9a1513
LLVM GN Syncbot [Thu, 24 Mar 2022 12:12:11 +0000 (12:12 +0000)]
[gn build] Port 406bde9a1513

2 years ago[lldb] Avoid pointer element type accesses
Nikita Popov [Thu, 24 Mar 2022 12:07:24 +0000 (13:07 +0100)]
[lldb] Avoid pointer element type accesses

2 years ago[PowerPC] [Clang] Add SSE4 and BMI intrinsics implementation
Qiu Chaofan [Thu, 24 Mar 2022 12:03:08 +0000 (20:03 +0800)]
[PowerPC] [Clang] Add SSE4 and BMI intrinsics implementation

Reviewed By: jsji

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

2 years ago[lldb] Use byval type
Nikita Popov [Thu, 24 Mar 2022 11:55:42 +0000 (12:55 +0100)]
[lldb] Use byval type

Query byval type instead of pointer element type.

2 years ago[lldb] Remove unused Module argument (NFC)
Nikita Popov [Thu, 24 Mar 2022 11:53:02 +0000 (12:53 +0100)]
[lldb] Remove unused Module argument (NFC)

2 years ago[Docs] Update opaque pointers transition state (NFC)
Nikita Popov [Thu, 24 Mar 2022 10:51:04 +0000 (11:51 +0100)]
[Docs] Update opaque pointers transition state (NFC)

Opaque pointer support in Clang is now complete.

2 years ago[X86][NFC] Remove unused variable introduce by D121785
Shengchen Kan [Thu, 24 Mar 2022 10:46:59 +0000 (18:46 +0800)]
[X86][NFC] Remove unused variable introduce by D121785

2 years ago[mlir][linalg] Support padding LinalgOps in use-def chain.
gysit [Thu, 24 Mar 2022 10:28:20 +0000 (10:28 +0000)]
[mlir][linalg] Support padding LinalgOps in use-def chain.

Previously, only LinalgOps whose operands are defined by an ExtractSliceOp could be padded. The revision supports walking a use-def chain of LinalgOps to find an ExtractSliceOp.

Reviewed By: hanchung

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

2 years ago[NFC] Mark derived destructors as `override`
Antonio Frighetto [Thu, 24 Mar 2022 10:42:47 +0000 (11:42 +0100)]
[NFC] Mark derived destructors as `override`

Derived destructors can be marked as override, in order to prevent
possible compilation failures of projects depending on those
headers (when compiled with flags -Wall, -Wsuggest-destructor-override,
-Winconsistent-missing-destructor-override).

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

2 years ago[mlir][linalg] Do not fuse shape-only producers.
gysit [Thu, 24 Mar 2022 10:22:28 +0000 (10:22 +0000)]
[mlir][linalg] Do not fuse shape-only producers.

This revision introduces a heuristic to stop fusion for shape-only tensors. A shape-only tensor only defines the shape of the consumer computation while the data is not used. Pure producer consumer fusion thus shall not fuse the producer of a shape-only tensor. In particular, since the shape-only tensor will have other uses that actually consume the data.

The revision enables fusion for consumers that have two uses of the same tensor. One as input operand and one as shape-only output operand. In these cases, we want to fuse only the input operand and avoid output fusion via iteration argument.

Reviewed By: hanchung

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

2 years ago[AArch64] Lower 3 and 4 sources buildvectors to TBL
David Green [Thu, 24 Mar 2022 10:02:33 +0000 (10:02 +0000)]
[AArch64] Lower 3 and 4 sources buildvectors to TBL

The default expansion for buildvectors is to extract each element and
insert them into a new vector. That involves a lot of copying to/from
the GPR registers. TLB3 and TLB4 can be relatively slow instructions
with the mask needing to be loaded from a constant pool, but they should
always be better than all the moves to/from GPRs.

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

2 years ago[bazel] glob LLVMCoroutines headers to make the build rule less fragile
Benjamin Kramer [Thu, 24 Mar 2022 10:01:08 +0000 (11:01 +0100)]
[bazel] glob LLVMCoroutines headers to make the build rule less fragile

2 years ago[bazel] Set the default of LLVM_UNREACHABLE_OPTIMIZE to 1
Benjamin Kramer [Thu, 24 Mar 2022 09:55:02 +0000 (10:55 +0100)]
[bazel] Set the default of LLVM_UNREACHABLE_OPTIMIZE to 1

This matches the CMake default. LLVM_UNREACHABLE_OPTIMIZE=0 doesn't
build with gcc

2 years ago[CodeGen] Define ABI breaking class members correctly
Daniil Kovalev [Thu, 24 Mar 2022 09:42:59 +0000 (12:42 +0300)]
[CodeGen] Define ABI breaking class members correctly

Non-static class members declared under #ifndef NDEBUG should be declared
under #if LLVM_ENABLE_ABI_BREAKING_CHECKS to make headers library-friendly and
allow cross-linking, as discussed in D120714.

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

2 years ago[NVPTX] Enhance vectorization of ld.param & st.param
Daniil Kovalev [Thu, 24 Mar 2022 09:34:25 +0000 (12:34 +0300)]
[NVPTX] Enhance vectorization of ld.param & st.param

Since function parameters and return values are passed via param space, we
can force special alignment for values hold in it which will add vectorization
options. This change may be done if the function has private or internal
linkage. Special alignment is forced during 2 phases.

1) Instruction selection lowering. Here we use special alignment for function
   prototypes (changing both own return value and parameters alignment), call
   lowering (changing both callee's return value and parameters alignment).

2) IR pass nvptx-lower-args. Here we change alignment of byval parameters that
   belong to param space (or are casted to it). We only handle cases when all
   uses of such parameters are loads from it. For such loads, we can change the
   alignment according to special type alignment and the load offset. Then,
   load-store-vectorizer IR pass will perform vectorization where alignment
   allows it.

Special alignment calculated as maximum from default ABI type alignment and
alignment 16. Alignment 16 is chosen because it's the maximum size of
vectorized ld.param & st.param.

Before specifying such special alignment, we should check if it is a multiple
of the alignment that the type already has. For example, if a value has an
enforced alignment of 64, default ABI alignment of 4 and special alignment
of 16, we should preserve 64.

This patch will be followed by a refactoring patch that removes duplicating
code in handling byval and non-byval arguments.

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

2 years agoRelands "[Clang] -Wunused-but-set-variable warning - handle also pre/post unary opera...
Dávid Bolvanský [Thu, 24 Mar 2022 09:32:57 +0000 (10:32 +0100)]
Relands "[Clang] -Wunused-but-set-variable warning - handle also pre/post unary operators"

2 years agoRevert "[NVPTX] Enhance vectorization of ld.param & st.param"
Daniil Kovalev [Thu, 24 Mar 2022 09:30:28 +0000 (12:30 +0300)]
Revert "[NVPTX] Enhance vectorization of ld.param & st.param"

This reverts commit f854434f0f2a01027bdaad8e6fdac5a782fce291.

Placed URL to wrong differential revision in commit message.

2 years ago[NFCI] Fix set-but-unused warning in X86DisassemblerTables.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 09:31:11 +0000 (10:31 +0100)]
[NFCI] Fix set-but-unused warning in X86DisassemblerTables.cpp

2 years ago[NVPTX] Enhance vectorization of ld.param & st.param
Daniil Kovalev [Thu, 24 Mar 2022 08:57:37 +0000 (11:57 +0300)]
[NVPTX] Enhance vectorization of ld.param & st.param

Since function parameters and return values are passed via param space, we
can force special alignment for values hold in it which will add vectorization
options. This change may be done if the function has private or internal
linkage. Special alignment is forced during 2 phases.

1) Instruction selection lowering. Here we use special alignment for function
   prototypes (changing both own return value and parameters alignment), call
   lowering (changing both callee's return value and parameters alignment).

2) IR pass nvptx-lower-args. Here we change alignment of byval parameters that
   belong to param space (or are casted to it). We only handle cases when all
   uses of such parameters are loads from it. For such loads, we can change the
   alignment according to special type alignment and the load offset. Then,
   load-store-vectorizer IR pass will perform vectorization where alignment
   allows it.

Special alignment calculated as maximum from default ABI type alignment and
alignment 16. Alignment 16 is chosen because it's the maximum size of
vectorized ld.param & st.param.

Before specifying such special alignment, we should check if it is a multiple
of the alignment that the type already has. For example, if a value has an
enforced alignment of 64, default ABI alignment of 4 and special alignment
of 16, we should preserve 64.

This patch will be followed by a refactoring patch that removes duplicating
code in handling byval and non-byval arguments.

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

2 years agoRevert "[clang-format] Correctly recognize arrays in template parameter list."
Krasimir Georgiev [Thu, 24 Mar 2022 09:14:13 +0000 (10:14 +0100)]
Revert "[clang-format] Correctly recognize arrays in template parameter list."

This reverts commit 126b37a713dc1c67cbc7dc8b5288b2f907c906a9.

Regressed some ObjC patterns, see comments on https://reviews.llvm.org/D121584.

2 years ago[Clang] Add option to set alternative toolchain path
Qiu Chaofan [Thu, 24 Mar 2022 08:58:58 +0000 (16:58 +0800)]
[Clang] Add option to set alternative toolchain path

In some cases, we need to set alternative toolchain path other than the
default with system (headers, libraries, dynamic linker prefix, ld path,
etc.), e.g., to pick up newer components, but keep sysroot at the same
time (to pick up extra packages).

This change introduces a new option --overlay-platform-toolchain to set
up such alternative toolchain path.

Reviewed By: hubert.reinterpretcast

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

2 years agoRevert "[ELF] Enable new passmanager plugin support for LTO"
Raphael Isemann [Thu, 24 Mar 2022 08:56:51 +0000 (09:56 +0100)]
Revert "[ELF] Enable new passmanager plugin support for LTO"

This reverts commit 32012eb11b235e1560a253664095676ea8ebd027.

Broke CMake configuration.

2 years agoUpdate my office hours
Kristof Beyls [Thu, 24 Mar 2022 08:55:32 +0000 (09:55 +0100)]
Update my office hours

Adding LLVM security group as another topic I can talk about.

2 years ago[AArch64] Make some methods static. NFC
David Green [Thu, 24 Mar 2022 08:55:27 +0000 (08:55 +0000)]
[AArch64] Make some methods static. NFC

2 years ago[NFC][flang] Remove unused code in lowerExplicitLowerBounds
Peixin-Qiao [Thu, 24 Mar 2022 08:50:20 +0000 (16:50 +0800)]
[NFC][flang] Remove unused code in lowerExplicitLowerBounds

There is no need to lower the implicit lower bounds for assumed-shape
array in lowerExplicitLowerBounds. Remove the unused code.

Reviewed By: Jean Perier

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

2 years ago[clang-cl] Ignore /Wv and /Wv:17 flags
Tobias Hieta [Wed, 23 Mar 2022 09:21:36 +0000 (10:21 +0100)]
[clang-cl] Ignore /Wv and /Wv:17 flags

MSVC supports passing /Wv and /Wv:17 to ignore warnings added
since that version. Clang doesn't have a option like this - but
we can ignore this flag instead of error.

MSVC documentation: https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level

Reviewed By: hans, mstorsjo

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

2 years ago[flang] UBOUND() edge case: empty dimension
Jean Perier [Thu, 24 Mar 2022 08:06:59 +0000 (09:06 +0100)]
[flang] UBOUND() edge case: empty dimension

Similarly to LBOUND in https://reviews.llvm.org/D121488, UBOUND must
return zero for an empty dimension, no matter the specification
expression.

Add a GetUBOUND method to be used in expression rewrite that prevents
folding UBOUND to a bound specification expression if the extent is
not a compile time constant.

Fold the case where the extents is known to be zero (and also deal with
this case in LBOUND since we can and should to comply with constant
expression requirements).

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

2 years ago[flang][OpenMP] Added lowering support for sections construct
Nimish Mishra [Thu, 24 Mar 2022 07:57:19 +0000 (13:27 +0530)]
[flang][OpenMP] Added lowering support for sections construct

This patch adds lowering support (from PFT to FIR) for sections construct

Reviewed By: kiranchandramohan

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

2 years ago[NFCI] Fix set-but-unused warning in SPIRVUtilsGen.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 07:53:42 +0000 (08:53 +0100)]
[NFCI] Fix set-but-unused warning in SPIRVUtilsGen.cpp

2 years ago[NFCI] Fix set-but-unused warning in InstCombineAddSub.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 07:33:29 +0000 (08:33 +0100)]
[NFCI] Fix set-but-unused warning in InstCombineAddSub.cpp

2 years ago[NFCI] Fix set-but-unused warning in RISCVAsmParser.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 07:17:14 +0000 (08:17 +0100)]
[NFCI] Fix set-but-unused warning in RISCVAsmParser.cpp

2 years ago[NFCI] Fix set-but-unused warning in X86LoadValueInjectionLoadHardening.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 07:15:27 +0000 (08:15 +0100)]
[NFCI] Fix set-but-unused warning in X86LoadValueInjectionLoadHardening.cpp

2 years ago[RISCV] Add patterns for vector widening integer multiply
jacquesguan [Sat, 15 Jan 2022 06:28:37 +0000 (14:28 +0800)]
[RISCV] Add patterns for vector widening integer multiply

Add patterns for vector widening integer multiply instructions

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

2 years ago[NFCI] Fix set-but-unused warning in UnwrappedLineParser.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 07:00:19 +0000 (08:00 +0100)]
[NFCI] Fix set-but-unused warning in UnwrappedLineParser.cpp

2 years ago[NFCI] Fix set-but-unused warning in GlobalsStream.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 06:58:11 +0000 (07:58 +0100)]
[NFCI] Fix set-but-unused warning in GlobalsStream.cpp

2 years ago[NFCI] Fix set-but-unused warning in AddressSanitizer.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 06:56:03 +0000 (07:56 +0100)]
[NFCI] Fix set-but-unused warning in AddressSanitizer.cpp

2 years ago[NFCI] Fix set-but-unused warning in X86AsmBackend.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 06:52:19 +0000 (07:52 +0100)]
[NFCI] Fix set-but-unused warning in X86AsmBackend.cpp

2 years ago[NFCI] Fix set-but-unused warning in ClangAttrEmitter.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 06:50:57 +0000 (07:50 +0100)]
[NFCI] Fix set-but-unused warning in ClangAttrEmitter.cpp

2 years ago[clang][parse] Move source range into ParsedAttibutesView
Timm Bäder [Tue, 22 Mar 2022 08:27:27 +0000 (09:27 +0100)]
[clang][parse] Move source range into ParsedAttibutesView

Move the SourceRange from the old ParsedAttributesWithRange into
ParsedAttributesView, so we have source range information available
everywhere we use attributes.

This also removes ParsedAttributesWithRange (replaced by simply using
ParsedAttributes) and ParsedAttributesVieWithRange (replaced by using
ParsedAttributesView).

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

2 years ago[ELF] Enable new passmanager plugin support for LTO
Jakob Koschel [Thu, 24 Mar 2022 06:52:16 +0000 (07:52 +0100)]
[ELF] Enable new passmanager plugin support for LTO

Add cli options for new passmanager plugin support to lld.

Currently it is not possible to load dynamic NewPM plugins with lld. This is an
incremental update to D76866. While that patch only added cli options for
llvm-lto2, this adds them for lld as well. This is especially useful for running
dynamic plugins on the linux kernel with LTO.

Reviewed By: MaskRay

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

2 years ago[libc] Use real objects and archives in integration tests.
Siva Chandra Reddy [Thu, 24 Mar 2022 06:58:46 +0000 (06:58 +0000)]
[libc] Use real objects and archives in integration tests.

Previously, we used empty, non-ELF crti.o, crtn.o, libm.a and libc++.a
files. Instead, we now still use dummies but they are real ELF object
files and archives.

2 years ago[mlir][linalg] Create AffineMinOp map in canoncial form.
gysit [Thu, 24 Mar 2022 06:55:43 +0000 (06:55 +0000)]
[mlir][linalg] Create AffineMinOp map in canoncial form.

Create the AffineMinOp used to compute the padding width in canonical form and update the tests.

Reviewed By: springerm

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

2 years ago[NFCI] Fix set-but-unused warning in CGOpenMPRuntime.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 06:49:21 +0000 (07:49 +0100)]
[NFCI] Fix set-but-unused warning in CGOpenMPRuntime.cpp

2 years ago[NFCI] Fix set-but-unused warning in ExprConstant.cpp
Dávid Bolvanský [Thu, 24 Mar 2022 06:47:50 +0000 (07:47 +0100)]
[NFCI] Fix set-but-unused warning in ExprConstant.cpp

2 years agoRevert "[Clang] -Wunused-but-set-variable warning - handle also pre/post unary operators"
Dávid Bolvanský [Thu, 24 Mar 2022 06:43:24 +0000 (07:43 +0100)]
Revert "[Clang] -Wunused-but-set-variable warning - handle also pre/post unary operators"

This reverts commit 460fc440ad8d41ca2e3882987512989b1c188fbe.

2 years ago[flang] Single construct translation from PFT to FIR
Shraiysh Vaishay [Thu, 24 Mar 2022 06:16:09 +0000 (11:46 +0530)]
[flang] Single construct translation from PFT to FIR

This patch adds translation for single construct along with nowait
clause from PFT to FIR.

Allocate clause is added as a TODO as handleAllocateClause is added in
D122302.

Reviewed By: kiranchandramohan

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

2 years ago[CSKY] Enhance asm parser and relocation fixup for some special symbol address instru...
Zi Xuan Wu [Fri, 18 Mar 2022 07:40:14 +0000 (15:40 +0800)]
[CSKY] Enhance asm parser and relocation fixup for some special symbol address instruction

Add processing of parsing and emiting lrw/jsri/jmpi instruction, including related fixup and relocation.
Add relax support about pseudo instructions such as jbr/jbsr.
Add objdump format support like arm in llvm-objdump.

2 years ago[clang][NFC] Fix warning of integer comparison
Kai Luo [Thu, 24 Mar 2022 06:02:27 +0000 (14:02 +0800)]
[clang][NFC] Fix warning of integer comparison

```
warning: comparison of integers of different signs: 'const unsigned long' and 'const int' [-Wsign-compare]
```

Fix https://lab.llvm.org/buildbot/#/builders/57/builds/16220.

2 years ago[mlir][OpenMP][NFC] Remove unnecessary attributes
Shraiysh Vaishay [Thu, 24 Mar 2022 04:38:46 +0000 (10:08 +0530)]
[mlir][OpenMP][NFC] Remove unnecessary attributes

These attributes were added because of oilist required them earlier. It
no longer requires them and so these attributes can be safely removed
from the operations.

Reviewed By: kiranchandramohan

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

2 years ago[mlir][OpenMP] omp.single translation to LLVM IR
Shraiysh Vaishay [Thu, 24 Mar 2022 04:29:34 +0000 (09:59 +0530)]
[mlir][OpenMP] omp.single translation to LLVM IR

This patch adds translation from omp.single to LLVM IR.

Depends on D122288

Reviewed By: ftynse, kiranchandramohan

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

2 years ago[X86][NFC] Fix missing `override` in `isMemUseUpRegs`
Kai Luo [Thu, 24 Mar 2022 04:23:12 +0000 (12:23 +0800)]
[X86][NFC] Fix missing `override` in `isMemUseUpRegs`

Fix warning
```
warning: 'isMemUseUpRegs' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
```

2 years ago[libc] Add implementations of fopen, flose, fread, fwrite and fseek.
Siva Chandra Reddy [Wed, 23 Mar 2022 03:49:26 +0000 (03:49 +0000)]
[libc] Add implementations of fopen, flose, fread, fwrite and fseek.

A follow up patch will add feof and ferror.

Reviewed By: lntue

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

2 years ago[lldb] Test parsing the symtab with indirect symbols from the shared cache
Jonas Devlieghere [Thu, 24 Mar 2022 04:00:57 +0000 (21:00 -0700)]
[lldb] Test parsing the symtab with indirect symbols from the shared cache

This patch adds a test for b0dc2fae6025. That commit fixed a bug where
we could increment the indirect symbol offset every time we parsed the
symbol table.

2 years ago[clang][AVR] Implement standard calling convention for AVR and AVRTiny
Ben Shi [Thu, 24 Mar 2022 03:30:58 +0000 (03:30 +0000)]
[clang][AVR] Implement standard calling convention for AVR and AVRTiny

This patch implements avr-gcc's calling convention:
https://gcc.gnu.org/wiki/avr-gcc#Calling_Convention

Reviewed By: aykevl

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

2 years ago[CUDA][FIX] Fix name conflict in getNVPTXTargetFeatures
Joseph Huber [Thu, 24 Mar 2022 03:07:51 +0000 (23:07 -0400)]
[CUDA][FIX] Fix name conflict in getNVPTXTargetFeatures

Summary:
There was a naming conflict in the getNVPTXTargetFeatures function that
prevented some compilers from correctly disambiguating between the
enumeration and variable of the same name. Rename the variable to avoid
this.

2 years ago[clang-format] Fix invalid code generation with comments in lambda
owenca [Wed, 23 Mar 2022 10:16:19 +0000 (03:16 -0700)]
[clang-format] Fix invalid code generation with comments in lambda

Fixes #51234 and #54496

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

2 years ago[AVR] Reject/Reserve R0~R15 on AVRTiny.
Ben Shi [Mon, 14 Mar 2022 10:35:34 +0000 (10:35 +0000)]
[AVR] Reject/Reserve R0~R15 on AVRTiny.

Reviewed By: aykevl, dylanmckay

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

2 years ago[C++20] [Modules] Make the linkage consistent for template and its
Chuanqi Xu [Wed, 23 Feb 2022 08:23:26 +0000 (16:23 +0800)]
[C++20] [Modules] Make the linkage consistent for template and its
specialization

Before the patch, the compiler would crash for the test due to
inconsistent linkage.

This patch tries to avoid it by make the linkage consistent for template
and its specialization. After the patch, the behavior of compiler would
be partially correct for the case.
The correct one is:

```
export template<class T>
void f() {}

template<>
void f<int>() {}
```

In this case, the linkage for both declaration should be external (the
wording I get by consulting in WG21 is "the linkage for name f should be
external").

And for the case:
```
template<class T>
void f() {}

export template<>
void f<int>() {}
```

Compiler should reject it. This isn't done now. After all, this patch would
stop a crash.

Reviewed By: iains, aaron.ballman, dblaikie

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

2 years ago[AVR][MC] Emit some aliases for GPRs and IO registers
Ben Shi [Wed, 23 Mar 2022 06:37:32 +0000 (06:37 +0000)]
[AVR][MC] Emit some aliases for GPRs and IO registers

Emit the following aliases (if available):

.set __tmp_reg__, [0|16]
.set __zero_reg__, [1|17]
.set __SREG__, 63
.set __SP_H__, 62
.set __SP_L__, 61
.set __EIND__, 60
.set __RAMPZ__, 59

Reviewed By: aykevl

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