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

3 years ago[libcxx][optional] adds missing constexpr operations
Christopher Di Bella [Sun, 9 May 2021 01:30:32 +0000 (01:30 +0000)]
[libcxx][optional] adds missing constexpr operations

Makes the following operations constexpr:
  * `std::swap(optional, optional)`
  * `optional(optional<U> const&)`
  * `optional(optional<U>&&)`
  * `~optional()`
  * `operator=(nullopt_t)`
  * `operator=(U&&)`
  * `operator=(optional<U> const&)`
  * `operator=(optional<U>&&)`
  * `emplace(Args&&...)`
  * `emplace(initializer_list<U>, Args&&...)`
  * `swap(optional&)`
  * `reset()`

P2231 has been accepted by plenary, with the committee recommending
implementers retroactively apply to C++20. It's necessary for us to
implement _`semiregular-box`_ and _`non-propagating-cache`_, both of
which are required for ranges (otherwise we'll need to reimplement
`std::optional` with these members `constexpr`ified).

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

3 years ago[libc] Remove libc-fuzzer as a dependency to check-libc.
Siva Chandra Reddy [Thu, 10 Jun 2021 05:05:11 +0000 (05:05 +0000)]
[libc] Remove libc-fuzzer as a dependency to check-libc.

3 years ago[ConstantFolding] Enable folding of min/max/copysign for all floats
Serge Pavlov [Wed, 9 Jun 2021 03:49:17 +0000 (10:49 +0700)]
[ConstantFolding] Enable folding of min/max/copysign for all floats

Previously such folding was enabled for half, float and double values
only. With this change it is allowed for other floating point values
also.

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

3 years ago[Utils][vim] Highlight 'ptr' type
Tom Stellard [Fri, 14 May 2021 03:54:04 +0000 (20:54 -0700)]
[Utils][vim] Highlight 'ptr' type

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

3 years ago[llvm-objdump][XCOFF] Enable the -l (--line-numbers) option.
Esme-Yi [Thu, 10 Jun 2021 04:37:06 +0000 (04:37 +0000)]
[llvm-objdump][XCOFF] Enable the -l (--line-numbers) option.

Summary: Add support for dumping line number
information for XCOFF object files in llvm-objdump.

Reviewed By: jhenderson

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

3 years agoReland "[llvm] llvm-tapi-diff"
Sam Powell [Thu, 10 Jun 2021 04:13:31 +0000 (21:13 -0700)]
Reland "[llvm] llvm-tapi-diff"

This is relanding commit d1d36f7ad2ae82bea8a6fcc40d6c42a72e21f096 .
This patch additionally addresses failures found in buildbots due to unstable build ordering & post review comments.

This patch introduces a new tool, llvm-tapi-diff, that compares and returns the diff of two TBD files.

Reviewed By: ributzka, JDevlieghere

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

3 years ago[HIP] Add --gpu-bundle-output
Yaxun (Sam) Liu [Thu, 29 Apr 2021 19:10:06 +0000 (15:10 -0400)]
[HIP] Add --gpu-bundle-output

Added --gpu-bundle-output to control bundling/unbundling output of HIP device compilation.

By default preprocessor expansion, llvm bitcode and assembly are unbundled, code objects are
bundled.

Reviewed by: Artem Belevich, Jan Svoboda

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

3 years ago[AMDGPU] Fix missing lowering of LDS used in global scope.
hsmahesha [Thu, 10 Jun 2021 02:30:23 +0000 (08:00 +0530)]
[AMDGPU] Fix missing lowering of LDS used in global scope.

Reviewed By: rampitec

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

3 years ago[AIX] Add traceback ssp canary bit support
Jinsong Ji [Thu, 10 Jun 2021 02:39:57 +0000 (02:39 +0000)]
[AIX] Add traceback ssp canary bit support

We will need to set the ssp canary bit in traceback table to communicate
with unwinder about the canary.

Reviewed By: #powerpc, shchenz

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

3 years ago[lld/mac] Print dylib search details with --print-dylib-search or RC_TRACE_DYLIB_SEAR...
Nico Weber [Wed, 9 Jun 2021 19:16:45 +0000 (15:16 -0400)]
[lld/mac] Print dylib search details with --print-dylib-search or RC_TRACE_DYLIB_SEARCHING

For debugging dylib loading, it's useful to have some insight into what
the linker is doing.

ld64 has the undocumented RC_TRACE_DYLIB_SEARCHING env var
for this printing dylib search candidates.

This adds a flag --print-dylib-search to make lld print the seame information.
It's useful for users, but also for writing tests. The output is formatted
slightly differently than ld64, but we still support RC_TRACE_DYLIB_SEARCHING
to offer at least a compatible way to trigger this.

ld64 has both `-print_statistics` and `-trace_symbol_output` to enable
diagnostics output. I went with "print" since that seems like a more
straightforward name.

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

3 years ago[libomptarget][amdgpu] Remove stray fprintf in rtl.cpp
Ron Lieberman [Thu, 10 Jun 2021 01:52:45 +0000 (01:52 +0000)]
[libomptarget][amdgpu] Remove stray fprintf in rtl.cpp

