platform/upstream/llvm.git
21 months ago[unittest] Use UnorderedElementsAre for StringMap keys
Fangrui Song [Thu, 2 Feb 2023 21:39:47 +0000 (13:39 -0800)]
[unittest] Use UnorderedElementsAre for StringMap keys

21 months ago[Libomptarget] Add new enum to the dynamically opened HSA implementation
Joseph Huber [Thu, 2 Feb 2023 21:14:20 +0000 (15:14 -0600)]
[Libomptarget] Add new enum to the dynamically opened HSA implementation

Summary:
We added a new agent information enum in a previous commit. This was not
added to the dynamic HSA implementation so it failed to compile without
a local HSA install to use.

21 months agoRepair sphinx doc generation
Joshua Batista [Thu, 2 Feb 2023 20:31:53 +0000 (12:31 -0800)]
Repair sphinx doc generation

mistake in the log commit neglected to place a space after the `` literal,
which messed up the build by incapacitating the sphinx generator.

Reviewed By: beanz

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

21 months ago[BOLT][NFC] Rename {MachO,}RewriteInstance::create methods
Amir Ayupov [Wed, 4 May 2022 03:29:13 +0000 (20:29 -0700)]
[BOLT][NFC] Rename {MachO,}RewriteInstance::create methods

Follow the code style of fallible constructors in [LLVM Programmer's Manual]
(https://llvm.org/docs/ProgrammersManual.html#fallible-constructors)
and rename `RewriteInstance::createRewriteInstance` to `RewriteInstance::create`

Reviewed By: #bolt, rafauler

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

21 months ago[PowerPC] Switch to by-name matching for instructions (part 2 of 2).
James Y Knight [Tue, 8 Nov 2022 22:11:08 +0000 (17:11 -0500)]
[PowerPC] Switch to by-name matching for instructions (part 2 of 2).

This is a follow-on to https://reviews.llvm.org/D134073.

Currently, all of the "memri"-style complex operands, which contain
both a register and an immediate, are encoded into a single field in
the instruction definition. This requires complex encoders/decoders,
and instruction definitions that insert and extract the correct parts
of the bits.

Now, switch to naming and encoding/decoding the sub-operands
separately.

Thus, we can now disable useDeprecatedPositionallyEncodedOperands.

Reviewed By: barannikov88

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

21 months ago[PowerPC] Switch to by-name matching for instructions (part 1 of 2).
James Y Knight [Tue, 8 Nov 2022 22:11:05 +0000 (17:11 -0500)]
[PowerPC] Switch to by-name matching for instructions (part 1 of 2).

This is a follow-on to https://reviews.llvm.org/D134073.

After https://reviews.llvm.org/D137653 we can now switch the PPC
target away from positional operand matching.

This patch fixes all of the "easy" cases. While this changes a large
number of lines of tablegen source, it results in only a single
non-comment change in the code generated by tablegen: the (unused)
codegen-only "MTVRSAVEv" instruction was previously incorrectly
encoding operand 0, and now encodes (correctly) operand 1.

Changes which result in generated-code changes have been split off
into the next (smaller) patch, for ease of review.

Reviewed By: barannikov88

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

21 months ago[X86] Reflow comment to fit 80 columns. NFC
Craig Topper [Thu, 2 Feb 2023 20:17:17 +0000 (12:17 -0800)]
[X86] Reflow comment to fit 80 columns. NFC

21 months ago[clang] Warn by default that implicit capture of 'this' is deprecated in C++20 and...
Tom Honermann [Thu, 26 Jan 2023 15:32:27 +0000 (07:32 -0800)]
[clang] Warn by default that implicit capture of 'this' is deprecated in C++20 and later.

Previously, a warning that C++20 deprecated implicit capture of 'this' for
lambda captures specified with a capture default of '=' was only issued when
'-Wdeprecated' or '-Wdeprecated-this-capture' was specified. This change
enables the warning by default (it is still only issued when compiling for
C++20 or later). This is consistent with gcc which warns by default (MSVC
requires '/Wall').

Reviewed By: erichkeane, shafik

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

21 months ago[BOLT][NFC] Simplify SW::checkStackPointerRestore
Amir Ayupov [Thu, 2 Feb 2023 20:03:44 +0000 (12:03 -0800)]
[BOLT][NFC] Simplify SW::checkStackPointerRestore

Reviewed By: rafauler

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

21 months ago[BOLT][NFC] Use llvm::make_second_range
Amir Ayupov [Thu, 2 Feb 2023 20:02:02 +0000 (12:02 -0800)]
[BOLT][NFC] Use llvm::make_second_range

Reviewed By: #bolt, rafauler

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

21 months ago[flang] Do not finalize pointer function result
Valentin Clement [Thu, 2 Feb 2023 19:47:19 +0000 (20:47 +0100)]
[flang] Do not finalize pointer function result

According to 7.5.6.3 point 5, only nonpointer function result
need to be finalized. Update the condition to exclude pointer
function result.

Reviewed By: jeanPerier

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

21 months agoAdd builtin_elementwise_log
Joshua Batista [Thu, 2 Feb 2023 19:10:53 +0000 (11:10 -0800)]
Add builtin_elementwise_log

Add codegen for llvm log elementwise builtin
The log 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.
The new builtin is restricted to floating point types only.

Reviewed By: beanz

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

21 months ago[RISCV] Merge rv32-vsetvli-intrinsics.ll and rv64-vsetvli-intrinsics.ll into a single...
Craig Topper [Thu, 2 Feb 2023 19:20:43 +0000 (11:20 -0800)]
[RISCV] Merge rv32-vsetvli-intrinsics.ll and rv64-vsetvli-intrinsics.ll into a single test using sed. NFC

21 months ago[NFC] Add split-file as runtime test dependency
YongKang Zhu [Thu, 2 Feb 2023 19:21:58 +0000 (11:21 -0800)]
[NFC] Add split-file as runtime test dependency

Here is a similar change that adds `split-file` as compiler-rt test dependency: https://reviews.llvm.org/rG0eb01a9c4581a24c163f3464cebdb20534fbda35

Reviewed By: thevinster

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

21 months ago[Libomptarget] Improve next-gen AMDGPU plugin error messages
Joseph Huber [Thu, 2 Feb 2023 16:29:47 +0000 (10:29 -0600)]
[Libomptarget] Improve next-gen AMDGPU plugin error messages

The next-gen plugin properly prints errors. This patch improves the
error messages by including the Node-ID of the GPU that failed as well
as a textual representation of the enumeration values.

Reviewed By: kevinsala

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

21 months ago[LLVM][Runtimes] Hide unused CMake variable messages for runtimes builds
Joseph Huber [Thu, 2 Feb 2023 17:31:48 +0000 (11:31 -0600)]
[LLVM][Runtimes] Hide unused CMake variable messages for runtimes builds

The LLVM runtime build is used to bootstrap projects with the built LLVM
toolchain. This effectively re-runs CMake with the current build
directory. One problem is that this passes every common CMake variable
to the projects individually, some of which are not necessarily used.

This patch suppresses the unused variable warnings for the runtimes.
The standard CMake invocation should still be able to print out the
unused variables so it should not impact code quality.

Reviewed By: thieta

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

21 months ago[clang][driver] Fix test fail on Mac after fe082124
Mariya Podchishchaeva [Thu, 2 Feb 2023 18:40:26 +0000 (13:40 -0500)]
[clang][driver] Fix test fail on Mac after fe082124

`--` should be added before input.

21 months ago[PowerPC] Don't crash when disassembling invalid immediate
Nemanja Ivanovic [Thu, 2 Feb 2023 18:38:08 +0000 (12:38 -0600)]
[PowerPC] Don't crash when disassembling invalid immediate

There is an assert in the disassembler functions to ensure
that the immediate is the appropriate width. However,
sometimes what is being disassembled is not instructions
but data that happens to have the bit pattern of an existing
instruction but invalid operands. It is valid for such
things to exist in the text section so we don't want
to crash when disassembling such a thing.

This patch removes the asserts and produces a disassembler
failure for such cases.

21 months ago[RISCV][Driver] Add -mrvv-vector-bits= option similar to -msve-vector-bits=
Craig Topper [Thu, 2 Feb 2023 18:18:17 +0000 (10:18 -0800)]
[RISCV][Driver] Add -mrvv-vector-bits= option similar to -msve-vector-bits=

This option will control the vscale min/max.

I have left out the '+' support that SVE supports for now. We already
have minimum controlled by the Zvl*b extension so this didn't seem that
useful.

I've added "scalable" from SVE to allow the option to be cancelled later on
command line. Though this name might make less sense for RISC-V since
the word "scalable" does not appear in the V spec. Maybe something like
"unknown" or "runtime" or "variable" would be better?

In addition to "scalable", 64, 128, 256, 512, ..., 65536, I have added an extra
value "zvl" that will use the value from Zvl*b as the min and max.
This avoids repeating the numeric value in two places or to get
min/max from -mcpu.

The primary effect of this option today is simplification of stack
address calculations for RVV vectors and avoiding the use of
vrgatherei16 in some cases if we know there are less than 256 elements.

Future patches may add something similar to the arm_sve_vector_bits
attribute to allow RVV vectors to be used in structs and global
variables.

Reviewed By: frasercrmck

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

21 months ago[libc++] Remove use of internal glibc macros to determine if c8rtomb() and mbrtoc8...
Tom Honermann [Wed, 25 Jan 2023 22:57:15 +0000 (17:57 -0500)]
[libc++] Remove use of internal glibc macros to determine if c8rtomb() and mbrtoc8() are present.

When support for declaring the c8rtomb() and mbrtoc8() functions within the
std namespace was added in commit 7e7013c5d4b1b3996c8dba668c5a94bb33b2999b,
internal glibc macros were used to determine if C2X extensions are enabled.
Specifically, a check for whether `__GLIBC_USE` is defined and whether
`__GLIBC_USE(ISOC2X)` is non-0 was added. `__GLIBC_USE` is an internal
detail of the glibc implementation that may be changed or removed in the
future potentially leading to inconsistency or compilation failures.  This
change removes the use of the internal glibc macro to avoid such problems.
Unfortunately, without another mechanism to determine if C2X extensions are
enabled, this removal will result in inconsistent declarations of the
c8rtomb() and mbrtoc8() functions; when C++ char8_t support is not enabled, but
C2X extensions are, these functions will be declared in the global namespace
but not in the std namespace. This situation will improve when C23 support
is finalized and the check can be re-implemented using `__STDC_VERSION__`.

21 months ago[mlir][affine] fix affine LICM pass for has effected memory's user
lipracer [Thu, 2 Feb 2023 18:23:24 +0000 (10:23 -0800)]
[mlir][affine] fix affine LICM pass for has effected memory's user

When the memory is written by dma, its user is moved

Reviewed By: bondhugula

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

21 months ago[LSAN] Enable more tests which are passing as is in HWASAN.
Kirill Stoimenov [Thu, 2 Feb 2023 17:35:27 +0000 (17:35 +0000)]
[LSAN] Enable more tests which are passing as is in HWASAN.

Reviewed By: vitalybuka

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

21 months ago[RISCV] Add CoveredBySubRegs to the X*_PD register class.
Craig Topper [Thu, 2 Feb 2023 17:58:08 +0000 (09:58 -0800)]
[RISCV] Add CoveredBySubRegs to the X*_PD register class.

Not completely sure what effect this has, but it's certainly true.

Reviewed By: asb

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

21 months ago[SelectionDAG] Correctly widen bitcast of scalar to vector for big endian
Nemanja Ivanovic [Thu, 2 Feb 2023 18:01:04 +0000 (12:01 -0600)]
[SelectionDAG] Correctly widen bitcast of scalar to vector for big endian

For big endian targets that need a node such as this:
v2i8 = bitcast i16:tN

legalized by:

1. Promoting the i16 input type
2. Widening the v2i32 result type

The result will be incorrect because the legalizer will promote
the input type and then produce a scalar_to_vector from that
wider type to a vector of N elements of that type. That puts
the desired bits into the low order bytes of element zero and
they need to be in the high order bytes on big endian systems.
This patch changes the legalization to widen to a vector with
elements of the original scalar size.

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

21 months ago[flang] Disable libstdc++ assertions in the runtime library
Jay Foad [Thu, 2 Feb 2023 12:18:41 +0000 (12:18 +0000)]
[flang] Disable libstdc++ assertions in the runtime library

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

21 months ago[MLIR] NFC: fully scope use FastMathFlag.
Christian Sigg [Thu, 2 Feb 2023 17:24:13 +0000 (18:24 +0100)]
[MLIR] NFC: fully scope use FastMathFlag.

21 months agoRevert "[LSAN] Enable more tests which are passing as is in HWASAN."
Kirill Stoimenov [Thu, 2 Feb 2023 17:10:34 +0000 (17:10 +0000)]
Revert "[LSAN] Enable more tests which are passing as is in HWASAN."

This reverts commit b4abbf17572dce3993402f2e00e72678518ef6e1.

21 months ago[AMDGPU] GFX11: accept global_atomic_csub as an alias
Jay Foad [Thu, 2 Feb 2023 13:38:37 +0000 (13:38 +0000)]
[AMDGPU] GFX11: accept global_atomic_csub as an alias

GFX11 renamed this instruction to global_atomic_csub_u32 but should
accept the old name as an alias, for consistency with the other global
atomics and with buffer_atomic_csub.

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

21 months ago[flang] Avoid double finalization in Assign
Valentin Clement [Thu, 2 Feb 2023 17:02:01 +0000 (18:02 +0100)]
[flang] Avoid double finalization in Assign

First call to Assign is issuing finalization for the
LHS and its components. Avoid calling finalization for components
again when doing the component by component assignment.

Reviewed By: klausler

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

21 months ago[clang][driver] Emit an error for `/clang:-x`
Mariya Podchishchaeva [Thu, 2 Feb 2023 16:41:11 +0000 (11:41 -0500)]
[clang][driver] Emit an error for `/clang:-x`

`/clang:-x` emits an error instead of a warning. And if the error is suppressed,
`/clang:-x` takes no effect.
Considering that `/clang:` is a recent addition in 2018-11 and there are MSVC
style alternatives, therefore `/clang:-x` doesn't seem useful and we just reject
it since properly supporting it would add lots of complexity.

Fixes #59307

Reviewed By: MaskRay

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

21 months agoReapply 9cffabc68ca380be937e192be909feff7b144822
Mircea Trofin [Thu, 2 Feb 2023 16:03:35 +0000 (08:03 -0800)]
Reapply 9cffabc68ca380be937e192be909feff7b144822

This reverts commit 735f117f4d0deb9644d65c8fe8a80add058e7a2b.

21 months ago[LSAN] Enable more tests which are passing as is in HWASAN.
Kirill Stoimenov [Thu, 2 Feb 2023 01:19:35 +0000 (01:19 +0000)]
[LSAN] Enable more tests which are passing as is in HWASAN.

Reviewed By: vitalybuka

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

21 months ago[C++20] Fix a crash with modules.
Utkarsh Saxena [Mon, 23 Jan 2023 18:15:46 +0000 (19:15 +0100)]
[C++20] Fix a crash with modules.

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

21 months ago[ConstraintSystem] Remove last variable, use move instead of copy. (NFC)
Florian Hahn [Thu, 2 Feb 2023 16:03:26 +0000 (16:03 +0000)]
[ConstraintSystem] Remove last variable, use move instead of copy. (NFC)

At the moment, a large amount of time is spent construction vectors
by pushing back all elements except the first variable. For large
inputs, such as discussed in https://reviews.llvm.org/D135915#4057050
this can result in excessive compile-time.

Instead, it is more efficient to remove the last variable. Then the
original vector can be re-used by simply popping the last element and
then moving the contents to the new system.

This improves time spent in ConstraintElimination for the linked
reproducer from ~43s to ~3s.

21 months agoRevert "[mlgo][nfc] Better pretty printing of interactive mode reply"
Mircea Trofin [Thu, 2 Feb 2023 16:02:33 +0000 (08:02 -0800)]
Revert "[mlgo][nfc] Better pretty printing of interactive mode reply"

This reverts commit 9cffabc68ca380be937e192be909feff7b144822.

Broke windows builds

21 months ago[mlgo][nfc] Better pretty printing of interactive mode reply
Mircea Trofin [Thu, 2 Feb 2023 15:51:29 +0000 (07:51 -0800)]
[mlgo][nfc] Better pretty printing of interactive mode reply

Also simplified the `-interactive-model-runner-echo-reply` flag to a
bool, because the header will contain the advice spec, so there is an
explicit agreement between the compiler and the host as to what that
should be shaped as.

21 months ago[libc] Remove OpenMP and build the GPU libc directly
Joseph Huber [Mon, 30 Jan 2023 23:40:26 +0000 (17:40 -0600)]
[libc] Remove OpenMP and build the GPU libc directly

The current `libcgpu.a` is actually an archive of fatbinaries. The host
file contains nothing but a section called `LLVM_OFFLOADING` that
contains embedded device code. This used to be handled implicitly by
borrowing the OpenMP toolchain, which did this packaging internally.
Passing the OpenMP flags causes problems with trying to move to testing.
This patch pulls this logic out into the CMake and handles it manually.

This patch is a lot of noise, but it fundamentally comes down to the
following changes.
1. Build the source for every GPU architecture (GPU architectures are
   generally not backwards compatible)
2. Combine all of these files into a single binary blob
3. Embed that binary blob into a host file
4. Package these host files into a `.a` archive.
5. The device code will be extracted and managed by the offloading
   linker.

Another important point. Right now we are maintaining an important
distinction with the GPU build. That is, when we build the exported
library we will build for many GPU architectures. However, the internal
version will only be built for a single GPU architecture, one that was
found on the user's system. This is intended to be used for internal
testing, very similar to the current path where `libc` is compiled for a
single target triple.

Reviewed By: sivachandra

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

21 months ago[Libomptarget] Fix the NVPTX Libomptarget test
Joseph Huber [Thu, 2 Feb 2023 15:45:19 +0000 (09:45 -0600)]
[Libomptarget] Fix the NVPTX Libomptarget test

Summary:
This was broken, we weren't adding these for the NVPTX tests.

21 months ago[AArch64] Add tests for reassociating to mls. NFC
David Green [Thu, 2 Feb 2023 15:40:32 +0000 (15:40 +0000)]
[AArch64] Add tests for reassociating to mls. NFC

21 months ago[NFC][clang-tidy] Disable test for `bugprone-unsafe-functions` for PlayStation
Whisperity [Thu, 2 Feb 2023 15:30:14 +0000 (16:30 +0100)]
[NFC][clang-tidy] Disable test for `bugprone-unsafe-functions` for PlayStation

As discussed in [D91000](http://reviews.llvm.org/D91000) with @dyung, the
PlayStation-specific targets are using some custom standard library for
which the current written tests are not appropriate. Even though the
test code defines the `__STDC_LIB_EXT1__` and `__STDC_WANT_LIB_EXT1__`
macros and expected *Annex K.* support, the actual Clang
parser/preprocessor will report these macros as not existing, and thus
fail the tests.

The check reports the **non**-Annex K. functions as suggestions, such as
`fgets()` instead of `gets_s()` to replace `gets()`, so some safe
library suggestions are still there.

This patch is primarily done to unblock the relevant buildbot
[`llvm-clang-x86_64-sie-ubuntu-fast`](http://lab.llvm.org/buildbot/#/builders/139).

This commit partially reverts ed740e741ec22f9aaea09bfc0b87d0801a7c492f,
as the changes to the "caching logic" was not fixing anything.

21 months agoAdd a new modules test to ensure we dont rebreak diagnostic
Erich Keane [Thu, 2 Feb 2023 14:39:53 +0000 (06:39 -0800)]
Add a new modules test to ensure we dont rebreak diagnostic

Fixes: 60336

Seemingly the concepts sugaring patch caused us to not catch this
situation, which has been confirmed to be a valid error.  Make sure that
we catch this situation in the future, particularly if the concepts
sugaring patch gets re added.

21 months ago[NFC] [mlir] fix file header for SCFToControlFlow.h
Xiang Li [Thu, 2 Feb 2023 15:14:22 +0000 (10:14 -0500)]
[NFC] [mlir] fix file header for SCFToControlFlow.h

Fill description and fix filename mismatch.

21 months ago[clang-tidy] Attempt fixing wrong caching result in `bugprone-unsafe-functions`
Whisperity [Thu, 2 Feb 2023 14:22:04 +0000 (15:22 +0100)]
[clang-tidy] Attempt fixing wrong caching result in `bugprone-unsafe-functions`

There is a supposedly platform-specific crash related to not recognising
the availability of *Annex K.* properly? This patch is an attempt for
fixing this by moving the reset logic for the cache to a different
place.

It's really a coin-flip at this point whether this is really a fix...

21 months ago[DX] Hopefully really fix the big endian bots
Chris Bieneman [Thu, 2 Feb 2023 14:13:26 +0000 (08:13 -0600)]
[DX] Hopefully really fix the big endian bots

Slly mistake in my first attempt. Hopefully this will do it.

21 months agoRevert "[Clang] Add builtin_nondeterministic_value"
Nico Weber [Thu, 2 Feb 2023 13:59:27 +0000 (08:59 -0500)]
Revert "[Clang] Add builtin_nondeterministic_value"

This reverts commit 4a1832a5c801a61bf4c30891aaebe63993712fd9.
Test fail on (at least) macOS and Windows, see
https://reviews.llvm.org/D142388#4099441

21 months ago[X86] canonicalizeShuffleWithBinOps - all merging shuffles with INSERT_SUBVECTOR...
Simon Pilgrim [Thu, 2 Feb 2023 13:48:42 +0000 (13:48 +0000)]
[X86] canonicalizeShuffleWithBinOps - all merging shuffles with INSERT_SUBVECTOR as well as generic target shuffles.

We can probably expand this to more faux shuffles as time goes on.

21 months agoBump CINDEX_VERSION_MINOR due to additional APIs
Aaron Ballman [Thu, 2 Feb 2023 13:25:21 +0000 (08:25 -0500)]
Bump CINDEX_VERSION_MINOR due to additional APIs

0a51bc731bcc2c27e4fe97957a83642d93d989be added a new API to libclang
but forgot to bump the minor version number.

There is no reasonable way to test this change, hence the lack of test
coverage.

21 months ago[NFC] Fix function naming conventions in PHITransAddr methods
Sergey Kachkov [Thu, 2 Feb 2023 09:49:04 +0000 (12:49 +0300)]
[NFC] Fix function naming conventions in PHITransAddr methods

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

21 months ago[AArch64][CostModel]: Add costs for zero/sign extend.
Hassnaa Hamdi [Thu, 2 Feb 2023 11:46:11 +0000 (11:46 +0000)]
[AArch64][CostModel]: Add costs for zero/sign extend.

Add cost for extending to illegal scalable vector types.
Add testing file for the extend operations.

Reviewed By: sdesmalen

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

21 months ago[gn build] Port f27c8ac83e7c
LLVM GN Syncbot [Thu, 2 Feb 2023 13:12:41 +0000 (13:12 +0000)]
[gn build] Port f27c8ac83e7c

21 months ago[clang-tidy] Add the `bugprone-unsafe-functions` check
Gergely Fűtő [Mon, 29 Nov 2021 08:56:48 +0000 (09:56 +0100)]
[clang-tidy] Add the `bugprone-unsafe-functions` check

Checks for unsafe functions, mostly those listed in the
SEI CERT C Coding Standard Recommendation `MSC24-C` and Rule `MSC33-C`.

For the listed functions, an alternative, more secure replacement is
suggested, if such is available. The checker heavily relies on the
functions from "Annex K" (Bounds-checking interfaces) from C11, but
there are several other recommendations not directly from Annex K.

Differential Revision: http://reviews.llvm.org/D91000

Reviewed-By: aaron.ballman, dkrupp, steakhal, whisperity
Co-Authored-By: Tamás Koller <koller.tamas1996@gmail.com>
Co-Authored-By: Balázs Benics <balazs.benics@sigmatechnology.se>
Co-Authored-By: Whisperity <whisperity@gmail.com>
21 months ago[X86] combineConcatVectorOps - add FADD/FSUB/FMUL/FDIV handling
Simon Pilgrim [Thu, 2 Feb 2023 12:28:56 +0000 (12:28 +0000)]
[X86] combineConcatVectorOps - add FADD/FSUB/FMUL/FDIV handling

21 months ago[X86] Add test coverage showing failure to load/binop combine adjacent v2f32 float ops
Simon Pilgrim [Thu, 2 Feb 2023 12:14:21 +0000 (12:14 +0000)]
[X86] Add test coverage showing failure to load/binop combine adjacent v2f32 float ops

Pulled out of Issue #60441 - we really need that handling in the middle-end, but there's some obvious DAG cleanups we can try as well

21 months ago[gn build] Port ad93908e3b55
LLVM GN Syncbot [Thu, 2 Feb 2023 12:37:18 +0000 (12:37 +0000)]
[gn build] Port ad93908e3b55

21 months ago[gn build] Port 8a8f77c1b849
LLVM GN Syncbot [Thu, 2 Feb 2023 12:37:18 +0000 (12:37 +0000)]
[gn build] Port 8a8f77c1b849

21 months ago[X86][FP16][NFC] Add round and fptosi tests to show suboptimal codegen
Phoebe Wang [Thu, 2 Feb 2023 12:16:29 +0000 (20:16 +0800)]
[X86][FP16][NFC] Add round and fptosi tests to show suboptimal codegen

21 months ago[lldb][SymbolFileDWARF] Support by-name lookup of global variables in inline namespaces
Michael Buch [Wed, 1 Feb 2023 13:42:24 +0000 (13:42 +0000)]
[lldb][SymbolFileDWARF] Support by-name lookup of global variables in inline namespaces

Currently evaluating an expression involving a global variable inside
an inline namespace will fail to lookup said variable. This is because
the `SymbolFileDWARF::FindGlobalVariables` discards from consideration
all DIEs whose decl_context doesn't exactly match that of the lookup.

This patch relaxes this restriction by checking whether C++ rules
would permit the lookup. This is permitted by the DWARFv5 spec in
chapter `3.2.2 Namespace Entries`:
```
A namespace may have a DW_AT_export_symbols attribute which is a flag
which indicates that all member names defined within the namespace may be
referenced as if they were defined within the containing namespace.
```

The motivation for this is evaluating `std::ranges` expressions, which
heavily rely on global variables inside inline namespaces. E.g.,
`std::views::all(...)` is just an invocation of the `operator()`
on `std::ranges::views::__cpo::all`.

**Testing**

* Added API tests

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

21 months ago[lldb][Test] Fix import-std-module and data-formatter tests on older compilers
Michael Buch [Tue, 31 Jan 2023 18:05:41 +0000 (18:05 +0000)]
[lldb][Test] Fix import-std-module and data-formatter tests on older compilers

Fixes API tests for older compilers.
Since https://reviews.llvm.org/D141828 defaulted
arguments will be omitted, but older Clang's won't.

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

21 months ago[runtimes] Don't override LLVM_ENABLE_PER_TARGET_RUNTIME_DIR set from llvm
David Spickett [Wed, 7 Dec 2022 14:25:42 +0000 (14:25 +0000)]
[runtimes] Don't override LLVM_ENABLE_PER_TARGET_RUNTIME_DIR set from llvm

LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is set in llvm/CMakeLists.txt
and in llvm/runtimes/CMakeLists.txt.

This meant that anything you passed down, or any platform not using
this layout yet would have it enabled despite it being OFF earlier.

To fix this, check if we have already defined the variable
and if so, use that value.

bultin_register_target I don't fully understand the purpose of.
So for now I have left it setting the value to ON. The rest will
respect what was previously set.

Reviewed By: MaskRay

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

21 months ago[InstCombine] Promote expression tree with @llvm.vscale when zero-extending result.
Sander de Smalen [Tue, 31 Jan 2023 22:20:46 +0000 (22:20 +0000)]
[InstCombine] Promote expression tree with @llvm.vscale when zero-extending result.

The LoopVectorizer emits the (scaled) element count as i32, which for
scalable VFs results in calls to @llvm.vscale.i32(). This value is scaled
and further zero-extended to i64.

The zero-extend can be folded away by executing the whole expression in i64
type using @llvm.vscale.i64(). Any logical `and` that would needed to mask
the result can be further folded away by KnownBits analysis when
vscale_range is set.

Reviewed By: nikic

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

21 months ago[Clang] Add builtin_nondeterministic_value
ManuelJBrito [Thu, 2 Feb 2023 10:11:53 +0000 (10:11 +0000)]
[Clang] Add builtin_nondeterministic_value

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

21 months ago[FLANG][MLIR] Update all module symbol references after changing FuncOp symbol during...
Andrew Gozillon [Wed, 1 Feb 2023 18:29:59 +0000 (12:29 -0600)]
[FLANG][MLIR] Update all module symbol references after changing FuncOp symbol during external name mangling

This fixes an issue where the symbols for operations that were not directly
handled by the rewriting in ExternalNameConversion.cpp were not updated
accurately when a FuncOp symbol was modified. Resulting in a name
mismatch between the FuncOp and the operation holding a symbol to
the FuncOp.

This fix works by updating all of the symbols relating to a FuncOp in a
module, this did not show up as an issue previously as fir::CallOps were
getting specific handling and only fir::CallOps were being tested. So
as the more larger case is now being handled the specific handling for
fir::CallOps has been removed (but is still handled by the fix).

Reviewers:
clementval

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

21 months ago[TTI][NFC] Introduce option to set predictable branch threshold
Serguei Katkov [Thu, 2 Feb 2023 09:56:13 +0000 (16:56 +0700)]
[TTI][NFC] Introduce option to set predictable branch threshold

Currently TargetTransformInfo::getPredictableBranchThreshold() method
returns hardcoded value 99. This value affects the decision whether to
convert select instruction to branch or not in several passes:
SelectOptimize, CodeGenPrepare, SimplifyCFG.

It would be useful to make possible to play with that threshold in order
to test select-optimize heuristics.

Option was originally introduced in the TargetLoweringBase, but was
removed in the revision 664d0c052c315 and not restored in the TTI

Patch Author: aleksandr.popov
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D143060

21 months ago[C++20][Modules] Handle template declarations in header units.
Iain Sandoe [Fri, 27 Jan 2023 10:56:45 +0000 (10:56 +0000)]
[C++20][Modules] Handle template declarations in header units.

This addresses part of https://github.com/llvm/llvm-project/issues/60079

The test for external functions was not considering function templates.

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

21 months ago[mlir][tensor|memref] Harden the checks on dim op
Quentin Colombet [Tue, 24 Jan 2023 10:29:37 +0000 (11:29 +0100)]
[mlir][tensor|memref] Harden the checks on dim op

Prior to this patch it was possible to use the dim operation on a 0-D
memref/tensor.
Unless we want to change the semantic of a 0-D shape, this doesn't make
sense because, paraphrasing the dim op semantic, this is guaranteed to
produce something that is undefined. (The requested index is guaranteed
to be equal to or greater than the rank.)

Harden the type requirements for the dim op by disallowing 0-D shaped
types.

This "fixes" llvm.org/PR60195 by rejecting dim op on 0-D shapes instead of
crashing during LLVM conversion.

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

21 months ago[Attributor][NFC] Improve debug messages
Johannes Doerfert [Thu, 2 Feb 2023 10:10:07 +0000 (02:10 -0800)]
[Attributor][NFC] Improve debug messages

21 months ago[OpenMP][FIX] Ensure to determine aligned regions properly
Johannes Doerfert [Thu, 2 Feb 2023 10:01:40 +0000 (02:01 -0800)]
[OpenMP][FIX] Ensure to determine aligned regions properly

There were missing checks in the aligned region code, copy-paste errors
(= usage of the IsReachedFromAlignedBarrierOnly value instead of
IsReachingAlignedBarrierOnly value on the forward pass), and a missing
update of the call state for sync declarations and definitions.

Partially fixes https://github.com/llvm/llvm-project/issues/60425

21 months ago[Attributor][FIX] Ensure we use the right AAExecutionDomain
Johannes Doerfert [Thu, 2 Feb 2023 09:06:00 +0000 (01:06 -0800)]
[Attributor][FIX] Ensure we use the right AAExecutionDomain

Before we might have ended up queriying the AAExecutionDomain of a
different function, which resulted in wrong optimistic results.

Partially fixes https://github.com/llvm/llvm-project/issues/60425

21 months ago[lldb] Try harder to optimize away a test variable
Pavel Labath [Thu, 2 Feb 2023 10:09:40 +0000 (11:09 +0100)]
[lldb] Try harder to optimize away a test variable

The test was checking that we can print an error message when a variable
is optimized away, but the optimizer got smarter (D140404) in tracking
the variable's value (so that we were not able to recover its value).

Using a value in an argument registers (argc) makes it more likely to be
overwritten by subsequent function calls (and permanently lost).

21 months ago[DAGCombine] Fold redundant select
Samuel Parker [Mon, 30 Jan 2023 09:36:15 +0000 (09:36 +0000)]
[DAGCombine] Fold redundant select

If a chain of two selects share a true/false value and are controlled
by two setcc nodes, that are never both true, we can fold away one of
the selects. So, the following:
(select (setcc X, const0, eq), Y,
  (select (setcc X, const1, eq), Z, Y))

Can be combined to:
  select (setcc X, const1, eq) Z, Y

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

21 months ago[lld] Fix gcc compiler warnings related to variadic macro [NFC]
Mikael Holmen [Thu, 2 Feb 2023 09:26:25 +0000 (10:26 +0100)]
[lld] Fix gcc compiler warnings related to variadic macro [NFC]

gcc warned like
 ../../lld/ELF/InputSection.cpp:75:37: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
    75 |     invokeELFT(parseCompressedHeader);
       |                                     ^

21 months ago[flang] Use rank from the allocate object when allocate with mold
Valentin Clement [Thu, 2 Feb 2023 09:23:06 +0000 (10:23 +0100)]
[flang] Use rank from the allocate object when allocate with mold

The rank from the allocate object might be different from the rank
from the mold expression. Use the rank from the allocate object
when applying to mold so the bounds can be set correctly.

Reviewed By: jeanPerier

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

21 months ago[X86][NFC] Move MemoryFoldTable2Addr MemoryFoldTable0~4 into X86InstrFoldTables.def
Bing1 Yu [Wed, 1 Feb 2023 14:51:06 +0000 (22:51 +0800)]
[X86][NFC] Move MemoryFoldTable2Addr MemoryFoldTable0~4 into X86InstrFoldTables.def

Reviewed By: pengfei, skan

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

21 months ago[Clang][RISCV] Bump rvv intrinsics version to v0.11
eopXD [Wed, 1 Feb 2023 04:49:31 +0000 (20:49 -0800)]
[Clang][RISCV] Bump rvv intrinsics version to v0.11

The LLVM now supports v0.11 of the RVV intrinsics. Users can use the macro
`riscv_v_intrinsic` to distinguish what kind of intrinsics is supported in
the compiler.

Please refer to tag descriptions under

https://github.com/riscv-non-isa/rvv-intrinsic-doc/tags

Reviewed By: kito-cheng, asb

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

21 months ago[clang-tidy] Implement CppCoreGuideline F.54
Chris Cotter [Thu, 2 Feb 2023 07:01:14 +0000 (07:01 +0000)]
[clang-tidy] Implement CppCoreGuideline F.54

Warn when a lambda specifies a default capture and captures
``this``. Offer FixIts to correct the code.

Reviewed By: njames93, carlosgalvezp

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

21 months ago[RISCV] Add precommit tests for D142071;
LiaoChunyu [Thu, 2 Feb 2023 07:13:45 +0000 (15:13 +0800)]
[RISCV] Add precommit tests for D142071;

21 months ago[clang] Fix warning about unused variable [NFC]
Mikael Holmen [Thu, 2 Feb 2023 06:50:59 +0000 (07:50 +0100)]
[clang] Fix warning about unused variable [NFC]

gcc warned about
 ../../clang/lib/Sema/AnalysisBasedWarnings.cpp:2187:23: warning: unused variable 'FC' [-Wunused-variable]
  2187 |       if (const auto *FC = dyn_cast<CallExpr>(Operation)) {
       |                       ^~

21 months ago[Local][InstCombine][GVN] Handle !noundef metadata in combineMetadata
luxufan [Wed, 1 Feb 2023 06:10:57 +0000 (14:10 +0800)]
[Local][InstCombine][GVN] Handle !noundef metadata in combineMetadata

Handle !noundef metadata in comhineMetadata. The behavior of violating
!noundef metadata is undefined behavior. So if K dominates J, we can
preserve it uncontionally, otherwise, we preserve it if both K and J
have !noundef metadata been set.

This patch also makes !noundef metadata added in KnownIDs when doing
instruction combine for phi node or global value numbering for loads.

Reviewed By: nikic

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

21 months ago[LoongArch] Implement TargetLowering::isLegalAddressingMode() hook
gonglingqin [Thu, 2 Feb 2023 06:00:04 +0000 (14:00 +0800)]
[LoongArch] Implement TargetLowering::isLegalAddressingMode() hook

Use the exact addressing mode information instead of the default to
make better use of offsets in instructions.

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

21 months ago[PowerPC] Use default attributes for more intrinsics
Qiu Chaofan [Thu, 2 Feb 2023 05:59:51 +0000 (13:59 +0800)]
[PowerPC] Use default attributes for more intrinsics

Reviewed By: shchenz, amyk

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

21 months agoUse ArrayRef instead of raw pointers. NFC
Serge Pavlov [Wed, 1 Feb 2023 05:43:43 +0000 (12:43 +0700)]
Use ArrayRef instead of raw pointers. NFC

Change signature of TargetLowering::getRoundingControlRegisters so that
it returns ArrayRef, not plain pointer.

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

21 months ago[DX] Speculative fix for big endian encoding
Chris Bieneman [Thu, 2 Feb 2023 05:19:35 +0000 (23:19 -0600)]
[DX] Speculative fix for big endian encoding

I missed byte swapping the size field.

21 months ago[LoongArch] Honor the `--target-abi` option when generating e_flags
Weining Lu [Thu, 2 Feb 2023 03:39:25 +0000 (11:39 +0800)]
[LoongArch] Honor the `--target-abi` option when generating e_flags

Reviewed By: xen0n, MaskRay

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

21 months ago[LoongArch] Implement handling of triple-implied ABIs
WANG Xuerui [Thu, 2 Feb 2023 03:33:59 +0000 (11:33 +0800)]
[LoongArch] Implement handling of triple-implied ABIs

According to the [[ https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html | LoongArch Toolchain Conventions ]]
it is possible to specify the ABI modifier (the "D" part of "LP64D")
via the environment field in the target triple. This is needed for
proper support for Debian-style multiarch tuples as well, so add triple
awareness to `LoongArchSubtarget` via addition of
`LoongArchABI::computeTargetABI`. Let the explicit `--target-abi`
argument intuitively take precedence over the triple-implied ABI.

Reviewed By: SixWeining

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

21 months ago[ExecutionEngine] Enable ExecutionEngine regression tests on LoongArch
wanglei [Thu, 2 Feb 2023 02:34:27 +0000 (10:34 +0800)]
[ExecutionEngine] Enable ExecutionEngine regression tests on LoongArch

This patch also sets `UNSUPPORTED` on some tests which need `mcjit` and
`emulated tls` support.

Depends on D142950

Reviewed By: lhames

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

21 months ago[mlir] Require explicit casts when using TypedValue
Rahul Kayaith [Sun, 29 Jan 2023 00:18:19 +0000 (19:18 -0500)]
[mlir] Require explicit casts when using TypedValue

Currently `TypedValue` can be constructed directly from `Value`, hiding
errors that could be caught at compile time. For example the following
will compile, but crash/assert at runtime:
```
void foo(TypedValue<IntegerType>);
void bar(TypedValue<FloatType> v) {
  foo(v);
}
```

This change removes the constructors and replaces them with explicit
llvm casts.

Depends on D142852

Reviewed By: rriddle

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

21 months ago[mlir] Use TypedValue in single result traits
Rahul Kayaith [Thu, 26 Jan 2023 18:43:56 +0000 (13:43 -0500)]
[mlir] Use TypedValue in single result traits

Ops with a single result currently get a `getResult()` method +
conversion operator to `Value` through the `OneResult` trait. By moving
these to the `OneTypedResult` trait instead, we can use `TypedValue` as
the return type to get more specfic types.

When the result type is unknown ODS adds the
`OneTypedResult<mlir::Type>` trait, in which case there is no change in
the resulting API.

Reviewed By: rriddle

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

21 months ago[mlir] Simplify a few cast implementations
Rahul Kayaith [Mon, 30 Jan 2023 04:34:10 +0000 (23:34 -0500)]
[mlir] Simplify a few cast implementations

`{Attribute,Type}::classof` are never actually called at runtime due to
the early exit in their `CastInfo` implementations. By using `if
constexpr` we can avoid needing to define them.

We also don't need to check `is_same_v` here, since this is already
covered by `is_base_of_v`.

Reviewed By: rriddle

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

21 months ago[MC] Simplify code with parseComma
Fangrui Song [Thu, 2 Feb 2023 02:41:02 +0000 (18:41 -0800)]
[MC] Simplify code with parseComma

21 months ago[LoongArch] Implement isUsedByReturnOnly for tailcall more libcalls
wanglei [Wed, 1 Feb 2023 02:14:43 +0000 (10:14 +0800)]
[LoongArch] Implement isUsedByReturnOnly for tailcall more libcalls

Similar to D131087 for RISCV.

Reviewed By: xen0n

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

21 months ago[X86][MC][bugfix] Report error for mismatched modifier in inline asm and remove funct...
Shengchen Kan [Sun, 29 Jan 2023 07:07:15 +0000 (15:07 +0800)]
[X86][MC][bugfix] Report error for mismatched modifier in inline asm and remove function getX86SubSuperRegisterOrZero

```
MCRegister getX86SubSuperRegister*(MCRegister Reg, unsigned Size,
                                  bool High = false);
```
A strange behavior of the functions `getX86SubSuperRegister*` was
introduced by llvm-svn:145579: The returned register may not
match the parameters when a 8-bit high register is required.

And llvm-svn: 175762 refined the code and dropped the comments, then we
knew nothing happened there from the code :-(

These two functions are only called with `Size=8` and `High=true` in two places.
One is in `X86FixupBWInsts.cpp` for liveness of registers and the other is in
`X86AsmPrinter.cpp` for inline asm.

For the first one, we provide an alternative in this patch.
For the second one, the strange behaviour caused a bug that an erorr was not reported for mismatched modifier.

```
void f() {
  char x;
  asm volatile ("mov %%ah, %h0" :"=r"(x)::"%eax", "%ebx", "%ecx", "%edx", "edi", "esi");
}
```

```
$ gcc -S test.c

error: extended registers have no high halves
```

```
$ clang -S test.c

no error
```

so we fix the bug in this patch.

`getX86SubSuperRegister` is just a wrapper of `getX86SubSuperRegisterOrZero` with a `assert`.
I belive we should remove the latter.

Reviewed By: pengfei

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

21 months ago[DAGCombiner] handle more store value forwarding
Chen Zheng [Fri, 9 Dec 2022 05:27:14 +0000 (00:27 -0500)]
[DAGCombiner] handle more store value forwarding

When lowering calls on target like PPC, some stack loads
will be generated for by value parameters. Node CALLSEQ_START
prevents such loads from being combined.

Suggested by @RolandF, this patch removes the unnecessary
loads for the byval parameter by extending ForwardStoreValueToDirectLoad

Reviewed By: nemanjai, RolandF

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

21 months ago[DAGCombiner][NFC] add testcases for D138899
Chen Zheng [Fri, 9 Dec 2022 10:08:03 +0000 (05:08 -0500)]
[DAGCombiner][NFC] add testcases for D138899

21 months ago[JITLink] Ensure that in-flight alloc is abandoned on error in post-alloc phase.
Lang Hames [Thu, 2 Feb 2023 01:42:30 +0000 (17:42 -0800)]
[JITLink] Ensure that in-flight alloc is abandoned on error in post-alloc phase.

If an error occurs during the post-allocation phase (JITLinkerBase::linkPhase2)
then we need to call JITLinkMemoryManager::InFlightAlloc::abandon so that the
allocation has a chance to clean up. This was already handled for later phases,
but we were skipping the abandon step when we bailed out of phase 2.

21 months ago[RISCV][MC] Simplify .option and make error messages more conventional
Fangrui Song [Thu, 2 Feb 2023 01:58:23 +0000 (17:58 -0800)]
[RISCV][MC] Simplify .option and make error messages more conventional

and add line/column information to tests.

21 months agoRevert (and fix properly) "Uninitialize the file descriptor."
Mircea Trofin [Thu, 2 Feb 2023 01:39:34 +0000 (17:39 -0800)]
Revert (and fix properly) "Uninitialize the file descriptor."

This reverts commit f514b0e144db063931d19a8ebc2dc42083d0eb2f.

The culprit is that InEC is initialized before Inbound, and Inbound's
initialization happens through a call to openFileForRead. However, the
typical initialization order warnings don't fire; so the behavior was:
Inbound is initialized correctly by openFileForRead; then it's reset to
whatever initializer value (0 originally).

A fix is to move Inbound's decl upfront. I'd still prefer initializing
it to something - and -1 seems like a more appropriate value (it causes
a fail-fast rather than a hang due to trying to read from a
valid-looking but unopen fd).

21 months ago[HWASAN] Set os_id in Thread::Init to make sure that the thread can be found by GetTh...
Kirill Stoimenov [Thu, 2 Feb 2023 01:32:16 +0000 (01:32 +0000)]
[HWASAN] Set os_id in Thread::Init to make sure that the thread can be found by GetThreadByOsIDLocked.

Reviewed By: vitalybuka

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

21 months agoUninitialize the file descriptor.
Mircea Trofin [Thu, 2 Feb 2023 01:30:05 +0000 (17:30 -0800)]
Uninitialize the file descriptor.

Unblocking the build. Investigating why the value can't be initialized
(even to e.g. -1) before calling open.

21 months ago[HLSL] [Dirver] add dxv as a VerifyDebug Job
Xiang Li [Fri, 13 Jan 2023 18:05:36 +0000 (13:05 -0500)]
[HLSL] [Dirver] add dxv as a VerifyDebug Job

New option --dxv-path is  added for dxc mode to set the installation path for dxv.
If cannot find dxv, a warning will be report.

dxv will be executed with command line dxv file_name -o file_name.
It will validate and sign the file and overwrite it.

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

21 months ago[libc++] Avoid ODR violations in __exception_guard
Nikolas Klauser [Wed, 1 Feb 2023 15:04:53 +0000 (16:04 +0100)]
[libc++] Avoid ODR violations in __exception_guard

Having an ODR violation with `__exception_guard` seems to be problematic in LTO builds. To avoid the ODR violation, give the class different names for exception/no-exceptions mode and have an alias to the correct class.

Reviewed By: ldionne, #libc, alexfh

Spies: aeubanks, dblaikie, joanahalili, alexfh, rupprecht, libcxx-commits

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