platform/upstream/llvm.git
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

2 years ago[clang][AVR] Implement standard calling convention for AVR and AVRTiny
Ben Shi [Tue, 1 Mar 2022 08:44:49 +0000 (08:44 +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[Flang][NFC] Rearrange intrinsic generator functions
Kiran Chandramohan [Thu, 24 Mar 2022 01:50:59 +0000 (01:50 +0000)]
[Flang][NFC] Rearrange intrinsic generator functions

This patch rearranges the generator functions for various intrinsics.
The rearrangement will help to identify any missing functionality.

Reviewed By: PeteSteinfeld

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

2 years ago[gn build] Port 64902d335c21
LLVM GN Syncbot [Thu, 24 Mar 2022 01:49:33 +0000 (01:49 +0000)]
[gn build] Port 64902d335c21

2 years ago[Inline asm] Fix mangle problem when variable used in inline asm.
Xiang1 Zhang [Thu, 24 Mar 2022 01:24:15 +0000 (09:24 +0800)]
[Inline asm] Fix mangle problem when variable used in inline asm.
(Correct 'Mem symbol + IntelExpr' output in PIC model)

Reviewed By: skan

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

2 years ago[InlineAsm] Fix mangle problem when global variable used in inline asm
Xiang1 Zhang [Thu, 24 Mar 2022 00:48:35 +0000 (08:48 +0800)]
[InlineAsm] Fix mangle problem when global variable used in inline asm
(Add modifier P for ARR[BaseReg+IndexReg+..])

Reviewed By: skan

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

2 years ago[Inline asm] Fix mangle problem when variable used in inline asm.
Xiang1 Zhang [Thu, 24 Mar 2022 00:46:15 +0000 (08:46 +0800)]
[Inline asm] Fix mangle problem when variable used in inline asm.
(Connect InlineAsm Memory Operand with its real value not just name)
Revert 2 history bugfix patch:

Revert "[X86][MS-InlineAsm] Make the constraint *m to be simple place holder"
This patch revert https://reviews.llvm.org/D115225 which mainly
fix problems intrduced by https://reviews.llvm.org/D113096

This reverts commit d7c07f60b35f901f5bd9153b11807124a9bdde60.

Revert "Reland "[X86][MS-InlineAsm] Use exact conditions to recognize MS global variables""
This patch revert https://reviews.llvm.org/D116090 which fix problem
intrduced by https://reviews.llvm.org/D115225

This reverts commit 24c68ea1eb4fc0d0e782424ddb02da9e8c53ddf5.

Reviewed By: skan

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

2 years agoReland "Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO"
Julian Lettner [Thu, 24 Mar 2022 00:37:07 +0000 (17:37 -0700)]
Reland "Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO"

For MachO, lower `@llvm.global_dtors` into `@llvm_global_ctors` with
`__cxa_atexit` calls to avoid emitting the deprecated `__mod_term_func`.

Reuse the existing `WebAssemblyLowerGlobalDtors.cpp` to accomplish this.

Enable fallback to the old behavior via Clang driver flag
(`-fregister-global-dtors-with-atexit`) or llc / code generation flag
(`-lower-global-dtors-via-cxa-atexit`).  This escape hatch will be
removed in the future.

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

2 years agoRecommit "[SLP] Fix lookahead operand reordering for splat loads." attempt 3, fixed...
Vasileios Porpodas [Thu, 24 Mar 2022 00:32:46 +0000 (17:32 -0700)]
Recommit "[SLP] Fix lookahead operand reordering for splat loads." attempt 3, fixed assertion crash.

Original review: https://reviews.llvm.org/D121354

This reverts commit e6ead19b774718113007ecb1a4449d7af0cbcfeb.

2 years ago[MLIR][Presburger] Matrix::insertColumns: add doc, fix lint issue, and early exit...
Arjun P [Mon, 21 Mar 2022 14:13:21 +0000 (14:13 +0000)]
[MLIR][Presburger] Matrix::insertColumns: add doc, fix lint issue, and early exit when possible

Reviewed By: Groverkss

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

2 years ago[MLIR][Presburger] PWMAFunction::valueAt: support local ids
Arjun P [Wed, 23 Mar 2022 23:11:28 +0000 (23:11 +0000)]
[MLIR][Presburger] PWMAFunction::valueAt: support local ids

Add a baseline implementation of support for local ids for `PWMAFunction::valueAt`. This can be made more efficient later if needed by handling locals with known div representations separately.

Reviewed By: Groverkss

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

2 years ago[MLIR][Presburger] LexSimplex::addEquality: add equalities as fixed columns
Arjun P [Wed, 23 Mar 2022 23:04:13 +0000 (23:04 +0000)]
[MLIR][Presburger] LexSimplex::addEquality: add equalities as fixed columns

In LexSimplex, instead of adding equalities as a pair of inequalities,
add them as a single row, move them into the basis, and keep them there.

There will always be a valid basis involving all non-redundant equalities. Such
equalities will then be ignored in some other operations, such as when looking
for pivot columns. This speeds them up a little bit.

More importantly, this is an important precursor patch to adding support for
symbolic integer lexmin, as this heuristic can sometimes make a big difference there.

Reviewed By: Groverkss

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

2 years ago[MLIR][Presburger] Introduce SimplexRollbackScopeExit to rollback on scope exit
Arjun P [Mon, 21 Mar 2022 19:59:17 +0000 (19:59 +0000)]
[MLIR][Presburger] Introduce SimplexRollbackScopeExit to rollback on scope exit

This simplifies many places where we just want to do something in a "transient context"
and return some value.

Reviewed By: Groverkss

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

2 years ago[MLIR][Presburger] IntegerRelation: implement partial rollback support
Arjun P [Wed, 23 Mar 2022 23:40:20 +0000 (23:40 +0000)]
[MLIR][Presburger] IntegerRelation: implement partial rollback support

It is often necessary to "rollback" IntegerRelations to an earlier state. Although providing full rollback support is non-trivial, we really only need to support the case where the only changes made are to append ids or append constraints, and then rollback these additions. This patch adds support to rollback in such situations by recording the number of ids and constraints of each kind and providing support to truncate the IntegerRelation to those counts by removing appended ids and constraints. This already simplifies subtraction a little bit and will also be useful in the implementation of symbolic integer lexmin.

Reviewed By: Groverkss

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

2 years agoLoad dyld manually with 'main bin spec' userland corefiles
Jason Molenda [Thu, 24 Mar 2022 00:08:02 +0000 (17:08 -0700)]
Load dyld manually with 'main bin spec' userland corefiles

In ProcessMachCore::DoLoadCore when we have a standalone
binary and a 'main bin spec' LC_NOTE detailing the UUID and
load address, ProcessMachCore will do a (potentially slow)
lookup to try to find the binary and/or dSYM.  For kernel and
userland corefile using 'main bin spec', we would follow the
normal schemes of locating them.  DynamicLoaderDarwinKernel would
use the same (possibly expensive) calls to find the correct
binary.  dyld by default would use the in-core-file binary image,
and so if the corefile didn't include the entire address space,
the LINKEDIT for dyld could be missing.  This means we can't find
the dyld4::dyld_all_image_infos struct, which tells us where the
other binaries are loaded in memory.

Treat userland 'bin main spec' like we do standalone firmewares;
try the expensive checks to find the best dyld we can, before
falling back to using a memory module out of the corefile.

Also add a little TODO for myself in this load_standalone_binary
function that we should handle the case of a binary in the shared
cache correctly, creating a memory module in the corefile and
using the segment load addresses from that to set our segment
load addresses for the final binary.

rdar://89717101

2 years ago[PowerPC] The BL8_NOTOC_RM instruction needs to produce a notoc relocation.
Stefan Pintilie [Wed, 23 Mar 2022 18:46:57 +0000 (13:46 -0500)]
[PowerPC] The BL8_NOTOC_RM instruction needs to produce a notoc relocation.

The BL8_NOTOC_RM instruction was incorrectly producing a relocation that reqired
a TOC restore after the call. This patch fixes that issue and the notoc
relocation is now used.

Reviewed By: jsji

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

2 years ago[libc][obvious] add aligned_alloc as entrypoint
Michael Jones [Wed, 23 Mar 2022 23:31:52 +0000 (16:31 -0700)]
[libc][obvious] add aligned_alloc as entrypoint

This patch adds aligned_alloc as an entrypoint. Previously it was being
included implicitly.

Reviewed By: sivachandra

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

2 years ago[lldb] Don't persist the LINKEDIT slide in the indirect symbol offset
Jonas Devlieghere [Wed, 23 Mar 2022 23:24:15 +0000 (16:24 -0700)]
[lldb] Don't persist the LINKEDIT slide in the indirect symbol offset

The current code increment the indirect symbol offset with the LINKEDIT
slide every time ObjectFileMachO::ParseSymtab is called.

This resulted in a crash when calling add-dsym which causes us to
potentially re-parse the original binary's symbol table. There's a
separate question about whether we should re-parse the symbol table at
all which was fixed by D114288. Regardless, copying the load command is
cheap enough that this is still the right thing to do.

rdar://72337717

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

2 years ago[libc] Link the SCUDO integration tests to a special entrypoint collection.
Siva Chandra Reddy [Wed, 23 Mar 2022 23:17:56 +0000 (23:17 +0000)]
[libc] Link the SCUDO integration tests to a special entrypoint collection.

We were previously linking to libllvmlibc.a. But, with libllvmlibc.a now
including functions which depend on the loader, we will have to use the
LLVM libc loader as well. To avoid this, we will link to a special
library which is just a collection of SCUDO allocator entrypoints.

Reviewed By: michaelrj

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

2 years ago[lldb] Remove lldbassert from CommandInterpreter::PrintCommandOutput
Jonas Devlieghere [Wed, 23 Mar 2022 21:13:58 +0000 (14:13 -0700)]
[lldb] Remove lldbassert from CommandInterpreter::PrintCommandOutput

The assertion checks that the command output doesn't contain any null
bytes. I'm not sure if the intention was to make sure the string wasn't
shorter than the reported length or if this was a way to catch us
accidentally writing an (unformatted) null byte.

The consensus is that we don't want to have embedded nulls in the
command output, but that this isn't the right place to enforce that.

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

2 years ago[lldb] Support class_ro_t pointer authentication
Jonas Devlieghere [Wed, 23 Mar 2022 17:15:20 +0000 (10:15 -0700)]
[lldb] Support class_ro_t pointer authentication

Upstream support for signed class_ro_t pointers.

2 years agoRevert "[gn build] Port 9c542a5a4e1b"
Zequan Wu [Wed, 23 Mar 2022 22:41:03 +0000 (15:41 -0700)]
Revert "[gn build] Port 9c542a5a4e1b"

This reverts commit e28ace8a97583cacadd92180bda9fa3e49554c51.

2 years agoRevert "Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO"
Zequan Wu [Wed, 23 Mar 2022 22:40:52 +0000 (15:40 -0700)]
Revert "Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO"

This reverts commit 22570bac694396514fff18dec926558951643fa6.

2 years ago[flang][NFC] Add forall lowering test
Valentin Clement [Wed, 23 Mar 2022 23:09:22 +0000 (00:09 +0100)]
[flang][NFC] Add forall lowering test

Add test for forall lowering use case.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang][NFC] Add more lowering tests
Valentin Clement [Wed, 23 Mar 2022 23:08:02 +0000 (00:08 +0100)]
[flang][NFC] Add more lowering tests

This patch adds more lowering tests from the PFT to FIR.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[libc] Change FEnv to use MXCSR as source of truth
Michael Jones [Wed, 16 Mar 2022 19:08:25 +0000 (12:08 -0700)]
[libc] Change FEnv to use MXCSR as source of truth

This patch primarily fixes the fenv implementation on Windows, since
Windows uses the MXCSR in place of the x87 status registers for storing
information about the floating point environment. This allows FEnv to
work correctly on Windows, and successfully build.

Reviewed By: lntue

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

2 years ago[NFCI] Fix set-but-unused warning in asan_fake_stack.cpp
Mitch Phillips [Wed, 23 Mar 2022 22:45:09 +0000 (15:45 -0700)]
[NFCI] Fix set-but-unused warning in asan_fake_stack.cpp

2 years ago[CGSCC] Use make_early_inc_range. NFC
Fangrui Song [Wed, 23 Mar 2022 22:31:09 +0000 (15:31 -0700)]
[CGSCC] Use make_early_inc_range. NFC

2 years agoRevert "Expose GetAddressingBits() in the Process API."
Adrian Prantl [Wed, 23 Mar 2022 22:27:38 +0000 (15:27 -0700)]
Revert "Expose GetAddressingBits() in the Process API."

This reverts commit 7504dd5e00f514628614db8ee07514c73220e597.

In newer review feedback it was pointed out that there is a better API for this in Process::GetCodeAddressMask().