remove unintended fprintf in rtl.cpp

Reviewed By: pdhaliwal

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

3 years agoAdd .mailmap entries for myself, and sort the list
Jon Roelofs [Thu, 10 Jun 2021 01:35:13 +0000 (18:35 -0700)]
Add .mailmap entries for myself, and sort the list

3 years ago[clang][RISCV][test] Add more tests of the -mabi and -march options
Ben Shi [Thu, 10 Jun 2021 01:14:14 +0000 (09:14 +0800)]
[clang][RISCV][test] Add more tests of the -mabi and -march options

1. There is no tests for mabi=ilp32e, and my patch covers that.
2. The tests in riscv-abi.c will show default ABI changes for special archs
   in the future, especially the arch with the F but without the D extension.
3. The tests in riscv-arch.c will show default arch changes for abi=ilp32,
   which is rv32imacfd currently, but it is better to be rv32imac.
   And it is also better for abi=ilp32f defaults to arch=imacf.

Reviewed By: MaskRay, luismarques

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

3 years agoAnnotate memcpy's of globals with info about the src/dst
Jon Roelofs [Wed, 9 Jun 2021 23:36:38 +0000 (16:36 -0700)]
Annotate memcpy's of globals with info about the src/dst

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

3 years agoSave/restore OuterTemplateParams in AbstractManglingParser::parseEncoding.
Justin Lebar [Wed, 9 Jun 2021 23:57:22 +0000 (16:57 -0700)]
Save/restore OuterTemplateParams in AbstractManglingParser::parseEncoding.

Previously we were only saving plain TemplateParams.

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

3 years ago[lld/mac] Make framework symlinks in tests more realistic
Nico Weber [Thu, 10 Jun 2021 00:27:55 +0000 (20:27 -0400)]
[lld/mac] Make framework symlinks in tests more realistic

In a framework Foo.framework, Foo.framework/Foo is usually a relative
symbolic link to Foo.framework/Versions/Current/Foo,
and Foo.framework/Versions/Current is usually a relative symbolic
link to A.

Our tests used absolute symbolic links. Now they use relative symbolic links.

No behavior change, just makes the tests more representative of the real world.

(implicit-dylib.s omits the "Current" folder too, but I'm not changing that
here.)

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

3 years ago[lld/mac] When handling @loader_path, use realpath() of symlinks
Nico Weber [Wed, 9 Jun 2021 20:09:44 +0000 (16:09 -0400)]
[lld/mac] When handling @loader_path, use realpath() of symlinks

This is important for Frameworks, which are usually symlinks.

ld64 gets this right for @rpath that's replaced with @loader_path, but not for
bare @loader_path -- ld64's code calls realpath() in that case too, but ignores
the result.

ld64 somehow manages to find libbar1.dylib in the test without the
explicit `-rpath` in Foo1. I don't understand why or how. But this
change is a step forward and fixes an immediate problem I'm having,
so let's start with this :)

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

3 years agoFix to Windows temp file change.
Amy Huang [Wed, 9 Jun 2021 23:11:27 +0000 (16:11 -0700)]
Fix to Windows temp file change.

Original change passed wrong parameters to the raw_fd_ostream ctor.
Fixes a bug in https://reviews.llvm.org/D102736.

3 years agoFolds linalg.pad_tensor with zero padding
Ahmed Taei [Wed, 9 Jun 2021 19:04:38 +0000 (12:04 -0700)]
Folds linalg.pad_tensor with zero padding

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

3 years ago[RISCV] Remove unused method from RISCVInsertVSETVLI. NFC
Craig Topper [Wed, 9 Jun 2021 22:07:27 +0000 (15:07 -0700)]
[RISCV] Remove unused method from RISCVInsertVSETVLI. NFC

If this becomes needed its trivial to add it back.

3 years ago[tests] Precommit test for D103991
Philip Reames [Mon, 7 Jun 2021 23:20:25 +0000 (16:20 -0700)]
[tests] Precommit test for D103991

3 years ago[ms] [llvm-ml] Add support for INCLUDE environment variable
Eric Astor [Wed, 9 Jun 2021 20:05:12 +0000 (16:05 -0400)]
[ms] [llvm-ml] Add support for INCLUDE environment variable

Also adds support for the ML.exe command-line flag /X, which ignores the INCLUDE environment variable.

This relands commit c43f413b01b021a8f7b6fce013296114fa92a245 using lit's cross-platform `env` support.

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

3 years agoAdd a static assertions for custom Op<> to not defined data members (NFC)
Mehdi Amini [Tue, 8 Jun 2021 18:28:39 +0000 (18:28 +0000)]
Add a static assertions for custom Op<> to not defined data members (NFC)

A common mistake for newcomers to MLIR is to try to store extra member
on the Op class. However these are intended to be thing wrapper around
an Operation*, all the storage is meant to be encoded in attribute on
the underlying Operation. This can be confusing to debug, so better
catch it at build time.

Reviewed By: ftynse

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

