platform/upstream/llvm.git
15 months ago[NFC] Fix release notes about ASan
Advenam Tacet [Mon, 24 Jul 2023 19:00:56 +0000 (21:00 +0200)]
[NFC] Fix release notes about ASan

Existing notes were not fully correct and were missing a detail:
- `std::vector` was annotated long time ago,
- `std::deque` annotations are new,
- now container annotations were extended to all allocators (support in ASan API exists since LLVM16).

Reviewed By: philnik, #libc

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

15 months ago[bazel] Add UPToSPIRV library/dep
Jordan Rupprecht [Tue, 25 Jul 2023 02:33:33 +0000 (19:33 -0700)]
[bazel] Add UPToSPIRV library/dep

Added in D156163

15 months ago[clang-format] Add SpacesInParens with SpacesInParensOptions
Gedare Bloom [Tue, 25 Jul 2023 02:13:33 +0000 (19:13 -0700)]
[clang-format] Add SpacesInParens with SpacesInParensOptions

This is a refactoring of:
- SpacesInConditionalStatement
- SpacesInCStyleCastParentheses
- SpaceInEmptyParentheses
- SpacesInParentheses

These are now options under the new Style Option: SpacesInParens. The
existing options are maintained for backward compatibility.

Within SpacesInParens, there are currently options for:
- Never
- Custom

The currently available options for Custom are:
- InConditionalStatements
- InCStyleCasts
- InEmptyParentheses
- Other

Setting InConditionalStatements and Other to true enables the same space
additions as SpacesInParentheses.

This refactoring does not add or remove any existing features, but it makes
it possible to more easily extend and maintain the addition of spaces within
parentheses.

Related to #55428.

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

15 months ago[RISCV] Add a common class for cm.push, cm.popret, cm.popretz and cm.pop.
Jim Lin [Tue, 25 Jul 2023 00:31:04 +0000 (08:31 +0800)]
[RISCV] Add a common class for cm.push, cm.popret, cm.popretz and cm.pop.

Reviewed By: craig.topper

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

15 months ago[LoongArch] Implement isSExtCheaperThanZExt
WANG Rui [Tue, 25 Jul 2023 01:39:47 +0000 (09:39 +0800)]
[LoongArch] Implement isSExtCheaperThanZExt

Implement isSExtCheaperThanZExt.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Differential Revision: https://reviews.llvm.org/D154919

15 months ago[clang-format] Add AlignConsecutiveShortCaseStatements
Galen Elias [Tue, 25 Jul 2023 01:05:51 +0000 (18:05 -0700)]
[clang-format] Add AlignConsecutiveShortCaseStatements

This adds a new AlignConsecutiveShortCaseStatements option in line with the
existing AlignConsecutive* options , which when
AllowShortCaseLabelsOnASingleLine is enabled will align the tokens after the
case statement's colon. This also adds a AlignCaseColons option to allow
aligning the case label colon itself rather than the token after it.

Fixes #55475.

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

15 months agoRevert "[clang-format] Add AlignConsecutiveShortCaseStatements"
Owen Pan [Tue, 25 Jul 2023 01:36:53 +0000 (18:36 -0700)]
Revert "[clang-format] Add AlignConsecutiveShortCaseStatements"

This reverts commit 4ba00844174db562d2bd8b15dab6aac605eddf57.

15 months ago[LoongArch] Add test case showing suboptimal codegen when zero extending
WANG Rui [Tue, 25 Jul 2023 01:22:18 +0000 (09:22 +0800)]
[LoongArch] Add test case showing suboptimal codegen when zero extending

Add test case showing suboptimal codegen when zero extending.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: xen0n

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

15 months agoRevert "Revert "[clang-format] Add AlignConsecutiveShortCaseStatements""
Owen Pan [Tue, 25 Jul 2023 01:24:30 +0000 (18:24 -0700)]
Revert "Revert "[clang-format] Add AlignConsecutiveShortCaseStatements""

This reverts commit 4f093b31669a4f8e417259583141159586a05b28.

15 months agoRevert "[clang-format] Add AlignConsecutiveShortCaseStatements"
Owen Pan [Tue, 25 Jul 2023 01:18:27 +0000 (18:18 -0700)]
Revert "[clang-format] Add AlignConsecutiveShortCaseStatements"

This reverts commit 4ba00844174db562d2bd8b15dab6aac605eddf57 due to missing
authorship.

15 months agoRevert "[Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC...
Weining Lu [Tue, 25 Jul 2023 01:16:28 +0000 (09:16 +0800)]
Revert "[Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC behaviour"

This reverts commit c299efbf284fae92bb8d7d29110f76912f089daf.

Reason to revert: D142327 has been reverted which is depended by this
change.

15 months agoUpdate ODS variadic segments "magic" attributes to use native Properties
Mehdi Amini [Fri, 21 Jul 2023 05:51:35 +0000 (22:51 -0700)]
Update ODS variadic segments "magic" attributes to use native Properties

The operand_segment_sizes and result_segment_sizes Attributes are now inlined
in the operation as native propertie. We continue to support building an
Attribute on the fly for `getAttr("operand_segment_sizes")` and setting the
property from an attribute with `setAttr("operand_segment_sizes", attr)`.

A new bytecode version is introduced to support backward compatibility and
backdeployments.

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

15 months ago[clang-format] Add AlignConsecutiveShortCaseStatements
Owen Pan [Tue, 25 Jul 2023 01:05:51 +0000 (18:05 -0700)]
[clang-format] Add AlignConsecutiveShortCaseStatements

This adds a new AlignConsecutiveShortCaseStatements option in line with the
existing AlignConsecutive* options , which when
AllowShortCaseLabelsOnASingleLine is enabled will align the tokens after the
case statement's colon. This also adds a AlignCaseColons option to allow
aligning the case label colon itself rather than the token after it.

