platform/upstream/llvm.git
3 years agoRevert "[clang] Implement P2266 Simpler implicit move"
Arthur Eubanks [Fri, 11 Jun 2021 02:54:50 +0000 (19:54 -0700)]
Revert "[clang] Implement P2266 Simpler implicit move"

This reverts commit cbd0054b9eb17ec48f0702e3828209646c8f5ebd.

3 years ago[VectorCombine] Fix alignment in single element store
Qiu Chaofan [Fri, 11 Jun 2021 02:28:15 +0000 (10:28 +0800)]
[VectorCombine] Fix alignment in single element store

This fixes the concern in single element store scalarization that the
alignment of new store may be larger than it should be. It calculates
the largest alignment if index is constant, and a safe one if not.

Reviewed By: lebedev.ri, spatel

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

3 years ago[RISCV] Use ComputeNumSignBits/MaskedValueIsZero in RISCVDAGToDAGISel::selectSExti32...
Craig Topper [Fri, 11 Jun 2021 00:05:34 +0000 (17:05 -0700)]
[RISCV] Use ComputeNumSignBits/MaskedValueIsZero in RISCVDAGToDAGISel::selectSExti32/selectZExti32.

This helps us select W instructions in more cases. Most of the
affected tests have had the sign_extend_inreg or AND folded into
sextload/zextload.

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

3 years ago[Flang] Compile fix after D99459.
Michael Kruse [Fri, 11 Jun 2021 00:58:46 +0000 (19:58 -0500)]
[Flang] Compile fix after D99459.

Fix Flang build after addition of a new OpenMP clauses for a Clang
patch (D99459). Flang is using TableGen to generation the declaration
of clause checks and the new clause was missing a definiton.