3 years ago[SCEV] Minor code motion to simplify a later patch [nfc]
Philip Reames [Wed, 9 Jun 2021 21:17:06 +0000 (14:17 -0700)]
[SCEV] Minor code motion to simplify a later patch [nfc]

3 years agoRevert "Reland "[llvm] llvm-tapi-diff""
Cyndy Ishida [Wed, 9 Jun 2021 20:46:12 +0000 (13:46 -0700)]
Revert "Reland "[llvm] llvm-tapi-diff""

This reverts commit 20126c9fd4afe2fe11510becccaa769332da302f.
The sorting fixes failed to have stable output on different platforms.

3 years agoRevert "[llvm-tapi-diff] Apply stable sorting to output"
Cyndy Ishida [Wed, 9 Jun 2021 20:45:13 +0000 (13:45 -0700)]
Revert "[llvm-tapi-diff] Apply stable sorting to output"

This reverts commit 90a26a41e9ce16a4d471d25c2f7b36b5538fb4ce.
This failed to fix ubuntu failures.

3 years agoCleanup for final comment on https://reviews.llvm.org/D103304
Kevin Athey [Wed, 9 Jun 2021 14:26:38 +0000 (07:26 -0700)]
Cleanup for final comment on https://reviews.llvm.org/D103304

Consolidate DEFINE_STACK_MALLOC to simplify.

Reviewed By: vitalybuka

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

3 years ago[clang-tidy] performance-unnecessary-copy-initialization: Look at the canonical type...
Felix Berger [Mon, 24 May 2021 13:14:59 +0000 (09:14 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Look at the canonical type when checking for aliases.

This fixes a false positive case where for instance a pointer is obtained and declared using `auto`.

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

Reviewed-by: ymandel
3 years ago[Polly][Matmul] Re-pack A in every iteration.
Michael Kruse [Sun, 6 Jun 2021 11:26:24 +0000 (06:26 -0500)]
[Polly][Matmul] Re-pack A in every iteration.

Packed_A must be copied repeatedly, not just for the first iteration of
the outer tile.

This fixes llvm.org/PR50557

3 years ago[Attributor] Set floating point loads and stores as nofree in AANoFreeFloating
Joseph Huber [Wed, 9 Jun 2021 18:43:59 +0000 (14:43 -0400)]
[Attributor] Set floating point loads and stores as nofree in AANoFreeFloating

Summary:
The current implementation of AANoFreeFloating will incorrectly list floating
point loads and stores as may-free. This prevents other attributor instances
like HeapToStack from pushing some allocations to the stack.

Reviewed By: jdoerfert

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

3 years ago[OpenMP][NFC] Precommit change to hide_mem_transfer_latency test flags
Joseph Huber [Wed, 9 Jun 2021 18:32:56 +0000 (14:32 -0400)]
[OpenMP][NFC] Precommit change to hide_mem_transfer_latency test flags

3 years ago[llvm-tapi-diff] Apply stable sorting to output
Sam Powell [Wed, 9 Jun 2021 20:06:32 +0000 (13:06 -0700)]
[llvm-tapi-diff] Apply stable sorting to output

* For the output, the attributes within the target slice should be
  grouped by the input order, then sorted by value ordering.
This is to fix current ubuntu buildbot inconsistences.

3 years ago[compiler-rt][hwasan] Decouple use of the TLS global for getting the shadow base...
Leonard Chan [Mon, 7 Jun 2021 21:27:07 +0000 (14:27 -0700)]
[compiler-rt][hwasan] Decouple use of the TLS global for getting the shadow base and using the frame record feature

This allows for using the frame record feature (which uses __hwasan_tls)
independently from however the user wants to access the shadow base, which
prior was only usable if shadow wasn't accessed through the TLS variable or ifuncs.

Frame recording can be explicitly set according to ShadowMapping::WithFrameRecord
in ShadowMapping::init. Currently, it is only enabled on Fuchsia and if TLS is
used, so this should mimic the old behavior.

Added an extra case to prologue.ll that covers this new case.

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

3 years ago[clang-tidy] performance-unnecessary-copy-initialization: Remove the complete stateme...
Felix Berger [Mon, 10 May 2021 15:26:00 +0000 (11:26 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Remove the complete statement when the copied variable is unused.

It is not useful to keep the statement around and can lead to compiler
warnings when -Wall (-Wunused-variable specifically) turned on.

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

Reviewed-by: ymandel
3 years agoRevert "[ms] [llvm-ml] Add support for INCLUDE environment variable"
Eric Astor [Wed, 9 Jun 2021 19:49:51 +0000 (15:49 -0400)]
Revert "[ms] [llvm-ml] Add support for INCLUDE environment variable"

This reverts commit c43f413b01b021a8f7b6fce013296114fa92a245 due to Windows environment build breaks

3 years ago[ms] [llvm-ml] Add support for INCLUDE environment variable
Eric Astor [Wed, 9 Jun 2021 18:41:24 +0000 (14:41 -0400)]
[ms] [llvm-ml] Add support for INCLUDE environment variable

Also adds support for the ML.exe command-line flag /X, which ignores the INCLUDE environment variable.