Fixes #55475.

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

15 months ago[LoongArch] Support InlineAsm for LSX and LASX
chenli [Tue, 25 Jul 2023 01:02:14 +0000 (09:02 +0800)]
[LoongArch] Support InlineAsm for LSX and LASX

The author of the following files is licongtian <licongtian@loongson.cn>:
- clang/lib/Basic/Targets/LoongArch.cpp
- llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
- llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp

The files mentioned above implement InlineAsm for LSX and LASX as follows:
- Enable clang parsing LSX/LASX register name, such as $vr0.
- Support the case which operand type is 128bit or 256bit when the
  constraints is 'f'.
- Support the way of specifying LSX/LASX register by using constraint,
  such as "={$xr0}".
- Support the operand modifiers 'u' and 'w'.
- Support and legalize the data types and register classes involved in
  LSX/LASX in the lowering process.

Reviewed By: xen0n, SixWeining

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

15 months ago[Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC behaviour
Weining Lu [Tue, 25 Jul 2023 00:58:41 +0000 (08:58 +0800)]
[Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC behaviour

GCC doesn't ignore non-zero-length array of empty structures in C++
while clang does. What this patch did is to match GCC's behaviour
although this rule is not documented in psABI.

Similar to D142327 for RISCV.

Reviewed By: xry111, xen0n

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

15 months ago[Clang][LoongArch] Pre-commit test for D156116
Weining Lu [Tue, 25 Jul 2023 00:58:32 +0000 (08:58 +0800)]
[Clang][LoongArch] Pre-commit test for D156116

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

15 months agoCleanup CMake dependencies from unnecessary libraries in mlir/test/lib/Dialect/GPU...
Mehdi Amini [Tue, 25 Jul 2023 00:57:55 +0000 (17:57 -0700)]
Cleanup CMake dependencies from unnecessary libraries in mlir/test/lib/Dialect/GPU/CMakeLists.txt (NFC)

15 months ago[OpenMP] Add OMPT release note
Michael Halkenhaeuser [Tue, 25 Jul 2023 00:35:16 +0000 (20:35 -0400)]
[OpenMP] Add OMPT release note

OMPT release note addition for LLVM 17

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

15 months ago[OpenMP] [OMPT] [7/8] Invoke tool-supplied callbacks before and after target launch...
Michael Halkenhaeuser [Mon, 24 Jul 2023 23:56:02 +0000 (19:56 -0400)]
[OpenMP] [OMPT] [7/8] Invoke tool-supplied callbacks before and after target launch and data transfer operations

Implemented RAII objects, initialized at target entry points, that
invoke tool-supplied callbacks. Updated status of target callbacks as
implemented.

Depends on D127365

Patch from John Mellor-Crummey <johnmc@rice.edu>
With contributions from:
Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>
Jan-Patrick Lehr <janpatrick.lehr@amd.com>

Reviewed By: jdoerfert, dhruvachak

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

15 months agoRevert "[mlir][gpu][transforms] Only depend on ExecutionEngine if MLIR_ENABLE_CUDA_RU...
Mehdi Amini [Tue, 25 Jul 2023 00:18:55 +0000 (17:18 -0700)]
Revert "[mlir][gpu][transforms] Only depend on ExecutionEngine if MLIR_ENABLE_CUDA_RUNNER is true"

This reverts commit 68b7d3fffd7e8ebc40fdcb0acdcf2e88a93ea5c3.
The mlir-nvidia bot is broken.

15 months ago[llvm-objdump][test] Improve elf-aarch64-mapping-symbols.test
Fangrui Song [Tue, 25 Jul 2023 00:21:28 +0000 (17:21 -0700)]
[llvm-objdump][test] Improve elf-aarch64-mapping-symbols.test

15 months ago[PowerPC][AIX] Enable quadword atomics by default for AIX
Kai Luo [Tue, 25 Jul 2023 00:08:53 +0000 (08:08 +0800)]
[PowerPC][AIX] Enable quadword atomics by default for AIX

On AIX, a libatomic supporting inline quadword atomic operations has been released, so that compatibility is not an issue now, we can enable quadword atomics by default.

Reviewed By: #powerpc, nemanjai

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

15 months ago[builtins] Avoid using CRT_LDBL_128BIT in implementation. NFC
Alex Richardson [Mon, 24 Jul 2023 23:41:44 +0000 (16:41 -0700)]
[builtins] Avoid using CRT_LDBL_128BIT in implementation. NFC

Currently the *tf builtin functions can only be built if long double is an
IEEE float, which prevents them from being available e.g. for x86 targets
(unlike libgcc which has them). This non-functional change prepares the
builtins library *tf functions for being able to target x86 by decoupling
their presence from CRT_LDBL_128BIT and instead checking for a
CRT_HAS_TF_MODE macro. This change is NFC since the CRT_HAS_TF_MODE is
currently only set if long double is an IEEE 128-bit float.

Reviewed By: compnerd

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

15 months ago[builtins] Drop -fnested-functions flag from tests
Alex Richardson [Mon, 26 Jun 2023 21:58:29 +0000 (14:58 -0700)]
[builtins] Drop -fnested-functions flag from tests

This flag does nothing for clang and is apparently not supported by GCC:
aarch64-linux-gnu-gcc: error: unrecognized command-line option '-fnested-functions'; did you mean '-Wunused-function'?
It looks like it was maybe supported by Apple GCC, but that is no longer
a supported compiler.

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

15 months ago[builtins] Fix building trunc*fhf2_test with GCC
Alex Richardson [Mon, 26 Jun 2023 18:09:34 +0000 (11:09 -0700)]
[builtins] Fix building trunc*fhf2_test with GCC

GCC does not support __fp16, use the TYPE_FP16 macro instead.

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

15 months agoConstantFolding: Constant fold denormal inputs to canonicalize for IEEE
Matt Arsenault [Sat, 22 Jul 2023 12:12:23 +0000 (08:12 -0400)]
ConstantFolding: Constant fold denormal inputs to canonicalize for IEEE

This makes it possible to use canonicalize to perform a dynamic check
for whether denormal flushing is enabled, which will fold out when the
denormal mode is known. Previously it would only fold if denormal
flushing were known enabled.

https://reviews.llvm.org/D156107

15 months ago[mlir][gpu][transforms] Only depend on ExecutionEngine if MLIR_ENABLE_CUDA_RUNNER...
Nicolas Vasilache [Mon, 24 Jul 2023 23:26:00 +0000 (01:26 +0200)]
[mlir][gpu][transforms] Only depend on ExecutionEngine if MLIR_ENABLE_CUDA_RUNNER is true

This fixes a compilation bug where we would try to depend on ExecutionEngine but it wasn't actually built.

15 months ago[mlir][linalg] NFC - Move some utils in preparation for revamping mapping of scf...
Nicolas Vasilache [Mon, 24 Jul 2023 22:50:42 +0000 (00:50 +0200)]
[mlir][linalg] NFC - Move some utils in preparation for revamping mapping of scf.forall

15 months ago[NFC] Add MprotectReadWrite
Vitaly Buka [Mon, 24 Jul 2023 22:52:16 +0000 (15:52 -0700)]
[NFC] Add MprotectReadWrite

It's unused, but I need it for debuging.
Seems usefull for completeness.

Reviewed By: thurston

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

15 months ago[mlir][spirv] Convert `ub.poison` to `spirv.undef`
Ivan Butygin [Mon, 24 Jul 2023 19:35:28 +0000 (21:35 +0200)]
[mlir][spirv] Convert `ub.poison` to `spirv.undef`

SPIR-V doesn't have poison, but poison can be converted to undef.

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

15 months ago[libc++][hardening] Categorize more assertions.
varconst [Mon, 24 Jul 2023 21:56:44 +0000 (14:56 -0700)]
[libc++][hardening] Categorize more assertions.

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

15 months ago[TextAPI] Remove TBD file attributes that aren't used anymore.
Cyndy Ishida [Mon, 24 Jul 2023 21:25:21 +0000 (14:25 -0700)]
[TextAPI] Remove TBD file attributes that aren't used anymore.

UUID's & `installapi` flag are no longer useful in recent apple linker/tapi.
The reason for removing them is that these are attributes that record
how a library was built but not really about the library itself. TBD
files now only track information this is important as link time
dependencies.

Reviewed By: ributzka

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

15 months ago clang: Add elementwise pow builtin
Joshua Batista [Mon, 24 Jul 2023 20:09:21 +0000 (13:09 -0700)]
 clang: Add elementwise pow builtin

Add codegen for llvm pow elementwise builtin
The pow elementwise builtin is necessary for HLSL codegen.
Tests were added to make sure that the expected errors are encountered when these functions are given inputs of incompatible types, or too many inputs.
The new builtin is restricted to floating point types only.

Reviewed By: arsenm

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

15 months ago[OpenMP] Move KMP_VERSION printout logic to post-serial-init
Jonathan Peyton [Thu, 6 Jul 2023 20:05:59 +0000 (15:05 -0500)]
[OpenMP] Move KMP_VERSION printout logic to post-serial-init

Get the KMP_VERSION printout logic out of environment variable file
(kmp_settings.cpp) and move to end of serial initialization where
KMP_SETTINGS and OMP_DISPLAY_ENV are.

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

15 months ago[OpenMP] Restore comment accidently deleted in D154650
Jonathan Peyton [Mon, 24 Jul 2023 21:01:03 +0000 (16:01 -0500)]
[OpenMP] Restore comment accidently deleted in D154650

15 months ago[OpenMP] Re-use affinity raii class in worker spawning
Jonathan Peyton [Thu, 6 Jul 2023 18:50:34 +0000 (13:50 -0500)]
[OpenMP] Re-use affinity raii class in worker spawning

Get rid of explicit mask alloc, getthreadaffinity, set temp affinity,
reset to old affinity, dealloc steps in favor of existing
kmp_affinity_raii_t to push/pop a temporary affinity.

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

15 months agoRevert "[llvm-objdump] [NFC] Factor out DisassemblerTarget class."
Jacek Caban [Mon, 24 Jul 2023 20:49:58 +0000 (22:49 +0200)]
Revert "[llvm-objdump] [NFC] Factor out DisassemblerTarget class."

This reverts commit 6c48f57c14dcfe2410afcb4c6778dcbb40d294b5.

Build broken on GCC.

15 months ago[clang][ConstantEmitter] have tryEmitPrivate[ForVarInit] try ConstExprEmitter fast...
Nick Desaulniers [Mon, 24 Jul 2023 20:40:14 +0000 (13:40 -0700)]
[clang][ConstantEmitter] have tryEmitPrivate[ForVarInit] try ConstExprEmitter fast-path first

As suggested by @efriedma in:
https://reviews.llvm.org/D76096#4370369

This should speed up evaluating whether an expression is constant or
not, but due to the complexity of these two different implementations,
we may start getting different answers for edge cases for which we do
not yet have test cases in-tree (or perhaps even performance regressions
for some cases). As such, contributors have carte blanche to revert if
necessary.

For additional historical context about ExprConstant vs CGExprConstant,
here's snippets from a private conversation on discord:

  ndesaulniers:
  why do we have clang/lib/AST/ExprConstant.cpp and
  clang/lib/CodeGen/CGExprConstant.cpp? Does clang constant fold during
  ast walking/creation AND during LLVM codegen?
  efriedma:
  originally, clang needed to handle two things: integer constant
  expressions (the "5" in "int x[5];"), and constant global initializers
  (the "5" in "int x = 5;").  pre-C++11, the two could be handled mostly
  separately; so we had the code for integer constants in AST/, and the
  code for globals in CodeGen/.  C++11 constexpr sort of destroyed that
  separation, though. so now we do both kinds of constant evaluation on
  the AST, then CGExprConstant translates the result of that evaluation
  to LLVM IR.  but we kept around some bits of the old cgexprconstant to
  avoid performance/memory usage regressions on large arrays.

Reviewed By: efriedma

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

15 months ago[RISCV] Add lowering for scalar fmaximum/fminimum.
Craig Topper [Mon, 24 Jul 2023 20:38:51 +0000 (13:38 -0700)]
[RISCV] Add lowering for scalar fmaximum/fminimum.

Unlike fmaxnum and fminnum, these operations propagate nan and
consider -0.0 to be less than +0.0.

Without Zfa, we don't have a single instruction for this. The
lowering I've used forces the other input to nan if one input
is a nan. If both inputs are nan, they get swapped. Then use
the fmax or fmin instruction.

New ISD nodes are needed because fmaxnum/fminnum to not define
the order of -0.0 and +0.0.

This lowering ensures the snans are quieted though that is probably not
required in default environment). Also ensures non-canonical nans
are canonicalized, though I'm also not sure that's needed.

Another option could be to use fmax/fmin and then overwrite the
result based on the inputs being nan, but I'm not sure we can do
that with any less code.

Future work will handle nonans FMF, and handling the case where
we can prove the input isn't nan.

This does fix the crash in #64022, but we need to do more work
to avoid scalarization.

Reviewed By: fakepaper56

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

15 months ago[llvm-objdump] [NFC] Factor out DisassemblerTarget class.
Jacek Caban [Wed, 19 Apr 2023 21:39:53 +0000 (23:39 +0200)]
[llvm-objdump] [NFC] Factor out DisassemblerTarget class.

This is a preparation for ARM64EC/ARM64X binaries, which may contain both ARM64
and x86_64 code in the same file. llvm-objdump already has partial support for
mixing disassemblers for ARM thumb mode support. However, for ARM64EC we can't
share MCContext, MCInstrAnalysis and PrettyPrinter instances. This patch
provides additional abstraction which makes adding mixed code support later in
the series easier.

Reviewed By: jhenderson, MaskRay
Differential Revision: https://reviews.llvm.org/D149093

15 months ago[clang-tidy] Initialize DiagnosticEngine in ExpandModularHeaders
Piotr Zegar [Mon, 24 Jul 2023 19:43:47 +0000 (19:43 +0000)]
[clang-tidy] Initialize DiagnosticEngine in ExpandModularHeaders

Fix issue preventing suppression of compiler warnings with
-Wno-<warning> under C++20 and above. Add call to
ProcessWarningOptions and propagate DiagnosticOpts more properly.

Fixes: #56709, #61969

Reviewed By: carlosgalvezp

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

15 months ago[clang-tidy] Add folly::Optional to unchecked-optional-access
Anton Dukeman [Mon, 24 Jul 2023 19:14:35 +0000 (19:14 +0000)]
[clang-tidy] Add folly::Optional to unchecked-optional-access

The unchecked-optional-access check identifies attempted value
unwrapping without checking if the value exists. These changes extend
that support to checking folly::Optional.

Reviewed By: gribozavr2

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

15 months ago[RISCV] Adjust memcpy lowering test coverage w/V
Philip Reames [Mon, 24 Jul 2023 19:30:25 +0000 (12:30 -0700)]
[RISCV] Adjust memcpy lowering test coverage w/V

This is fixing a mistake in 4f4f49137.

15 months agoRevert "Update ODS variadic segments "magic" attributes to use native Properties"
Mehdi Amini [Mon, 24 Jul 2023 19:27:01 +0000 (12:27 -0700)]
Revert "Update ODS variadic segments "magic" attributes to use native Properties"

This reverts commit 20b93abca6516bbb23689c3777536fea04e46e14.

One python test is broken, WIP.

15 months ago[Driver][test] Remove XRay/lit.local.cfg
Fangrui Song [Mon, 24 Jul 2023 19:27:14 +0000 (12:27 -0700)]
[Driver][test] Remove XRay/lit.local.cfg

This was needed when XRay/* tests relied on the default target triple.
Now that we set a default target triple for every test we can remove
this customization.

This cleanup is intrigued by D156090.

15 months ago[RISCV] Add memcpy lowering test coverage with and without V
Philip Reames [Mon, 24 Jul 2023 19:18:04 +0000 (12:18 -0700)]
[RISCV] Add memcpy lowering test coverage with and without V

15 months ago[gn build] Port 0882c70df222
LLVM GN Syncbot [Mon, 24 Jul 2023 19:02:32 +0000 (19:02 +0000)]
[gn build] Port 0882c70df222

15 months ago[TextAPI] Introduce SymbolSet
Cyndy Ishida [Mon, 24 Jul 2023 18:55:01 +0000 (11:55 -0700)]
[TextAPI] Introduce SymbolSet

SymbolSet is a structure that acts as a simple container class for exported symbols that
belong to a library interface. It allows tapi to decouple the globals
from the other library attributes. It's uniqued by symbol name and `kind`, which all contain their assigned target triples.

Reviewed By: zixuw

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

15 months ago[llvm-objdump] [NFC] Add missing REQUIRES to arm64ec.yaml.
Jacek Caban [Mon, 24 Jul 2023 18:55:49 +0000 (20:55 +0200)]
[llvm-objdump] [NFC] Add missing REQUIRES to arm64ec.yaml.

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

15 months agoRecognize ARM64EC binaries in COFFObjectFile::getMachine.
Jacek Caban [Wed, 12 Apr 2023 19:18:37 +0000 (21:18 +0200)]
Recognize ARM64EC binaries in COFFObjectFile::getMachine.

ARM64EC/ARM64X binaries use ARM64 or AMD64 machine types, but provide
additional CHPE metadata that may be used to distinguish them from
pure ARM64/AMD64 binaries.

Reviewed By: jhenderson, MaskRay, mstorsjo
Differential Revision: https://reviews.llvm.org/D149091

15 months ago[yaml2obj] Add support for load config section data.
Jacek Caban [Fri, 28 Apr 2023 12:35:38 +0000 (14:35 +0200)]
[yaml2obj] Add support for load config section data.

Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D149440

15 months agoUpdate ODS variadic segments "magic" attributes to use native Properties
Mehdi Amini [Fri, 21 Jul 2023 05:51:35 +0000 (22:51 -0700)]
Update ODS variadic segments "magic" attributes to use native Properties

The operand_segment_sizes and result_segment_sizes Attributes are now inlined
in the operation as native propertie. We continue to support building an
Attribute on the fly for `getAttr("operand_segment_sizes")` and setting the
property from an attribute with `setAttr("operand_segment_sizes", attr)`.

A new bytecode version is introduced to support backward compatibility and
backdeployments.

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

15 months ago[NFC][libc++] Update comments to reflect changes in ASan
Advenam Tacet [Mon, 24 Jul 2023 17:57:22 +0000 (19:57 +0200)]
[NFC][libc++] Update comments to reflect changes in ASan

ASan capabilities were extended, but some comments were not updated and describe old behavior. This commit updates outdated comments, which I found.
Mentioned changes are:
- All allocators in containers (`std::vector` and `std::deque`; D146815 D136765) are supported, but it's possible to turn off annotations for a specific allocator (D145628).
- Buffers don't have to be aligned (D132522).

Reviewed By: #libc, philnik

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

15 months ago[OpenMP] Add a few release notes
Joseph Huber [Mon, 24 Jul 2023 18:25:53 +0000 (13:25 -0500)]
[OpenMP] Add a few release notes

Summary:
Release notes

15 months agoAdd Adrian and David as owners for debug info
Reid Kleckner [Mon, 24 Jul 2023 17:17:35 +0000 (10:17 -0700)]
Add Adrian and David as owners for debug info

Reviewed By: aprantl, probinson

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

15 months ago[flang] Add PowerPC vec_abs, vec_nmadd, vec_msub and vec_sel intrinsics
Kelvin Li [Tue, 11 Jul 2023 03:13:34 +0000 (23:13 -0400)]
[flang] Add PowerPC vec_abs, vec_nmadd, vec_msub and vec_sel intrinsics

Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com>
Differential Revision: https://reviews.llvm.org/D154985

15 months ago[LAA] Make MaxSafeDepDistBytes private in LoopAccessAnalysis. NFC
Michael Maitland [Sat, 22 Jul 2023 21:02:23 +0000 (14:02 -0700)]
[LAA] Make MaxSafeDepDistBytes private in LoopAccessAnalysis. NFC

Any users of LoopAccessAnalysis should use MaxSafeVectorWidthInBits.

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

15 months ago[DWARF] Make sure file entry for artificial functions has an MD5 checksum
Paul Robinson [Fri, 21 Jul 2023 20:34:41 +0000 (13:34 -0700)]
[DWARF] Make sure file entry for artificial functions has an MD5 checksum

The DIFile cache was keyed on a string pointer instead of string content,
which was causing misses and resulted in an entry without a checksum.
In DWARF v5 if any checksum is missing, we can't write any to the output
file, so this had consequences.

Fixes https://github.com/llvm/llvm-project/issues/63955

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

15 months ago[Headers][doc] Add misc non-AVX2 intrinsic descriptions
Paul Robinson [Thu, 20 Jul 2023 15:56:39 +0000 (08:56 -0700)]
[Headers][doc] Add misc non-AVX2 intrinsic descriptions

Adds descriptions for adxintrin.h, bmi2intrin.h, clflushoptintrin.h,
clzerointrin.h, rdseedintrin.h, and xsavecintrin.h.

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

15 months ago[lldb][NFCI] Add some missing SB class forward declarations
Alex Langford [Tue, 18 Jul 2023 22:36:15 +0000 (15:36 -0700)]
[lldb][NFCI] Add some missing SB class forward declarations

I noticed these were missing.

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

15 months ago[Clang] Reject programs declaring namespace std to be inline
Po-yao Chang [Mon, 24 Jul 2023 17:30:23 +0000 (01:30 +0800)]
[Clang] Reject programs declaring namespace std to be inline

Fixes #64041

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

15 months agoRevert "[mlir][gpu] Fallback to JIT compilation" "[mlir][gpu] Increase default SM...
Mehdi Amini [Mon, 24 Jul 2023 17:20:02 +0000 (10:20 -0700)]
Revert "[mlir][gpu] Fallback to JIT compilation" "[mlir][gpu] Increase default SM version from 35 to 50" and  "[mlir][gpu] Improving Cubin Serialization with ptxas Compiler"

This reverts commit 2e0e00ed841951e358a85a871647be9b3a622f51
and reverts commit a6eb40692c795a9cc29266779ceca2e304141114
and reverts commit 585cbe3f639783bf0307b47504acbd205f135310.

15 tests are broken on the mlir-nvidia buildbot:

'cuModuleLoadData(&module, data)' failed with 'CUDA_ERROR_INVALID_SOURCE'
'cuModuleGetFunction(&function, module, name)' failed with 'CUDA_ERROR_INVALID_HANDLE'
'cuLaunchKernel(function, gridX, gridY, gridZ, blockX, blockY, blockZ, smem, stream, params, extra)' failed with 'CUDA_ERROR_INVALID_HANDLE'
'cuModuleUnload(module)' failed with 'CUDA_ERROR_INVALID_HANDLE'

15 months ago[bazel][mlir] Port 0f446adf678212b6daedebc5eb1bd2849b1efad1
Benjamin Kramer [Mon, 24 Jul 2023 17:21:18 +0000 (19:21 +0200)]
[bazel][mlir] Port 0f446adf678212b6daedebc5eb1bd2849b1efad1

15 months ago[bazel] Turn off layering_check for //llvm/unittests:target_aarch64_tests
Benjamin Kramer [Mon, 24 Jul 2023 17:15:26 +0000 (19:15 +0200)]
[bazel] Turn off layering_check for //llvm/unittests:target_aarch64_tests

llvm/unittests/Target/AArch64/AArch64SVESchedPseudoTest.cpp:38:10: error: module @llvm-project//llvm/unittests:target_aarch64_tests does not depend on a module exporting 'AArch64GenInstrInfo.inc'

Test was added in 57329ca94630742ce3b0f6b239b263d757a9eb4a

15 months ago[flang][hlfir] Fixed KindMapping for HLFIR intrinsics lowering.
Slava Zakharin [Mon, 24 Jul 2023 16:22:38 +0000 (09:22 -0700)]
[flang][hlfir] Fixed KindMapping for HLFIR intrinsics lowering.

hlfir.count lowering was using incorrect default integer kind
by ignoring the kind specified in the ModuleOp.

Reviewed By: tblah

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

15 months ago[flang][hlfir] Inherit constant length for the result of hlfir.transpose.
Slava Zakharin [Mon, 24 Jul 2023 16:22:13 +0000 (09:22 -0700)]
[flang][hlfir] Inherit constant length for the result of hlfir.transpose.

Character length may be unknown for the type of Fortran::evaluate::FunctionRef
expression, but we can try to propagate it from the argument of
TRANSPOSE if it is known constant. Alternatively, we could relax
hlfir.transpose verification (i.e. allow character types mismatch
for the argument and the result).

Depends on D155912

Reviewed By: tblah

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

15 months ago[Driver][test] Clean up some xray tests
Fangrui Song [Mon, 24 Jul 2023 17:05:34 +0000 (10:05 -0700)]
[Driver][test] Clean up some xray tests

Add explicit --target= so that the tests run on all targets, not some
that support XRay, similar to commit e1051414a16e970c2e36c2ab7dfe2b17353c4751.
For option testing, we often use a placeholder architecture (e.g., x86_64).

Fix https://github.com/llvm/llvm-project/issues/64028

15 months ago[clang-tidy][NFC] Improve release notes
Piotr Zegar [Mon, 24 Jul 2023 16:53:11 +0000 (16:53 +0000)]
[clang-tidy][NFC] Improve release notes

Fix formating, merge few entrys.

15 months ago[gn build] Port 7c36b416b6b1
LLVM GN Syncbot [Mon, 24 Jul 2023 16:49:12 +0000 (16:49 +0000)]
[gn build] Port 7c36b416b6b1

15 months ago[SLP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D154891
Fangrui Song [Mon, 24 Jul 2023 16:47:49 +0000 (09:47 -0700)]
[SLP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D154891

15 months ago[mlir] Convert `ub.poison` to `llvm.poison`
Ivan Butygin [Fri, 21 Jul 2023 12:16:41 +0000 (14:16 +0200)]
[mlir] Convert `ub.poison` to `llvm.poison`

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

15 months ago[clang] Fix specialization of non-templated member classes of class templates
Podchishchaeva, Mariya [Mon, 24 Jul 2023 16:28:09 +0000 (09:28 -0700)]
[clang] Fix specialization of non-templated member classes of class templates

Explicit specialization doesn't increase depth of template parameters,
so need to be careful when gathering template parameters for
instantiation.
For the case:
```
template<typename T>
struct X {
  struct impl;
};

template <>
struct X<int>::impl {
    template<int ct>
    int f() { return ct; };
};
```
instantiation of `f` used to crash because type template parameter
`int` of explicit specialization was taken into account, but non-type
template parameter `ct` had zero depth and index so wrong parameter
ended up inside of a wrong handler.

Fixes https://github.com/llvm/llvm-project/issues/61159

Reviewed By: aaron.ballman, shafik

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

15 months ago[flang][openacc] Keep original array size in reduction init region with slice
Valentin Clement [Mon, 24 Jul 2023 16:34:00 +0000 (09:34 -0700)]
[flang][openacc] Keep original array size in reduction init region with slice

Keep the original array size when materializing the private copy.

Depends on D155882

Reviewed By: razvanlupusoru

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

15 months ago[flang][openacc] Update materialization recipe for private copy in reduction init...
Valentin Clement [Mon, 24 Jul 2023 16:33:09 +0000 (09:33 -0700)]
[flang][openacc] Update materialization recipe for private copy in reduction init region

Update the code generated in the init region to materialize the private
copy.

Reviewed By: razvanlupusoru

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

15 months ago[SLP]Check scalars before trying scheduling.
Alexey Bataev [Mon, 10 Jul 2023 20:49:26 +0000 (13:49 -0700)]
[SLP]Check scalars before trying scheduling.

Need to check the scalars if they can be vectorized before trying to
schedule them. It may save compile time and improve vectorization on
large functions/basic blocks.

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

15 months ago[clang-format] Insert namespace comments with leading spaces
Owen Pan [Sun, 23 Jul 2023 20:45:22 +0000 (13:45 -0700)]
[clang-format] Insert namespace comments with leading spaces

Insert missing namespace comments with SpacesBeforeTrailingComments
leading spaces.

Fixes #64051.

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

15 months agoRegisterCoaleser: Fix empty subrange verifier error
Matt Arsenault [Tue, 27 Jun 2023 14:16:23 +0000 (10:16 -0400)]
RegisterCoaleser: Fix empty subrange verifier error

In this example an implicit def had live-out undef subrange
defs. After coalescing with the def from a previous block, the
undef-defed lanes are no longer live out of the block in the new
interval. An empty subrange was tenatively created for these lanes,
but it must be deleted.

15 months agoRegisterCoalescer: Fix verifier error on redef of subregister for live out implicit_defs
Matt Arsenault [Wed, 21 Jun 2023 12:36:22 +0000 (08:36 -0400)]
RegisterCoalescer: Fix verifier error on redef of subregister for live out implicit_defs

A live out implicit_def wasn't deleted, but the subranges weren't
correctly updated. The main range was correct but the def
corresponding to the initial main range def instruction was missing
from the lanes redefined in another block.

The written lanes are not quite the same as the valid lanes in the
case of an implicit_def.

Fixes verifier error in blender. There is an additional verifier in
some of the testcase variants where an empty subrange remains.

15 months ago[Clang] Fix consteval propagation for aggregates and defaulted constructors
Corentin Jabot [Mon, 10 Jul 2023 06:54:15 +0000 (08:54 +0200)]
[Clang] Fix consteval propagation for aggregates and defaulted constructors

This patch does a few things:

* Fix aggregate initialization.
  When an aggregate has an initializer that is immediate-escalating,
  the context in which it is used automatically becomes an immediate function.
  The wording does that by rpretending an aggregate initialization is itself
  an invocation which is not really how clang works, so my previous attempt
  was... wrong.

* Fix initialization of defaulted constructors with immediate escalating
  default member initializers.
  The wording was silent about that case and I did not handled it fully
  https://cplusplus.github.io/CWG/issues/2760.html

* Fix diagnostics
  In some cases clang would produce additional and unhelpful
  diagnostics by listing the invalid references to consteval
  function that appear in immediate escalating functions

Fixes https://github.com/llvm/llvm-project/issues/63742

Reviewed By: aaron.ballman, #clang-language-wg, Fznamznon

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

15 months ago[llvm-jitlink] Don't return immediately in -noexec mode, just skip execution.
Lang Hames [Mon, 24 Jul 2023 00:56:49 +0000 (17:56 -0700)]
[llvm-jitlink] Don't return immediately in -noexec mode, just skip execution.

Skipping execution rather than bailing out early means that:
1. Explicit teardown of JIT'd code will happen at the same point (via the call
   to ExecutionSession::endSession) regardless of whether -noexec is used.
2. The -show-times option will work with -noexec.

15 months ago[llvm-jitlink] Move statistics code into a separate file.
Lang Hames [Thu, 20 Jul 2023 16:32:38 +0000 (09:32 -0700)]
[llvm-jitlink] Move statistics code into a separate file.

Further isolates statistics gathering / reporting code from the rest of llvm-jitlink.

15 months ago[RISCV] Remove combineCmpOp and associated code. NFCI
Craig Topper [Mon, 24 Jul 2023 16:05:43 +0000 (09:05 -0700)]
[RISCV] Remove combineCmpOp and associated code. NFCI

This code was originally added in D134277. This transform is now
available in target independent DAG combine after D153502.

Reviewed By: asb

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

15 months agoRevert "[clang][RISCV] Fix ABI handling of empty structs with hard FP calling convent...
Alex Bradbury [Mon, 24 Jul 2023 15:58:21 +0000 (16:58 +0100)]
Revert "[clang][RISCV] Fix ABI handling of empty structs with hard FP calling conventions in C++"

This reverts commit 17a58b3ca7ec18585e9ea8ed8b39d72fe36fb6cb and the
minor documentation fix 569e99a471f618b7fdf045d5e96f21d3e3a7f898.

An issue was reported in https://reviews.llvm.org/D142327#inline-1510301
so reverting until it can be investigated and fixed.

15 months agoAMDGPU: Implement combineRepeatedFPDivisors
Matt Arsenault [Sun, 2 Jul 2023 00:28:48 +0000 (20:28 -0400)]
AMDGPU: Implement combineRepeatedFPDivisors

15 months ago[NVPTX] Expand select_cc on bfloat16 type
Yuanqiang Liu [Mon, 24 Jul 2023 15:00:34 +0000 (17:00 +0200)]
[NVPTX] Expand select_cc on bfloat16 type

Expand select_cc on bfloat16 and bfloat16v2 type.

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

15 months ago[ConstantFolding] Avoid use of ConstantExpr::getOr() (NFC)
Nikita Popov [Mon, 24 Jul 2023 14:57:57 +0000 (16:57 +0200)]
[ConstantFolding] Avoid use of ConstantExpr::getOr() (NFC)

Constant folding cannot fail here, because we're really working
on plain integers. It might be better to make all of this work
on APInts instead of Constants.

15 months ago[AArch64] Ignore instructions not supported by CPU in AArch64SVESchedPseudoTest
Sander de Smalen [Mon, 24 Jul 2023 14:47:19 +0000 (14:47 +0000)]
[AArch64] Ignore instructions not supported by CPU in AArch64SVESchedPseudoTest

When adding new Pseudos for instructions that are not supported
by the CPU for which the scheduler model is being tested, the test fails
if these pseudos are not covered by the regex's in the scheduling model.

Rather than failing, this test should check that the CPU supports the
original instruction modelled by the pseudo. If not, the pseudo is
not relevant to the scheduling model being tested.

Reviewed By: dmgreen

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

15 months ago[InstCombine] Avoid uses of ConstantExpr::getOr()
Nikita Popov [Mon, 24 Jul 2023 14:45:32 +0000 (16:45 +0200)]
[InstCombine] Avoid uses of ConstantExpr::getOr()

Replace these with IRBuilder uses, as we don't (from a type
perspective) care about Constant results.

Switch the predicate to m_ImmConstant() instead of isa<Constant>
to guarantee that these do get folded away and our assumptions
about simplifications hold true.

15 months ago[RISCV] Add CZERO_EQZ/CZERO_NEZ to ComputeNumSignBitsForTargetNode.
Craig Topper [Mon, 24 Jul 2023 14:43:01 +0000 (07:43 -0700)]
[RISCV] Add CZERO_EQZ/CZERO_NEZ to ComputeNumSignBitsForTargetNode.

Reviewed By: wangpc

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

15 months ago[RISCV] Add test case for D156082 to condops.ll
Craig Topper [Mon, 24 Jul 2023 14:42:45 +0000 (07:42 -0700)]
[RISCV] Add test case for D156082 to condops.ll

This test is copied from select-cc.ll. It wasn't worth adding
Zicond RUN lines to that file.

Reviewed By: asb, wangpc

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

15 months ago[RISCV] Add CZERO_EQZ/CZERO_NEZ to computeKnownBitsForTargetNode.
Craig Topper [Mon, 24 Jul 2023 14:18:22 +0000 (07:18 -0700)]
[RISCV] Add CZERO_EQZ/CZERO_NEZ to computeKnownBitsForTargetNode.

Reviewed By: wangpc

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

15 months ago[Clang][AArch64] svldr_vnum/svstr_vnum should use cntsb iso vscale for the offset
Sander de Smalen [Mon, 24 Jul 2023 13:57:12 +0000 (13:57 +0000)]
[Clang][AArch64] svldr_vnum/svstr_vnum should use cntsb iso vscale for the offset

The specification for LDR/STR says that:

  The ZA array vector is selected by the sum of the vector select register
  and immediate offset, modulo the number of bytes in a Streaming SVE
  vector. [..] This instruction does not require the PE to be in Streaming
  SVE mode

When the instruction is used outside of streaming mode, 'vscale' will result
in the wrong value being used for the offset because LLVM's code-generator
will emit the non-streaming 'RDVL/ADDVL' instead of the 'RDSVL/ADDSVL'
instructions which are used to get the Streaming-SVE vector length.

Reviewed By: bryanpkc

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

15 months ago[MLIR][Linalg] Move AggregatedOpInterface in linalg namespace (NFC)
Lorenzo Chelini [Mon, 24 Jul 2023 09:01:36 +0000 (11:01 +0200)]
[MLIR][Linalg] Move AggregatedOpInterface in linalg namespace (NFC)

For now, the interface is specific to linalg only.

Reviewed By: qcolombet

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

15 months ago[AMDGPU] Fix llvm.amdgcn.wave.reduce.umax/umin MIR tests
Pravin Jagtap [Mon, 24 Jul 2023 14:19:36 +0000 (10:19 -0400)]
[AMDGPU] Fix llvm.amdgcn.wave.reduce.umax/umin MIR tests

Fixes the MIR tests reported in https://lab.llvm.org/buildbot/#/builders/16/builds/51955

Reviewed By: arsenm

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

15 months ago[X86] fpclamptosat.ll - add nounwind to get rid of cfi noise
Simon Pilgrim [Mon, 24 Jul 2023 14:11:15 +0000 (15:11 +0100)]
[X86] fpclamptosat.ll - add nounwind to get rid of cfi noise

Helps cleanup D150372

15 months ago[mlir][Transform] Allow printing inside matchers
Quinn Dawkins [Sun, 23 Jul 2023 21:02:14 +0000 (17:02 -0400)]
[mlir][Transform] Allow printing inside matchers

Enables printf style debugging of matchers through `transform.print`
within the body of a matcher.

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

15 months ago[AArch64] Add vselect(fmin/fmax) SVE patterns
David Green [Mon, 24 Jul 2023 13:55:38 +0000 (14:55 +0100)]
[AArch64] Add vselect(fmin/fmax) SVE patterns

For both minnum/maxnum and minimum/maximum, this adds tablegen patterns for
vselect(fmin/fmax), creating a predicate fminnm/fmaxnm/fmin/fmax nodes.

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

15 months ago[AArch64] Extra testing for vselect(fmin/max patterns. NFC
David Green [Fri, 21 Jul 2023 07:50:27 +0000 (08:50 +0100)]
[AArch64] Extra testing for vselect(fmin/max patterns. NFC

See D155872.

15 months ago[X86] combineConcatVectorOps - add concat(ctpop)/concat(ctlz)/concat(cttz) handling
Simon Pilgrim [Mon, 24 Jul 2023 13:50:10 +0000 (14:50 +0100)]
[X86] combineConcatVectorOps - add concat(ctpop)/concat(ctlz)/concat(cttz) handling

15 months ago[X86] Add some basic concat(ctpop)/concat(ctlz)/concat(cttz) widening tests
Simon Pilgrim [Mon, 24 Jul 2023 13:41:26 +0000 (14:41 +0100)]
[X86] Add some basic concat(ctpop)/concat(ctlz)/concat(cttz) widening tests