3 years ago[mlir-ir-printing] Prefix the dump message with the split marker(// -----)
River Riddle [Fri, 11 Jun 2021 00:34:33 +0000 (17:34 -0700)]
[mlir-ir-printing] Prefix the dump message with the split marker(// -----)

This allows for better interaction with tools (such as mlir-lsp-server), as it separates the IR into separate modules for consecutive dumps.

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

3 years ago[mlir] Add new SubElementAttr/SubElementType Interfaces
River Riddle [Fri, 11 Jun 2021 00:22:49 +0000 (17:22 -0700)]
[mlir] Add new SubElementAttr/SubElementType Interfaces

These interfaces allow for a composite attribute or type to opaquely provide access to any held attributes or types. There are several intended use cases for this interface. The first of which is to allow the printer to create aliases for non-builtin dialect attributes and types. In the future, this interface will also be extended to allow for SymbolRefAttr to be placed on other entities aside from just DictionaryAttr and ArrayAttr.

To limit potential test breakages, this revision only adds the new interfaces to the builtin attributes/types that are currently hardcoded during AsmPrinter alias generation. In a followup the remaining builtin attributes/types, and non-builtin attributes/types can be extended to support it.

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

3 years ago[mlir][IR] Move MemRefElementTypeInterface to a new BuiltinTypeInterfaces file
River Riddle [Fri, 11 Jun 2021 00:22:37 +0000 (17:22 -0700)]
[mlir][IR] Move MemRefElementTypeInterface to a new BuiltinTypeInterfaces file

This allows for using other type interfaces in the builtin dialect, which currently results in a compile time failure (as it generates duplicate interface declarations).

3 years ago[AArch64][GlobalISel] Fix incorrectly generating uxtw/sxtw for addressing modes.
Amara Emerson [Thu, 10 Jun 2021 22:45:43 +0000 (15:45 -0700)]
[AArch64][GlobalISel] Fix incorrectly generating uxtw/sxtw for addressing modes.

When the extend is from 8 or 16 bits, the addressing modes don't support those
extensions, but we weren't checking that and therefore always generated the 32->64b
extension mode. Fun.

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

3 years ago[ValueTypes] Define MVTs for v6i32, v6f32, v7i32, v7f32
Carl Ritson [Thu, 10 Jun 2021 23:40:51 +0000 (08:40 +0900)]
[ValueTypes] Define MVTs for v6i32, v6f32, v7i32, v7f32

For use in AMDGPU selection DAG.

Reviewed By: RKSimon

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

3 years ago[SDAG] Fix pow2 assumption when splitting vectors
Carl Ritson [Thu, 10 Jun 2021 23:40:21 +0000 (08:40 +0900)]
[SDAG] Fix pow2 assumption when splitting vectors

When reducing vector builds to shuffles it possible that
the DAG combiner may try to extract invalid subvectors.

This happens as the existing code assumes vectors will be power
of 2 sizes, which is already untrue, but becomes more noticable
with v6 and v7 types.
Specifically the existing code assumes that half PowerOf2Ceil of
a given vector index will fit twice into a given vector.

Reviewed By: RKSimon

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

3 years ago[RISCV] Add test cases that show failure to use some W instructions if they are proce...
Craig Topper [Thu, 10 Jun 2021 23:42:29 +0000 (16:42 -0700)]
[RISCV] Add test cases that show failure to use some W instructions if they are proceeded by a load. NFC

The loads end up becoming sextload/zextload which prevent our
isel patterns from finding the sign_extend_inreg or AND instruction
we need.

The easiest way to fix this is to use computeKnownBits or
ComputeNumSignBits in our isel matching to catch this.

3 years ago[IR] Value: Fix OpCode checks
Sami Tolvanen [Thu, 10 Jun 2021 23:18:57 +0000 (16:18 -0700)]
[IR] Value: Fix OpCode checks

Value::SubclassID cannot be directly compared to Instruction enums, such as
Instruction::{Call,Invoke,CallBr}. We have to first subtract InstructionVal
from the SubclassID to get the OpCode, similar to Instruction::getOpCode().

Reviewed By: nickdesaulniers

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

3 years ago[static initializers] Emit global_ctors and global_dtors in reverse order when .ctors...
Wolfgang Pieb [Wed, 2 Jun 2021 18:37:35 +0000 (11:37 -0700)]
[static initializers] Emit global_ctors and global_dtors in reverse order when .ctors/.dtors are used.

Reviewed By: rnk, MaskRay, efriedma

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

3 years agoLoadStoreVectorizer: support different operand orders in the add sequence match
Slava Nikolaev [Thu, 10 Jun 2021 23:01:01 +0000 (16:01 -0700)]
LoadStoreVectorizer: support different operand orders in the add sequence match

First we refactor the code which does no wrapping add sequences
match: we need to allow different operand orders for
the key add instructions involved in the match.

Then we use the refactored code trying 4 variants of matching operands.

Originally the code relied on the fact that the matching operands
of the two last add instructions of memory index calculations
had the same LHS argument. But which operand is the same
in the two instructions is actually not essential, so now we allow
that to be any of LHS or RHS of each of the two instructions.
This increases the chances of vectorization to happen.

Reviewed By: volkan

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

3 years ago[Profile] Remove redundant check
Arthur Eubanks [Thu, 10 Jun 2021 23:23:09 +0000 (16:23 -0700)]
[Profile] Remove redundant check

This is already checked outside the loop.

Followup to D104050.

3 years ago[IR] make -warn-frame-size into a module attr
Nick Desaulniers [Thu, 10 Jun 2021 23:03:14 +0000 (16:03 -0700)]
[IR] make -warn-frame-size into a module attr

-Wframe-larger-than= is an interesting warning; we can't know the frame
size until PrologueEpilogueInsertion (PEI); very late in the compilation
pipeline.

-Wframe-larger-than= was propagated through CC1 as an -mllvm flag, then
was a cl::opt in LLVM's PEI pass; this meant it was dropped during LTO
and needed to be re-specified via -plugin-opt.

Instead, make it part of the IR proper as a module level attribute,
similar to D103048. Introduce -fwarn-stack-size CC1 option.

Reviewed By: rsmith, qcolombet

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

3 years ago[Profile] Handle invalid profile data
Arthur Eubanks [Thu, 10 Jun 2021 17:33:47 +0000 (10:33 -0700)]
[Profile] Handle invalid profile data

This mostly follows LLVM's InstrProfReader.cpp error handling.
Previously, attempting to merge corrupted profile data would result in
crashes. See https://crbug.com/1216811#c4.

Reviewed By: rnk

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

3 years ago[clang] Implement P2266 Simpler implicit move
Matheus Izvekov [Fri, 19 Mar 2021 02:32:06 +0000 (03:32 +0100)]
[clang] Implement P2266 Simpler implicit move

This Implements [[http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html|P2266 Simpler implicit move]].

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: Quuxplusone

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

3 years agoPreserve more MD_mem_parallel_loop_access and MD_access_group in SROA
Andy Kaylor [Thu, 10 Jun 2021 00:02:53 +0000 (17:02 -0700)]
Preserve more MD_mem_parallel_loop_access and MD_access_group in SROA

SROA sometimes preserves MD_mem_parallel_loop_access and MD_access_group metadata on loads/stores, and sometimes fails to do so. This change adds copying of the MD after other CreateAlignedLoad/CreateAlignedStores. Also fix a case where the metadata was being copied from a load, rather than the store.

Added a LIT test to catch one case.

Patch by Mark Mendell

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

3 years ago[libcxx][ranges] removes default_initializable from weakly_incrementable and view
Christopher Di Bella [Fri, 14 May 2021 06:20:07 +0000 (06:20 +0000)]
[libcxx][ranges] removes default_initializable from weakly_incrementable and view

also:

* removes default constructors from predefined iterators
* makes span and string_view views

Partially implements P2325.
Partially resolves LWG3326.

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

3 years ago[AArch64][GlobalISel] Legalize scalar G_CTTZ + G_CTTZ_ZERO_UNDEF
Jessica Paquette [Thu, 10 Jun 2021 21:40:18 +0000 (14:40 -0700)]
[AArch64][GlobalISel] Legalize scalar G_CTTZ + G_CTTZ_ZERO_UNDEF

This adds legalization for scalar G_CTTZ and G_CTTZ_ZERO_UNDEF. Vector support
requires handling vector G_BITREVERSE, which I haven't gotten around to yet.

For G_CTTZ_ZERO_UNDEF, we just lower it to G_CTTZ.

For G_CTTZ, we match SelectionDAG's lowering to a G_BITREVERSE + G_CTLZ.

e.g. https://godbolt.org/z/nPEseYh1s

(With this patch, we have slightly worse codegen than SDAG for types smaller
than s32; it seems like we're missing a combine.)

Also, this adds in a function to build G_BITREVERSE to MachineIRBuilder.

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

3 years ago[MLIR] Document that Dialect Conversion traverses in preorder
Geoffrey Martin-Noble [Fri, 14 May 2021 19:45:57 +0000 (12:45 -0700)]
[MLIR] Document that Dialect Conversion traverses in preorder

Reviewed By: rriddle

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

3 years ago2d Arm Neon sdot op, and lowering to the intrinsic.
Benoit Jacob [Thu, 10 Jun 2021 20:57:44 +0000 (13:57 -0700)]
2d Arm Neon sdot op, and lowering to the intrinsic.

This adds Sdot2d op, which is similar to the usual Neon
intrinsic except that it takes 2d vector operands, reflecting the
structure of the arithmetic that it's performing: 4 separate
4-dimensional dot products, whence the vector<4x4xi8> shape.

This also adds a new pass, arm-neon-2d-to-intr, lowering
this new 2d op to the 1d intrinsic.

Reviewed By: nicolasvasilache

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

3 years ago[LV] Parallel annotated loop does not imply all loads can be hoisted.
Joachim Meyer [Tue, 8 Jun 2021 16:16:08 +0000 (18:16 +0200)]
[LV] Parallel annotated loop does not imply all loads can be hoisted.

As noted in https://bugs.llvm.org/show_bug.cgi?id=46666, the current behavior of assuming if-conversion safety if a loop is annotated parallel (`!llvm.loop.parallel_accesses`), is not expectable, the documentation for this behavior was since removed from the LangRef again, and can lead to invalid reads.
This was observed in POCL (https://github.com/pocl/pocl/issues/757) and would require similar workarounds in current work at hipSYCL.

The question remains why this was initially added and what the implications of removing this optimization would be.
Do we need an alternative mechanism to propagate the information about legality of if-conversion?
Or is the idea that conditional loads in `#pragma clang loop vectorize(assume_safety)` can be executed unmasked without additional checks flawed in general?
I think this implication is not part of what a user of that pragma (and corresponding metadata) would expect and thus dangerous.

Only two additional tests failed, which are adapted in this patch. Depending on the further direction force-ifcvt.ll should be removed or further adapted.

Reviewed By: jdoerfert

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

3 years ago[SimplifyCFG] avoid 'tmp' variables in test file; NFC
Sanjay Patel [Thu, 10 Jun 2021 20:59:41 +0000 (16:59 -0400)]
[SimplifyCFG] avoid 'tmp' variables in test file; NFC

3 years ago[clang] NRVO: Improvements and handling of more cases.
Matheus Izvekov [Fri, 19 Mar 2021 02:32:06 +0000 (03:32 +0100)]
[clang] NRVO: Improvements and handling of more cases.

This expands NRVO propagation for more cases:

Parse analysis improvement:
* Lambdas and Blocks with dependent return type can have their variables
  marked as NRVO Candidates.

Variable instantiation improvements:
* Fixes crash when instantiating NRVO variables in Blocks.
* Functions, Lambdas, and Blocks which have auto return type have their
  variables' NRVO status propagated. For Blocks with non-auto return type,
  as a limitation, this propagation does not consider the actual return
  type.

This also implements exclusion of VarDecls which are references to
dependent types.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: Quuxplusone

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

3 years ago[ARM] Fix Changed status in MVEGatherScatterLoweringPass.
David Green [Thu, 10 Jun 2021 20:53:04 +0000 (21:53 +0100)]
[ARM] Fix Changed status in MVEGatherScatterLoweringPass.

Now that we are calling SimplifyInstructionsInBlock, make sure we update
Changed when it reports alterations.

3 years ago[LI] Add a cover function for checking if a loop is mustprogress [nfc]
Philip Reames [Thu, 10 Jun 2021 20:36:14 +0000 (13:36 -0700)]
[LI] Add a cover function for checking if a loop is mustprogress [nfc]

Essentially, the cover function simply combines the loop level check and the function level scope into one call.  This simplifies several callers and is (subjectively) less error prone.

3 years ago[libc++] Remove unnecessary header in enable_view.h (which caused a cycle)
Louis Dionne [Thu, 10 Jun 2021 20:35:17 +0000 (16:35 -0400)]
[libc++] Remove unnecessary header in enable_view.h (which caused a cycle)

3 years ago[ELF] Simplify getAArch64UndefinedRelativeWeakVA. NFC
Fangrui Song [Thu, 10 Jun 2021 20:30:16 +0000 (13:30 -0700)]
[ELF] Simplify getAArch64UndefinedRelativeWeakVA. NFC

3 years ago[ELF][RISCV] Resolve branch relocations referencing undefined weak to current locatio...
Fangrui Song [Thu, 10 Jun 2021 20:25:16 +0000 (13:25 -0700)]
[ELF][RISCV] Resolve branch relocations referencing undefined weak to current location if not using PLT

In a -no-pie link we optimize R_PLT_PC to R_PC. Currently we resolve a branch
relocation to the link-time zero address. However such a choice tends to cause
relocation overflow possibility for RISC architectures.

* aarch64: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the next instruction
* mips: GNU ld: branch to the start of the text segment (?); ld.lld: branch to zero
* ppc32: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the current instruction
* ppc64: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the current instruction
* riscv: GNU ld: branch to the absolute zero address (with instruction rewriting)
* i386/x86_64: GNU ld/ld.lld: branch to the link-time zero address

I think that resolving to the same location is a good choice. The instruction,
if triggered, is clearly an undefined behavior. Resolving to the same location
can cause an infinite loop (making the user aware of the issue) while ensuring
no overflow.

Reviewed By: jrtc27

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

3 years ago[SCEV] Use mustprogress flag on loops (in addition to function attribute)
Philip Reames [Thu, 10 Jun 2021 20:16:50 +0000 (13:16 -0700)]
[SCEV] Use mustprogress flag on loops (in addition to function attribute)

This addresses a performance regression reported against 3c6e4191.  That change (correctly) limited a transform based on assumed finiteness to mustprogress loops, but the previous change (38540d7) which introduced the mustprogress check utility only handled function attributes, not the loop metadata form.

It turns out that clang uses the function attribute form for C++, and the loop metadata form for C.  As a result, 3c6e4191 ended up being a large regression in practice for C code as loops weren't being considered mustprogress despite the language semantics.

3 years agoMove variable only used inside an assert into the assert.
Sterling Augustine [Thu, 10 Jun 2021 20:12:46 +0000 (13:12 -0700)]
Move variable only used inside an assert into the assert.

This prevents build failures with -Wunused.

3 years agoMove code for checking loop metadata into Analysis [nfc]
Philip Reames [Thu, 10 Jun 2021 20:00:21 +0000 (13:00 -0700)]
Move code for checking loop metadata into Analysis [nfc]

I need the mustprogress loop metadata in ScalarEvolution and it makes sense to keep all the accessors for quering loop metadate together.

3 years ago[gn build] Port bbb3d03f93b8
LLVM GN Syncbot [Thu, 10 Jun 2021 19:39:58 +0000 (19:39 +0000)]
[gn build] Port bbb3d03f93b8

3 years ago[libcxx][ranges][nfc] moves view concepts into `__ranges/concepts.h`
Christopher Di Bella [Thu, 10 Jun 2021 18:40:21 +0000 (18:40 +0000)]
[libcxx][ranges][nfc] moves view concepts into `__ranges/concepts.h`

3 years ago[OpenMP] Implement '#pragma omp unroll'.
Michael Kruse [Thu, 10 Jun 2021 19:24:17 +0000 (14:24 -0500)]
[OpenMP] Implement '#pragma omp unroll'.

Implementation of the unroll directive introduced in OpenMP 5.1. Follows the approach from D76342 for the tile directive (i.e. AST-based, not using the OpenMPIRBuilder). Tries to use `llvm.loop.unroll.*` metadata where possible, but has to fall back to an AST representation of the outer loop if the partially unrolled generated loop is associated with another directive (because it needs to compute the number of iterations).

Reviewed By: ABataev

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

3 years ago[ARM] Ensure instructions are simplified prior to GatherScatter lowering.
David Green [Thu, 10 Jun 2021 19:18:12 +0000 (20:18 +0100)]
[ARM] Ensure instructions are simplified prior to GatherScatter lowering.

Surprisingly, not all instructions are always simplified after unrolling
and before MVE gather/scatter lowering. Notably dead gather operations
can be left around which cause the gather/scatter lowering pass to crash
if there are multiple gathers, some of which are dead.

This patch ensures they are simplified before we modify anything, which
can change some of the existing tests, including making them no-longer
test what they originally tested. This uses a combination of disabling
the gather/scatter lowering pass and adjusting the test to keep them as
before.

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

3 years ago[lld-macho][nfc] Fix uninitialized members warning from Coverity
Jez Ng [Thu, 10 Jun 2021 19:06:20 +0000 (15:06 -0400)]
[lld-macho][nfc] Fix uninitialized members warning from Coverity

We were always assigning to this member before using it, but just to be
safe...

See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151029.html

3 years ago[libc] Add implementation of expm1f.
Tue Ly [Fri, 23 Apr 2021 04:38:59 +0000 (00:38 -0400)]
[libc] Add implementation of expm1f.

Use expm1f(x) = exp(x) - 1 for |x| > ln(2).
For |x| <= ln(2), divide it into 3 subintervals: [-ln2, -1/8], [-1/8, 1/8], [1/8, ln2]
and use a degree-6 polynomial approximation generated by Sollya's fpminmax for each interval.
Errors < 1.5 ULPs when we use fma to evaluate the polynomials.

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

3 years ago[mlir-vscode] Fix dependencies to enable packaging the extension properly.
River Riddle [Thu, 10 Jun 2021 18:33:47 +0000 (11:33 -0700)]
[mlir-vscode] Fix dependencies to enable packaging the extension properly.

3 years ago[ms] [llvm-ml] Warn on command-line redefinition
Eric Astor [Thu, 10 Jun 2021 17:28:18 +0000 (13:28 -0400)]
[ms] [llvm-ml] Warn on command-line redefinition

If a macro is defined on the command line and then overridden in the source code, this is likely to be an error in the user's build system. We should warn on this.

Reviewed By: thakis

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

3 years ago[lldb, win] Remove obsolete workaround for MSVC and python libs
Stella Stamenova [Thu, 10 Jun 2021 18:13:38 +0000 (11:13 -0700)]
[lldb, win] Remove obsolete workaround for MSVC and python libs

This workaround was necessary before the major changes of managing python versions, but it is not needed anymore.

Reviewed By: JDevlieghere

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

3 years ago[mlir-lsp-server] Document the features provided by the language server
River Riddle [Thu, 10 Jun 2021 17:58:08 +0000 (10:58 -0700)]
[mlir-lsp-server] Document the features provided by the language server

This revision adds focused documentation on each of the individual features of the server, with images showcasing how they look in vscode.

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

3 years ago[mlir-lsp-server] Add support for textDocument/documentSymbols
River Riddle [Thu, 10 Jun 2021 17:57:55 +0000 (10:57 -0700)]
[mlir-lsp-server] Add support for textDocument/documentSymbols

This allows for building an outline of the symbols and symbol tables within the IR. This allows for easy navigations to functions/modules and other symbol/symbol table operations within the IR.

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

3 years ago[AArch64][GlobalISel] Mark some G_BITREVERSE types as legal + select them
Jessica Paquette [Thu, 10 Jun 2021 00:35:17 +0000 (17:35 -0700)]
[AArch64][GlobalISel] Mark some G_BITREVERSE types as legal + select them

We fall back on G_CTTZ_ZERO_UNDEF a lot when building clang for arm64 with
gisel.

Handling this will require that we can handle G_BITREVERSE.

This patch marks G_BITREVERSE instructions with natively supported types as
legal. We get selection on these types for free via the importer.

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

3 years ago[SLP]Disable scheduling of insertelements.
Alexey Bataev [Thu, 10 Jun 2021 12:15:27 +0000 (05:15 -0700)]
[SLP]Disable scheduling of insertelements.

There is no need to schedule insertelement instructions. The compiler
did not schedule them before it started support their vectorization and
it should not do it after. We pre-schedule them manually when finding
a build vector sequence.
Disabling scheduling of insertelement instructions improves compile
time and vectorization of the very large basic blocks by saving
scheduling budget for other instructions.

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

3 years ago[flang] Fixed simple typo in runtime code
Zachary Selk [Thu, 10 Jun 2021 17:14:25 +0000 (11:14 -0600)]
[flang] Fixed simple typo in runtime code

Reviewed By: klausler

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

3 years ago[gn build] minor TODO.txt update
Nico Weber [Thu, 10 Jun 2021 16:50:04 +0000 (12:50 -0400)]
[gn build] minor TODO.txt update

3 years ago[Flang][Runtime][tests] Escape regex special character.
Michael Kruse [Thu, 10 Jun 2021 16:23:53 +0000 (11:23 -0500)]
[Flang][Runtime][tests] Escape regex special character.

The second argument of `ASSERT_DEATH` describes a regular expression, in
which parentheses have special meaning. Matches of literal parentheses
need to be escaped.

Fixes failure of InvalidFormatFailure.ParenMismatch and
InvalidFormatFailure.ParenMismatch when gtest is compiled with MSVC's
regex implementation.

Reviewed By: awarzynski

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

3 years ago[lldb] Add 9494c510af56 to .git-blame-ignore-revs
Jonas Devlieghere [Thu, 10 Jun 2021 16:28:45 +0000 (09:28 -0700)]
[lldb] Add 9494c510af56 to .git-blame-ignore-revs

Adding 9494c510af56 to .git-blame-ignore-revs after having let it simmer
for a day.

3 years ago[libc++abi] Remove the LIBCXXABI_ENABLE_PIC option
Louis Dionne [Wed, 9 Jun 2021 17:04:32 +0000 (13:04 -0400)]
[libc++abi] Remove the LIBCXXABI_ENABLE_PIC option

Instead, people should be using CMAKE_POSITION_INDEPENDENT_CODE to control
whether they want to use PIC or not. We should try to avoid reinventing
the wheel whenever CMake natively supports something.

This makes libc++abi consistent with libc++ and libunwind.

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

3 years agoRevert "[clang][FPEnv] Clang floatng point model ffp-model=precise enables ffp-contra...
Melanie Blower [Thu, 10 Jun 2021 15:44:18 +0000 (11:44 -0400)]
Revert "[clang][FPEnv] Clang floatng point model ffp-model=precise enables ffp-contract=on"

This reverts commit 8daac3714083aa5507622dba858344051f6b5574.
The build bots are showing some fails on broadwell and arm.
Fix to LNT test suite needs work.

3 years ago[AIX] Build libLTO as MODULE rather than SHARED
David Tenty [Thu, 10 Jun 2021 15:15:04 +0000 (11:15 -0400)]
[AIX] Build libLTO as MODULE rather than SHARED

On CMake versions greater that >= 3.16 on AIX, shared libraries are
created as archives (which is the normal form for the platform). However
plugins libraries which are passed directly to a executable, like
libLTO to the linker, are usual build as plain `.so`, so this patch
restores this behaviour for libLTO on AIX (and adjust the name if need be
to account for the fact that llvm_add_library likes to force an empty
name prefix on modules), so we end up with the expected libLTO.so

Reviewed By: w2yehia

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

3 years agoAdd a page to track the status of C proposals in Clang.
Aaron Ballman [Thu, 10 Jun 2021 15:59:29 +0000 (11:59 -0400)]
Add a page to track the status of C proposals in Clang.

3 years agoFix range-loop-analysis warning
Keith Smiley [Wed, 9 Jun 2021 16:08:54 +0000 (09:08 -0700)]
Fix range-loop-analysis warning

```
llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8024:19: warning: loop variable 'VF' of type 'const llvm::ElementCount' creates a copy from type 'const llvm::ElementCount' [-Wrange-loop-analysis]
  for (const auto VF : VFCandidates) {
                  ^
llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8024:8: note: use reference type 'const llvm::ElementCount &' to prevent copying
  for (const auto VF : VFCandidates) {
       ^~~~~~~~~~~~~~~
                  &
1 warning generated.
```

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

3 years ago[mlir][gpu] Add op to create MMA constant matrix
thomasraoux [Wed, 9 Jun 2021 16:42:32 +0000 (09:42 -0700)]
[mlir][gpu] Add op to create MMA constant matrix

This allow creating a matrix with all elements set to a given value. This is
needed to be able to implement a simple dot op.

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

3 years ago[docs][llvm-ar] Add rsp-quoting option to the llvm-ar command guide.
gbreynoo [Thu, 10 Jun 2021 15:32:31 +0000 (16:32 +0100)]
[docs][llvm-ar] Add rsp-quoting option to the llvm-ar command guide.

I noticed that I did not update the command guide when introducing the
--rsp-quoting option. This change fixes this.

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

3 years ago[AArch64] Silence fallthrough warning. NFC.
Benjamin Kramer [Thu, 10 Jun 2021 15:23:37 +0000 (17:23 +0200)]
[AArch64] Silence fallthrough warning. NFC.

AArch64TargetTransformInfo.cpp:302:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  default:
    ^

3 years ago[clang-cl] Add /permissive and /permissive-
Markus Böck [Thu, 10 Jun 2021 15:06:19 +0000 (17:06 +0200)]
[clang-cl] Add /permissive and /permissive-

This patch adds the command line options /permissive and /permissive- to clang-cl. These flags are used in MSVC to enable various /Zc language conformance options at once. In particular, /permissive is used to enable the various non standard behaviour of MSVC, while /permissive- is the opposite.

When either of two command lines are specified they are simply expanded to the various underlying /Zc options. In particular when /permissive is passed it currently expands to:

/Zc:twoPhase- (disable two phase lookup)
-fno-operator-names (disable C++ operator keywords)
/permissive- expands to the opposites of these flags + /Zc:strictStrings (/Zc:strictStrings- does not currently exist). In the future, if any more MSVC workarounds are ever added they can easily be added to the expansion. One is also able to override settings done by permissive. Specifying /permissive- /Zc:twoPhase- will apply the settings from permissive minus, but disables two phase lookup.

Motivation for this patch was mainly parity with MSVC as well as compatibility with Windows SDK headers. The /permissive page from MSVC documents various workarounds that have to be done for the Windows SDK headers [1], when MSVC is used with /permissive-. In these, Microsoft often recommends simply compiling with /permissive for the specified source files. Since some of these also apply to clang-cl (which acts like /permissive- by default mostly), and some are currently implemented as "hacks" within clang that I'd like to remove, adding /permissive and /permissive- to be in full parity with MSVC and Microsofts documentation made sense to me.

[1] https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-160#windows-header-issues

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

3 years ago[clang][msvc] Define _HAS_STATIC_RTTI to 0, when compiling with -fno-rtti
Markus Böck [Thu, 10 Jun 2021 15:02:44 +0000 (17:02 +0200)]
[clang][msvc] Define _HAS_STATIC_RTTI to 0, when compiling with -fno-rtti

When using the -fno-rtti option of the GCC style clang++, using typeid results in an error. The MSVC STL however kindly provides a define flag called _HAS_STATIC_RTTI, which either enables or disables uses of typeid throughout the STL. By default, if undefined, it is set to 1, enabling the use of typeid.

With this patch, _HAS_STATIC_RTTI is set to 0 when -fno-rtti is specified. This way various headers of the MSVC STL like functional can be consumed without compilation failures.

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

3 years ago[clang][driver] Add -foperator-names
Markus Böck [Thu, 10 Jun 2021 15:01:13 +0000 (17:01 +0200)]
[clang][driver] Add -foperator-names

This patch adds the command line option -foperator-names which acts as the opposite of -fno-operator-names. With this command line option it is possible to reenable C++ operator keywords on the command line if -fno-operator-names had previously been passed.

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

3 years ago[clang] Do not crash when ArgTy is null in CheckArgAlignment
Adam Czachorowski [Mon, 7 Jun 2021 16:26:21 +0000 (18:26 +0200)]
[clang] Do not crash when ArgTy is null in CheckArgAlignment

This can happen around RecoveryExpr.

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

3 years ago[X86][NFC] Fix typo.
Luo, Yuanke [Thu, 10 Jun 2021 14:36:17 +0000 (22:36 +0800)]
[X86][NFC] Fix typo.

3 years ago [libc++abi] NFC: adding a new parameter base to functions for calculating address...
Xing Xue [Thu, 10 Jun 2021 14:45:50 +0000 (10:45 -0400)]
[libc++abi] NFC: adding a new parameter base to functions for calculating addresses with relative encodings

    Summary:
    This NFC patch adds a new parameter base to functions invoked by scan_eh_tab() for calculating the address of the encoding with a relative value. base defaults to 0. This is in preparation for the AIX implementation which uses the DW_EH_PE_datarel encoding.

    Reviewed by: MaskRay, sfertile, compnerd, libc++abi

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

3 years ago[TableGen] Eliminate dead code in ParseForeachDeclaration [NFC]
Paul C. Anagnostopoulos [Tue, 8 Jun 2021 15:51:53 +0000 (11:51 -0400)]
[TableGen] Eliminate dead code in ParseForeachDeclaration [NFC]

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

3 years ago[AArch64] Add cost tests for bitreverse
Irina Dobrescu [Thu, 3 Jun 2021 08:46:12 +0000 (09:46 +0100)]
[AArch64] Add cost tests for bitreverse

This patch includes cost tests for bit reverse as well as some adjustments to the cost model.

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

3 years ago[ARM] Skip debug during vpt block creation
David Green [Thu, 10 Jun 2021 13:49:04 +0000 (14:49 +0100)]
[ARM] Skip debug during vpt block creation

Debug info is currently preventing VPT block creation, leading to
different codegen. This patch attempts to skip any debug instructions
during vpt block creation, making sure they do not interfere.

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

3 years ago[ARM] MVE VPT block tests with debug info. NFC
David Green [Wed, 9 Jun 2021 19:48:42 +0000 (20:48 +0100)]
[ARM] MVE VPT block tests with debug info. NFC

3 years ago[clang][FPEnv] Clang floatng point model ffp-model=precise enables ffp-contract=on
Melanie Blower [Fri, 14 May 2021 17:06:26 +0000 (13:06 -0400)]
[clang][FPEnv] Clang floatng point model ffp-model=precise enables ffp-contract=on

This patch changes the ffp-model=precise to enables -ffp-contract=on
(previously -ffp-model=precise enabled -ffp-contract=fast). This is a
follow-up to Andy Kaylor's comments in the llvm-dev discussion
"Floating Point semantic modes". From the same email thread, I put
Andy's distillation of floating point options and floating point modes
into UsersManual.rst

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

3 years agoFix test hip-device-compile.hip
Yaxun (Sam) Liu [Thu, 10 Jun 2021 13:13:04 +0000 (09:13 -0400)]
Fix test hip-device-compile.hip

Add stricter check for 'ld'.

3 years ago[OpenMP] Add type to firstprivate symbol for const firstprivate values
Joseph Huber [Wed, 9 Jun 2021 23:34:24 +0000 (19:34 -0400)]
[OpenMP] Add type to firstprivate symbol for const firstprivate values

Clang will create a global value put in constant memory if an aggregate value
is declared firstprivate in the target device. The symbol name only uses the
name of the firstprivate variable, so symbol name conflicts will occur if the
variable is allowed to have different types through templates. An example of
this behvaiour is shown in https://godbolt.org/z/EsMjYh47n. This patch adds the
mangled type name to the symbol to avoid such naming conflicts. This fixes
https://bugs.llvm.org/show_bug.cgi?id=50642.

Reviewed By: ABataev

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

3 years ago[clang] Make CXXDefaultArgExpr inherit dependence from the inner Expr
Adam Czachorowski [Wed, 9 Jun 2021 12:52:29 +0000 (14:52 +0200)]
[clang] Make CXXDefaultArgExpr inherit dependence from the inner Expr

Before this change, CXXDefaultArgExpr would always have
ExprDependence::None. This can lead to issues when, for example, the
inner expression is RecoveryExpr and yet containsErrors() on the default
expression is false.

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

3 years ago[CodeGen] limit tests to current pass manager to avoid variability; NFC
Sanjay Patel [Thu, 10 Jun 2021 12:47:40 +0000 (08:47 -0400)]
[CodeGen] limit tests to current pass manager to avoid variability; NFC

Post-commit feedback for d69c4372bfbe says the output
may vary between pass managers. This is hopefully a
quick fix, but we might want to investigate how to
better solve this type of problem.

3 years ago[clang-tidy] Allow disabling integer narrowing conversions for cppcoreguidelines...
Guillaume Chatelet [Thu, 10 Jun 2021 12:41:57 +0000 (12:41 +0000)]
[clang-tidy] Allow disabling integer narrowing conversions for cppcoreguidelines-narrowing-conversions

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

3 years ago[InstCombine] Add fold for extracting known elements from a stepvector
Caroline Concatto [Wed, 26 May 2021 08:50:29 +0000 (09:50 +0100)]
[InstCombine] Add fold for extracting known elements from a stepvector

This patch allows folding stepvector + extract to the lane when the lane is
lower than the minimum size of the scalable vector. This fold is possible
because lane X of a stepvector is also X!
For instance, extracting element 3 of a <vscale x 4 x i64>stepvector is 3.

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

3 years ago[ms] [llvm-ml] Make variable redefinition match ML.EXE
Eric Astor [Thu, 10 Jun 2021 12:35:41 +0000 (08:35 -0400)]
[ms] [llvm-ml] Make variable redefinition match ML.EXE

MASM specifies that all variable definitions are redefinable, except for EQU definitions to expressions. (TEXTEQU is unspecified, but appears to be fully redefinable as well.)

Also, in practice, ML.EXE allows redefinitions where the value doesn't change.

Make variable redefinition possible for text macros, suppressing expansion if written as the first argument to an EQU or TEXTEQU directive.

Reviewed By: thakis

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

3 years ago[InstSimplify] Add constant fold for extractelement + splat for scalable vectors
Caroline Concatto [Tue, 11 May 2021 14:22:27 +0000 (15:22 +0100)]
[InstSimplify] Add constant fold for extractelement + splat for scalable vectors

This patch allows that scalable vector can fold extractelement and constant splat
only when the lane index is lower than the minimum number of elements of the vector.

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

3 years ago[llvm] Make Sequence reverse-iterable
Guillaume Chatelet [Thu, 10 Jun 2021 11:15:28 +0000 (11:15 +0000)]
[llvm] Make Sequence reverse-iterable

This is a roll forward of D102679.
This patch simplifies the implementation of Sequence and makes it compatible with llvm::reverse.
It exposes the reverse iterators through rbegin/rend which prevents a dangling reference in std::reverse_iterator::operator++().

Note: Compared to D102679, this patch introduces a `asSmallVector()` member function and fixes compilation issue with GCC 5.

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

3 years ago[NFC][XCOFF] Replace structs FileHeader32/SectionHeader32 with constants.
Esme-Yi [Thu, 10 Jun 2021 11:10:45 +0000 (11:10 +0000)]
[NFC][XCOFF] Replace structs FileHeader32/SectionHeader32 with constants.

Summary: Some structs like FileHeader32/SectionHeader32
defined in llvm/include/llvm/BinaryFormat/XCOFF.h seem
unnecessary, because we only need their size. So this
patch removes them and defines size constants directly.

Reviewed By: jhenderson

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

3 years ago[llvm][PPC] Add missing case for 'I' asm memory operands
Timm Bäder [Thu, 10 Jun 2021 04:48:09 +0000 (06:48 +0200)]
[llvm][PPC] Add missing case for 'I' asm memory operands

From https://llvm.org/docs/LangRef.html#asm-template-argument-modifiers:

I: Print the letter ‘i’ if the operand is an integer constant,
otherwise nothing. Used to print ‘addi’ vs ‘add’ instructions.

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

3 years agoReland "[gn build] port d1d36f7ad (llvm-tapi-diff)"
Nico Weber [Thu, 10 Jun 2021 10:22:03 +0000 (06:22 -0400)]
Reland "[gn build] port d1d36f7ad (llvm-tapi-diff)"

This reverts commit d84ed15c649616a50abdd7fbd9b28ddebb9f432c
The original change relanded in 5b5ab80e3195.

3 years ago[flang][windows] Run regression tests under Windows. NFCI.
Michael Kruse [Thu, 10 Jun 2021 10:06:56 +0000 (05:06 -0500)]
[flang][windows] Run regression tests under Windows. NFCI.

Allow the lit test suite to run under Windows. This encompasses the following changes:

 * Define `lit_tools_dir` for flang's test configuration
 * Replace `(<command> || true)` idiom with `not <command>`
 * Add `REQUIRES: shell` on tests that invoke a shell script

Reviewed By: awarzynski

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

3 years agoRevert "Implementation of global.get/set for reftypes in LLVM IR"
David Spickett [Thu, 10 Jun 2021 10:11:17 +0000 (10:11 +0000)]
Revert "Implementation of global.get/set for reftypes in LLVM IR"

This reverts commit 31859f896cf90d64904134ce7b31230f374c3fcc.

Causing SVE and RISCV-V test failures on bots.

3 years agoFix MSVC int64_t -> uint64_t "narrowing conversion" warning.
Simon Pilgrim [Thu, 10 Jun 2021 09:55:06 +0000 (10:55 +0100)]
Fix MSVC int64_t -> uint64_t "narrowing conversion" warning.

3 years agoAdd explicit braces to silence warning about ambiguous 'else' inside the EXPECT_EQ...
Simon Pilgrim [Wed, 9 Jun 2021 17:19:49 +0000 (18:19 +0100)]
Add explicit braces to silence warning about ambiguous 'else' inside the EXPECT_EQ macro. NFCI.

3 years ago[TargetLowering] getABIAlignmentForCallingConv - pass DataLayout by const reference...
Simon Pilgrim [Wed, 9 Jun 2021 16:30:00 +0000 (17:30 +0100)]
[TargetLowering] getABIAlignmentForCallingConv - pass DataLayout by const reference. NFCI.

Avoid unnecessary copies and match every other method in TargetLowering that takes DataLayout as an argument.

3 years ago[clang][Arm] Require arm and aarch64 target for bf16 intrinsics test
David Spickett [Thu, 10 Jun 2021 09:44:34 +0000 (09:44 +0000)]
[clang][Arm] Require arm and aarch64 target for bf16 intrinsics test

3 years ago[mlir] make LLVMPointerType implement the data layout type interface
Alex Zinenko [Wed, 9 Jun 2021 09:51:15 +0000 (11:51 +0200)]
[mlir] make LLVMPointerType implement the data layout type interface

This brings us closer to replacing the LLVM data layout string with a
first-class layout modeling in MLIR.

Depends On D103945

Reviewed By: nicolasvasilache

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

3 years ago[OpenCL] Relax test implicit members in C++ for OpenCL
Ole Strohm [Thu, 10 Jun 2021 08:36:37 +0000 (09:36 +0100)]
[OpenCL] Relax test implicit members in C++ for OpenCL

Addresses the issue from a comment in D103252

Relaxes the test to account for some targets with added attributes
to inside the pattern.

3 years ago[OpenCL] Add builtin header test
Sven van Haastregt [Thu, 10 Jun 2021 09:05:53 +0000 (10:05 +0100)]
[OpenCL] Add builtin header test

Add a test to verify OpenCL builtin declarations using
OpenCLBuiltins.td.

This test consists of parsing a 60k line generated input file.  The
entire test takes about 60s with a debug build on a decent machine.
Admittedly this is not the fastest test, but doesn't seem excessive
compared to other tests in clang/test/Headers (with one of the tests
taking 85s for example).

RFC: https://lists.llvm.org/pipermail/cfe-dev/2021-April/067973.html

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

3 years agoImplementation of global.get/set for reftypes in LLVM IR
Paulo Matos [Thu, 10 Jun 2021 08:02:10 +0000 (10:02 +0200)]
Implementation of global.get/set for reftypes in LLVM IR

This change implements new DAG notes GLOBAL_GET/GLOBAL_SET, and
lowering methods for load and stores of reference types from IR
globals. Once the lowering creates the new nodes, tablegen pattern
matches those and converts them to Wasm global.get/set.

Reviewed By: tlively

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

3 years agoRevert "[Verifier] Speed up and parallelize dominance checking. NFC"
Alexander Kornienko [Thu, 10 Jun 2021 07:58:05 +0000 (09:58 +0200)]
Revert "[Verifier] Speed up and parallelize dominance checking.  NFC"

This reverts commit 08664d005c02003180371049b19c7e5d01541c58, which according to
https://reviews.llvm.org/D103373 was pushed accidentally, and I believe it
causes timeouts in some internal mlir tests.

3 years agoRevert "[AArch64LoadStoreOptimizer] Generate more STPs by renaming registers earlier"
Martin Storsjö [Thu, 10 Jun 2021 07:30:13 +0000 (10:30 +0300)]
Revert "[AArch64LoadStoreOptimizer] Generate more STPs by renaming registers earlier"

This reverts commit d96ea46629803641038ebe46d8cd512f8cf7e20f, as it
caused various misoptimizations, see https://reviews.llvm.org/D103597
for discussion on the issues.

3 years ago[LangRef] Fix missing code highlighting format
Juneyoung Lee [Thu, 10 Jun 2021 07:11:43 +0000 (16:11 +0900)]
[LangRef] Fix missing code highlighting format

3 years ago[XCOFF][llvm-objdump] Dump the debug type in `--section-headers` option.
Esme-Yi [Thu, 10 Jun 2021 07:08:23 +0000 (07:08 +0000)]
[XCOFF][llvm-objdump] Dump the debug type in `--section-headers` option.

Summary: Add XCOFF recognition of debug section types
under `--section-headers` option.

Reviewed By: jhenderson

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

3 years ago[mlir] Support pre-existing tokens in 'gpu-async-region'
Christian Sigg [Thu, 10 Jun 2021 05:50:29 +0000 (07:50 +0200)]
[mlir] Support pre-existing tokens in 'gpu-async-region'

Allow gpu ops implementing the async interface to already be async when running the GpuAsyncRegionPass.
That pass threads a 'current token' through a block with ops implementing the gpu async interface.

After this change, existing async ops (returning a !gpu.async.token) set the current token.
Existing synchronous `gpu.wait` ops reset the current token.

Reviewed By: herhut

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

3 years ago[NFC] Pre-commit tests for VectorCombine scalarize
Qiu Chaofan [Thu, 10 Jun 2021 06:28:33 +0000 (14:28 +0800)]
[NFC] Pre-commit tests for VectorCombine scalarize

3 years ago[Docs] Fix incorrect return type for example code
Jim Lin [Thu, 10 Jun 2021 03:30:31 +0000 (11:30 +0800)]
[Docs] Fix incorrect return type for example code

3 years agoUpdate my mailmap
Qiu Chaofan [Thu, 10 Jun 2021 06:14:57 +0000 (14:14 +0800)]
Update my mailmap