platform/upstream/llvm.git
20 months ago[RISCV] Add a check for integer setcc to RISCVDAGToDAGISel::selectCondOp
Craig Topper [Sat, 25 Feb 2023 18:39:57 +0000 (10:39 -0800)]
[RISCV] Add a check for integer setcc to RISCVDAGToDAGISel::selectCondOp

20 months ago[clang-tidy] Fix false-positive in readability-container-size-empty
Piotr Zegar [Sat, 25 Feb 2023 16:07:04 +0000 (16:07 +0000)]
[clang-tidy] Fix false-positive in readability-container-size-empty

Ignoring std::array type when matching 'std:array == std::array()'.
In such case we shouldn't propose to use empty().

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

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

20 months ago[RISCV] Add explicit i64 to reduce RISCVGenDAGISel.inc size.
Craig Topper [Sat, 25 Feb 2023 18:07:26 +0000 (10:07 -0800)]
[RISCV] Add explicit i64 to reduce RISCVGenDAGISel.inc size.

20 months ago[RISCV] Add explicit types to some XTHead isel patterns to reduce RISCVGenDAGISel...
Craig Topper [Sat, 25 Feb 2023 17:57:57 +0000 (09:57 -0800)]
[RISCV] Add explicit types to some XTHead isel patterns to reduce RISCVGenDAGISel.inc size.

HWMode expansion of GPR can create patterns with i32 types with
Subtarget->is64Bit() or i64 types with !Subtarget->is64Bit().
These patterns will never match. They just waste space in the table.

By adding explicit i32 or i64 to patterns that only apply to RV32
or RV64 we can filter these patterns.

20 months ago[libc++] Add FTM for views::as_rvalue
Nikolas Klauser [Sat, 25 Feb 2023 09:26:28 +0000 (10:26 +0100)]
[libc++] Add FTM for views::as_rvalue

`views::as_rvalue` was implemented in D137637, but we forgot to set the feature test macro.
Fixes #60986.

Reviewed By: Mordante, #libc

Spies: libcxx-commits, arichardson

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

20 months ago[BOLT] fix tests on arm64
Sebastian Pop [Sat, 18 Feb 2023 01:12:33 +0000 (01:12 +0000)]
[BOLT] fix tests on arm64

The two tests were failing on arm64-linux with:
BOLT-ERROR: invalid target 'x86-64'.

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

20 months agoRemove WG14 N2829 from the C status page; NFC
Aaron Ballman [Sat, 25 Feb 2023 16:04:54 +0000 (11:04 -0500)]
Remove WG14 N2829 from the C status page; NFC

This paper is about changes to the assert macro, but assert.h is not
provided by the compiler, so there's no work for Clang to do to support
this feature.

20 months ago[libc++] Implement LWG-3204: `sub_match::swap` only swaps the base class
Igor Zhukov [Sat, 25 Feb 2023 14:43:37 +0000 (21:43 +0700)]
[libc++] Implement LWG-3204: `sub_match::swap` only swaps the base class

Reviewed By: Mordante, JMazurkiewicz, #libc

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

20 months ago[C2x] Implement support for revised spelling of keywords
Aaron Ballman [Sat, 25 Feb 2023 14:27:46 +0000 (09:27 -0500)]
[C2x] Implement support for revised spelling of keywords

This implements WG14 N2934
(https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2934.pdf), which
adds keywords for alignas, alignof, bool, static_assert, and
thread_local in C, as aliases for _Alignas, _Alignof, _Bool,
_Static_assert, and _Thread_local. We already supported the keywords in
C2x mode, but this completes support by adding pre-C2x compat warnings
and updates the stdalign.h header in freestanding mode.

20 months ago[X86] Fix the base pointer save/restore bug
Luo, Yuanke [Thu, 23 Feb 2023 09:02:18 +0000 (17:02 +0800)]
[X86] Fix the base pointer save/restore bug

Previous the stack slot for spilling base pointer register is allocated
after the stack realignment. When the stack is naturally aligned the
stack slot is share with other data that allocated from stack and cause
data corrupt. Another issue is the stack slot for save/restore the
callee saved register is not fixed for each function. It depends on the
register usage of them in each function.

This patch is to recalculate the offset the stack slot for base pointer
register during the prolog/epilog insert pass, and allocate the stack
slot when spilling callee saved registers.

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

20 months ago[SimplifyCFG] Improve the precision of `PtrValueMayBeModified`
DianQK [Sat, 25 Feb 2023 11:42:58 +0000 (19:42 +0800)]
[SimplifyCFG] Improve the precision of `PtrValueMayBeModified`

The result value of `getelementptr inbounds (TY, null, not zero)` is a poison value. We can think of it as undefined behavior.

> Please let me know if there is anything I don't understand correctly.

Reviewed By: nikic, xbolva00

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

20 months ago[Flang][OpenMP] NFC: Remove omp prefix of test files in OpenMP Lower
Kiran Chandramohan [Sat, 25 Feb 2023 11:38:57 +0000 (11:38 +0000)]
[Flang][OpenMP] NFC: Remove omp prefix of test files in OpenMP Lower

For tests in the OpenMP sub-directory the `omp` prefix is removed.

20 months ago[Flang][OpenMP] NFC: Remove omp prefix of test files in OpenMP Semantics
Kiran Chandramohan [Sat, 25 Feb 2023 11:09:44 +0000 (11:09 +0000)]
[Flang][OpenMP] NFC: Remove omp prefix of test files in OpenMP Semantics

For tests in the OpenMP sub-directory the `omp` prefix is removed.

20 months ago[Flang][OpenMP] NFC: Move OpenMP parser tests to a sub-directory
Kiran Chandramohan [Sat, 25 Feb 2023 10:49:47 +0000 (10:49 +0000)]
[Flang][OpenMP] NFC: Move OpenMP parser tests to a sub-directory

Now that the test files are in the OpenMP subdirectory, remove the
`omp` prefix.

20 months ago[clang-format] Don't move qualifiers past pointers-to-member
Emilia Dreamer [Sat, 25 Feb 2023 10:19:13 +0000 (12:19 +0200)]
[clang-format] Don't move qualifiers past pointers-to-member

Previously, given a pointer-to-member type such as `Foo const Bar::*`,
clang-format would see the `const Bar::` part as a regular type name
with scope resolution operators, and with `QualifierAlignment: Right` it
would attempt to "fix" it, resulting in `Foo Bar::const *`, a syntax
error.

This patch no longer allows qualifiers to be moved across `::*`.

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

Reviewed By: owenpan, MyDeveloperDay, HazardyKnusperkeks

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

20 months ago[clang-format] Rewrite how indent is reduced for compacted namespaces
Emilia Dreamer [Sat, 25 Feb 2023 10:13:27 +0000 (12:13 +0200)]
[clang-format] Rewrite how indent is reduced for compacted namespaces

The previous version set the indentation directly using IndentForLevel,
however, this has a few caveats, namely:

* IndentForLevel applies to all scopes of the entire program being
  formatted, but this indentation should only be adjusted for scopes
  of namespaces.

* The method it used only set the correct indent amount if one wasn't
  already set for a given level, meaning it didn't work correctly if
  anything with indentation preceded a namespace keyword. This
  includes preprocessing directives if using IndentPPDirectives.

This patch instead reduces the Level of all lines within namespaces
which are compacted by CompactNamespaces. This means they will get
correct indentation using the normal process.

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

Reviewed By: owenpan, MyDeveloperDay, HazardyKnusperkeks

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

20 months agoRevert "foo"
Craig Topper [Sat, 25 Feb 2023 08:53:30 +0000 (00:53 -0800)]
Revert "foo"

This reverts commit f07bb0012e76495d50b34fe50fe7d41a70c8685b.

Failed to squash this commit

20 months agoRevert "[RISCV] Add explicit types to some XTHead isel patterns to reduce RISCVGenDAG...
Craig Topper [Sat, 25 Feb 2023 08:53:08 +0000 (00:53 -0800)]
Revert "[RISCV] Add explicit types to some XTHead isel patterns to reduce RISCVGenDAGISel.inc size."

This reverts commit 7910ed1d56c349b76c82d5ebe2f2590770955ff5.

Accidentally failed to squash a commit

20 months ago[RISCV] Add explicit types to some XTHead isel patterns to reduce RISCVGenDAGISel...
Craig Topper [Sat, 25 Feb 2023 08:40:09 +0000 (00:40 -0800)]
[RISCV] Add explicit types to some XTHead isel patterns to reduce RISCVGenDAGISel.inc size.

HWMode expansion of GPR can create patterns with i32 types with
Subtarget->is64Bit() or i64 types with !Subtarget->is64Bit().
These patterns will never match. They just waste space in the table.

By adding explicit i32 or i64 to patterns that only apply to RV32
or RV64 we can filter these patterns.

20 months agofoo
Craig Topper [Sat, 25 Feb 2023 08:32:13 +0000 (00:32 -0800)]
foo

20 months ago[RISCV] Combine some duplicate XTHeadFMemIdx patterns. NFC
Craig Topper [Sat, 25 Feb 2023 08:16:33 +0000 (00:16 -0800)]
[RISCV] Combine some duplicate XTHeadFMemIdx patterns. NFC

We had identical patterns for TH_FLRW, TH_FSRW, TH_FLRD, and TH_FSRD
under both IsRV32 and IsRV64.

20 months ago[lld][RISCV] Avoid error when encountering unrecognised ISA extensions/versions in...
Alex Bradbury [Sat, 25 Feb 2023 06:17:40 +0000 (06:17 +0000)]
[lld][RISCV] Avoid error when encountering unrecognised ISA extensions/versions in RISC-V attributes

This patch follows on from this RFC thread
<https://discourse.llvm.org/t/rfc-resolving-issues-related-to-extension-versioning-in-risc-v/68472/>
and the ensuing discussion in the RISC-V LLVM sync-up call. The
consensus agreed that the behaviour change in LLD introduced in D138550
that results in object files including arch attributes with unrecognised
extensions or versions of extensions is a regression and should be
treated as such. As it stands, this logic means that LLD will error out
if trying to link a RISC-V object file from LLVM HEAD (rv32i2p0/rv64i2p0)
with one from current GCC (rv32i2p1/rv64i2p1 by default).

There's a bigger discussion about exactly when to warn vs error and so
on, and how to control that, and this patch doesn't attempt to address
all those questions. It simply tries to fix the problem with a minimally
invasive change, intended to be cherry-picked for 16.0.x (ideally
16.0.0, but queued for 16.0.1 if we're too late in the release cycle).

As you can see from the test changes, although the changed logic is
mostly more permissive, it will reject some embedded arch strings that
were accepted before. Because the same logic was previously used for
parsing human-written -march as for the arch attribute (intended to be
stored in normalised form), various short-hand formats were previously
accepted. Maintaining support for such ill-formed attributes would
substantially complicate the logic, and given the previous
implementation was so much stricter in every other way, was surely a bug
rather than a design choice.

Surprisingly, the precise rules for how numbers can be embedded into
extension names isn't fully defined (there is a PR to the ISA manual
that is not yet merged
<https://github.com/riscv/riscv-isa-manual/pull/718>).
In the absence of specific criteria for rejecting extensions names that
would be ambiguous in abbreviated form,
`RISCVISAInfo::parseArchStringNormalized` just pulls out the version
information from the end of each extension description.

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

20 months ago[libc++][test] Silence MSVC deprecation warnings
Casey Carter [Fri, 24 Feb 2023 02:50:13 +0000 (18:50 -0800)]
[libc++][test] Silence MSVC deprecation warnings

... for implicitly-generated copy constructors and copy assignment operators.

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

20 months agoclang: Add __builtin_elementwise_fma
Matt Arsenault [Thu, 8 Dec 2022 03:49:27 +0000 (22:49 -0500)]
clang: Add  __builtin_elementwise_fma

I didn't understand why the other builtins have promotion logic,
or how it would apply for a ternary operation. Implicit conversions
are evil to begin with,  and even more so when the purpose is to get
an exact IR intrinsic. This checks all the arguments have the same type.

20 months agoAdd info about the "testing only" aspect of `--allow-unregistered-dialect` in the...
Mehdi Amini [Sat, 25 Feb 2023 00:37:05 +0000 (17:37 -0700)]
Add info about the "testing only" aspect of `--allow-unregistered-dialect` in the cl::opt desc (NFC)

20 months ago[MLIR][doc] Clarify `allowUnregisteredDialects()` as "testing option" (NFC)
Mehdi Amini [Sat, 25 Feb 2023 00:29:02 +0000 (17:29 -0700)]
[MLIR][doc] Clarify `allowUnregisteredDialects()` as "testing option" (NFC)

Reviewed By: jpienaar

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

20 months ago[lldb][test] Fix vCont-threads/main.cp for -std=c++11
Fangrui Song [Fri, 24 Feb 2023 23:08:24 +0000 (15:08 -0800)]
[lldb][test] Fix vCont-threads/main.cp for -std=c++11

20 months ago[docs] Update compiler-rt/CODE_OWNERS.TXT
Vitaly Buka [Thu, 20 Oct 2022 00:24:41 +0000 (17:24 -0700)]
[docs] Update compiler-rt/CODE_OWNERS.TXT

D135617 leftovers

Reviewed By: browneee, cryptoad

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

20 months ago[OpenMP] Remove uses of ATOMIC_VAR_INIT
Fangrui Song [Fri, 24 Feb 2023 22:47:55 +0000 (14:47 -0800)]
[OpenMP] Remove uses of ATOMIC_VAR_INIT

ATOMIC_VAR_INIT has a trivial definition
`#define ATOMIC_VAR_INIT(value) (value)`,
is deprecated in C17/C++20, and will be removed in newer standards in
newer GCC/Clang (e.g. https://reviews.llvm.org/D144196).

20 months agoRemove uses of ATOMIC_VAR_INIT
Fangrui Song [Fri, 24 Feb 2023 21:43:12 +0000 (13:43 -0800)]
Remove uses of ATOMIC_VAR_INIT

ATOMIC_VAR_INIT has a trivial definition `#define ATOMIC_VAR_INIT(value) (value)`,
is deprecated in C17/C++20, and will be removed in newer standards.

20 months ago[libc] Clarify printf percent conversion behavior.
Michael Jones [Thu, 23 Feb 2023 22:52:56 +0000 (14:52 -0800)]
[libc] Clarify printf percent conversion behavior.

Almost all printf conversions ending in '%' are undefined, but they're
traditionally treated as if the complete conversion specifier is "%%".
This patch modifies the parser to more closely match that behavior.

Reviewed By: sivachandra

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

20 months agoAdd transform for `(and/or (icmp eq/ne A,-1),(icmp eq/ne A,-1+C))`->`(and/or (icmp...
Noah Goldstein [Fri, 24 Feb 2023 08:27:34 +0000 (02:27 -0600)]
Add transform for `(and/or (icmp eq/ne A,-1),(icmp eq/ne A,-1+C))`->`(and/or (icmp eq/ne (and ~A,-1+C),0))`

This works of `-1+C` is a negative power of 2.

This can be more useful than the `AddAnd` case as `~A` does not
necessarily require materializing a constant. This makes the transform
worth it for X86 vector types.

Alive2 Links:
EQ: https://alive2.llvm.org/ce/z/P6u8cq
NE: https://alive2.llvm.org/ce/z/_Kkqp1

Reviewed By: RKSimon

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

20 months agoMake `(and/or (icmp eq/ne A,C0), (icmp eq/ne A,C1))` where `IsPow(dif(C0,C1))` work...
Noah Goldstein [Fri, 17 Feb 2023 03:49:06 +0000 (21:49 -0600)]
Make `(and/or (icmp eq/ne A,C0), (icmp eq/ne A,C1))` where `IsPow(dif(C0,C1))` work for more patterns.

`(and/or (icmp eq/ne A,C0), (icmp eq/ne A,C1))` can be lowered to
`(icmp eq/ne (and (sub A, (smin C0, C1)), (not (sub (smax C0, C1), (smin C0, C1)))), 0)`
generically if `(sub (smax C0, C1), (smin C0,C1))` is a power of 2.

This covers the existing case of `(and/or (icmp eq/ne A, C_Pow2),(icmp eq/ne A, -C_Pow2))`
as well as other cases.

Alive2 Links:
EQ: https://alive2.llvm.org/ce/z/mLJiUW
NE: https://alive2.llvm.org/ce/z/TKnzUr

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

20 months agoAdd tests for (or/and (icmp eq/ne A, C0), (icmp eq/ne A, C1)) where IsPow2(dif(C0...
Noah Goldstein [Fri, 17 Feb 2023 17:56:55 +0000 (11:56 -0600)]
Add tests for (or/and (icmp eq/ne A, C0), (icmp eq/ne A, C1)) where IsPow2(dif(C0, C1)); NFC

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

20 months agoAdd transforms for `(max/min (xor X, Pow2), X)` -> `(and/or X, Pow2/~Pow2)`
Noah Goldstein [Thu, 23 Feb 2023 00:36:49 +0000 (18:36 -0600)]
Add transforms for `(max/min (xor X, Pow2), X)` -> `(and/or X, Pow2/~Pow2)`

X ^ Pow2 is guranteed to flip one bit. We can use this to speedup
max/min by just selecting X with/without (or/andnot) the flipped bit
respectively.

Alive2 Links:
smax-neg: https://alive2.llvm.org/ce/z/j3QYFs
smin-neg: https://alive2.llvm.org/ce/z/bFYnQW
smax-pos: https://alive2.llvm.org/ce/z/4xYSxR
smin-pos: https://alive2.llvm.org/ce/z/H3RPKj
umax    : https://alive2.llvm.org/ce/z/P4oRcX
umin    : https://alive2.llvm.org/ce/z/vWZG6p

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

20 months agoAdd tests for transforming `(max/min (xor X, Pow2), X)`; NFC
Noah Goldstein [Thu, 23 Feb 2023 00:36:38 +0000 (18:36 -0600)]
Add tests for transforming `(max/min (xor X, Pow2), X)`; NFC

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

20 months agoAdd tests for shuffle as shift/rotate; NFC
Noah Goldstein [Thu, 16 Feb 2023 17:56:27 +0000 (11:56 -0600)]
Add tests for shuffle as shift/rotate; NFC

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

20 months agoAdd Extend shuffle pattern to vNf32 shuffles.
Noah Goldstein [Thu, 16 Feb 2023 17:56:11 +0000 (11:56 -0600)]
Add Extend shuffle pattern to vNf32 shuffles.

There are some cases where its useful for float types, not quite as
hot as in the integer case, but still better than alternatives.

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

20 months agoPrioritize lowering V{4|16}F32 with blend.
Noah Goldstein [Thu, 16 Feb 2023 17:55:58 +0000 (11:55 -0600)]
Prioritize lowering V{4|16}F32 with blend.

Blend is often fastest available instruction so it should be higher
priority for v4f32 and an option for v16f32.

Reviewed By: RKSimon

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

20 months ago[SLP]Improve handling gathers/buildvectors with undefs.
Alexey Bataev [Fri, 24 Feb 2023 00:58:01 +0000 (16:58 -0800)]
[SLP]Improve handling gathers/buildvectors with undefs.

If have just one non-undef scalar in the buildvector/gather node, we try
to put it to be the very first element, which is profitable in most
cases. Do the preliminary estimation, if this more profitable during
graph rotation and do same for all elements, including extractelements.

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

20 months ago[OCaml] Remove all PassManager-related functions
Alan Hu [Fri, 24 Feb 2023 21:14:11 +0000 (13:14 -0800)]
[OCaml] Remove all PassManager-related functions

Reviewed By: aeubanks, nikic

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

20 months ago[z/OS][NFC] Remove obsolete code.
Zibi Sarbinowski [Fri, 24 Feb 2023 21:01:47 +0000 (15:01 -0600)]
[z/OS][NFC] Remove obsolete code.

Remoce obsolete code from libcxxabi/CMakeLists.txt

Reviewed By: #libc_abi, abhina.sreeskantharajan, phosek

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

20 months ago[PowerPC] Add Binary Coded Decimal Assist Instructions
Stefan Pintilie [Fri, 24 Feb 2023 14:32:22 +0000 (09:32 -0500)]
[PowerPC] Add Binary Coded Decimal Assist Instructions

This patch adds three instructions for Binary Coded Decimal (BCD).
They are: cdtbcd, cbcdtd, addg6s.

Reviewed By: amyk

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

20 months agoLanguageExtensions.rst: fix a typo in the `#pragma clang deprecated` example
Fangrui Song [Fri, 24 Feb 2023 20:41:49 +0000 (12:41 -0800)]
LanguageExtensions.rst: fix a typo in the `#pragma clang deprecated` example

20 months ago[RISCV] Add vendor-defined XTheadCondMov (conditional move) extension
Philipp Tomsich [Fri, 24 Feb 2023 20:25:23 +0000 (21:25 +0100)]
[RISCV] Add vendor-defined XTheadCondMov (conditional move) extension

The vendor-defined XTheadCondMov (somewhat related to the upcoming
Zicond and XVentanaCondOps) extension add conditional move
instructions with $rd being an input and an ouput instructions.

It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.

The current (as of this commit) public documentation for this
extension is available at:
  https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf

Support for these instructions has already landed in GNU Binutils:
  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=73442230966a22b3238b2074691a71d7b4ed914a

Reviewed By: craig.topper

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

20 months ago[libc] Add a linting target named "libc-lint".
Siva Chandra Reddy [Fri, 24 Feb 2023 08:27:29 +0000 (08:27 +0000)]
[libc] Add a linting target named "libc-lint".

Lint targets for individual entrypoints have also been cleaned up. The
target "libc-lint" depends on the individual lint targets.

Reviewed By: lntue

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

20 months ago[libc++][test] Use the Japanese test.
Mark de Wever [Fri, 24 Feb 2023 16:16:36 +0000 (17:16 +0100)]
[libc++][test] Use the Japanese test.

This was discovered in D144667.

Reviewed By: #libc, Mordante

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

20 months ago[clang-tidy] improve readability-identifier-naming hungarian options test
Alexis Murzeau [Fri, 24 Feb 2023 19:17:56 +0000 (19:17 +0000)]
[clang-tidy] improve readability-identifier-naming hungarian options test

Adjust identifier-naming-hungarian-notation-cfgfile test with
changes for all configs in .clang-tidy to ensure they are really taken
into account.

This is done this way:

- Set all HungarianNotation.* options to `cust` prefix + their default
  value.
- Set TreatStructAsClass to true as it defaults to false.
- Because of the TreatStructAsClass change, add a test to check that
  structs are really checked the same way as classes (see
  `struct StructCase`).

Also, `TreatStructAsClass` was wrongly named in the test's .clang-tidy file
and was fixed (it is in `General`, not in `Options`).

Depends on D144431

Reviewed By: carlosgalvezp

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

20 months ago[SLP][NFC]Format and improve function, returning std::optional<struct>,
Alexey Bataev [Fri, 24 Feb 2023 18:49:38 +0000 (10:49 -0800)]
[SLP][NFC]Format and improve function, returning std::optional<struct>,
NFC.

20 months ago[llvm][NFC] Move tapi tests using nm to llvm-nm test directory
Cyndy Ishida [Fri, 24 Feb 2023 18:46:51 +0000 (10:46 -0800)]
[llvm][NFC] Move tapi tests using nm to llvm-nm test directory

Reviewed By: jhenderson

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

20 months ago[C2x] Remove the ATOMIC_VAR_INIT macro from stdatomic.h
Aaron Ballman [Fri, 24 Feb 2023 18:52:41 +0000 (13:52 -0500)]
[C2x] Remove the ATOMIC_VAR_INIT macro from stdatomic.h

This implements WG14 N2886 (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2886.htm)
which removed the macro entirely. (NB the macro was deprecated in C17.)
As the paper is not particularly clear on what alternative was picked,
here are my notes from the May 2022 meeting:

Does WG14 wish to adopt variant 1, change 3.2, 3.3, and 3.4 from N2886
into C23?
14/2/2 (consensus)
Does WG14 want to exchange Variant 1 with Variant 2 in N2886 in C23?
9/3/6 (consensus)

(There was no sentiment in the room for either Variant 3 or Variant 4
so those were not voted on.)

Does WG14 want to integrate change 3.5 in N2886 into C23?
8/1/9 (consensus)
Does WG14 want to integrate change 3.6 in N2886 into C23?
2/5/9 (no consensus)

Any code that is broken by the removal can remove the use of
ATOMIC_VAR_INIT and use regular initialization instead.

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

20 months ago[libc][math] Fix floating point exception testing macros in FPMatcher.h for
Tue Ly [Fri, 24 Feb 2023 18:35:52 +0000 (13:35 -0500)]
[libc][math] Fix floating point exception testing macros in FPMatcher.h for
aarch64.

20 months ago[CodeGen] Stop storing alignment information into pointers in Address
Akira Hatanaka [Fri, 24 Feb 2023 18:32:42 +0000 (10:32 -0800)]
[CodeGen] Stop storing alignment information into pointers in Address

This reverts b1613f05ae0ce4efc6b6475ea4459957ebcb0150. The change was
made in an attempt to reduce memory consumption by storing the alignment
information into pointers, but it turns out it doesn't make much
difference.

https://llvm-compile-time-tracker.com/compare.php?from=998ad085e865f2e5acc589d6bee0e3379042da2e&to=5de4a1989c474f37ac03f20ccb0aef50f6e3b854&stat=max-rss

This fixes a bug introduced in https://reviews.llvm.org/D142584. The
patch reduced the number of bits used for alignment from 6 bits to 5
bits, which made it impossible to encode the maximum allowed alignment
in llvm (1 << 32).

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

20 months agoRevert "[InstCombine] Remove early constant fold"
Vitaly Buka [Fri, 24 Feb 2023 18:04:26 +0000 (10:04 -0800)]
Revert "[InstCombine] Remove early constant fold"

Increase compile time with ubsan ARM from 3 to 14 min single file.
I upload reproducer into D144369.

Also we have random timeouts on internal x86_64 builds.
Both bisected to this one.

This reverts commit 45a0b812fa13ec255cae91f974540a4d805a8d79.

20 months ago[libc][math] Set floating point exceptions for exp*f, sinhf, and coshf.
Tue Ly [Sun, 19 Feb 2023 02:33:46 +0000 (21:33 -0500)]
[libc][math] Set floating point exceptions for exp*f, sinhf, and coshf.

Set FE_OVERFLOW and FE_UNDERFLOW for expf, exp2f, exp10f, expm1f, sinhf
and coshf.

Reviewed By: sivachandra, renyichen

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

20 months ago[RISCV] Use ComplexPattern to reduce the number of patterns for XVentanaCondOps.
Craig Topper [Fri, 24 Feb 2023 17:36:58 +0000 (09:36 -0800)]
[RISCV] Use ComplexPattern to reduce the number of patterns for XVentanaCondOps.

XVentanaCondOps check the condition operand for zero or non-zero.
We use this to optimize seteq/setne that would otherwise becomes
xor/xori/addi+snez/seqz. These patterns avoid the snez/seqz.

This patch adds two ComplexPatterns to match the varous cases and
emit the xor/xori/addi instruction.

These patterns can also be used by D144681.

Reviewed By: philipp.tomsich

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

20 months ago[clang][Driver] Pass /INFERASANLIBS:NO to link.exe under -fsanitize=address
Arthur Eubanks [Thu, 23 Feb 2023 21:19:08 +0000 (13:19 -0800)]
[clang][Driver] Pass /INFERASANLIBS:NO to link.exe under -fsanitize=address

With recent MSVC releases, STL headers will add /INFERASANLIBS to the drectve section of object files that are compiled with clang. With this flag, link.exe will automatically attempt to look for asan libs.

When using clang as the driver to invoke the linker, we want to disable this feature because we explicitly pass the proper asan libraries, otherwise we get symbols defined multiple times.

Reviewed By: hans

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

20 months ago[mlir][NVGPUToNVVM] Add option for emitting opaque pointers
Markus Böck [Fri, 24 Feb 2023 15:59:46 +0000 (16:59 +0100)]
[mlir][NVGPUToNVVM] Add option for emitting opaque pointers

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

The 'use-opaque-pointers' options, when enabled, changes the patterns to emit opaque pointers instead of typed pointers. As part of the migration effort the test have been converted to typed pointers, with an extra file for testing just typed pointers specific code paths.

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

20 months agoRevert "[clang-tidy] handle exceptions properly in `ExceptionAnalyzer`"
David Spickett [Fri, 24 Feb 2023 16:37:14 +0000 (16:37 +0000)]
Revert "[clang-tidy] handle exceptions properly in `ExceptionAnalyzer`"

This reverts commit 6b0cf1e15f8f84e3d4b6f9522287f6460527a7bf.

The included test is timing out on Arm/AArch64 bots.

20 months ago[mlir][SPIRV] Enable use of opaque-pointers in spirv-cpu-runner
Markus Böck [Fri, 24 Feb 2023 13:11:35 +0000 (14:11 +0100)]
[mlir][SPIRV] Enable use of opaque-pointers in spirv-cpu-runner

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

All passes required for lowering have already been successfully converted to allowing opaque-pointers. Switching the Spir-V runner to opaque-pointers is therefore only a matter of turning it on in these conversion passes. Regression tests also did not find any issues.

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

20 months ago[mlir][GPUToVulkan] Port conversion passes and `mlir-vulkan-runner` to opaque pointers
Markus Böck [Tue, 21 Feb 2023 09:43:18 +0000 (10:43 +0100)]
[mlir][GPUToVulkan] Port conversion passes and `mlir-vulkan-runner` to opaque pointers

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

This patch adds the new pass option 'use-opaque-pointers' to `-launch-func-to-vulkan` instructing the pass to emit LLVM opaque pointers instead of typed pointers.

Note that the pass as it was previously implemented relied on the fact LLVM pointers carried an element type. The passed used this information to deduce both the rank of a "lowered-to-llvm" MemRef as well as the element type. Since the element type when using LLVM opaque pointers is completely erased it is not possible to deduce the element type.

I therefore added a new attribute that is attached to the `vulkanLaunch` call alongside the binary blob and entry point name by the `-convert-gpu-launch-to-vulkan-launch` pass. It simply attaches a type array specifying the element types of each memref. This way the `-launch-func-to-vulkan` can simply read out the element type from the attribute.
The rank can still be deduced from the auto-generated C interface from `FinalizeMemRefToLLVM`. This is admittedly a bit fragile but I was not sure whether it was worth the effort to also add a rank array attribute.

As a last step, the use of opaque-pointers in `mlir-vulkan-runners` codegen pipeline was also enabled, since all covnersion passes used fully support it.

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

20 months ago[clang-format] Add simple macro replacements in formatting.
Manuel Klimek [Wed, 1 Feb 2023 13:20:28 +0000 (13:20 +0000)]
[clang-format] Add simple macro replacements in formatting.

Add configuration to specify macros.
Macros will be expanded, and the code will be parsed and annotated
in the expanded state. In a second step, the formatting decisions
in the annotated expanded code will be reconstructed onto the
original unexpanded macro call.

Eventually, this will allow to remove special-case code for
various macro options we accumulated over the years in favor of
one principled mechanism.

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

20 months ago[amdgpu] Change LDS lowering default to hybrid
Jon Chesterfield [Fri, 24 Feb 2023 15:20:11 +0000 (15:20 +0000)]
[amdgpu] Change LDS lowering default to hybrid

Postponed from D139433 until the bug fixed by D139874 could be resolved.

Reviewed By: arsenm

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

20 months ago[amdgpu] Add test case showing bug prior to D141852
Jon Chesterfield [Fri, 24 Feb 2023 14:47:12 +0000 (14:47 +0000)]
[amdgpu] Add test case showing bug prior to D141852

20 months ago[mlir][llvm] Add FastmathFlagsInterface only once (NFC).
Tobias Gysi [Fri, 24 Feb 2023 14:47:23 +0000 (15:47 +0100)]
[mlir][llvm] Add FastmathFlagsInterface only once (NFC).

Previously, the FastmathFlagsInterface has been added twice to
the LLVM::PowIOp. Once directly and once indirectly using the
requiresFastmath flag. This revision only uses the flag and drops
the redundant interface.

Reviewed By: definelicht

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

20 months ago[Codeview] Fix incorrect size determination for complex types.
Steve Merritt [Fri, 10 Feb 2023 13:49:49 +0000 (08:49 -0500)]
[Codeview] Fix incorrect size determination for complex types.

In Codeview, the basic type of a complex represents the size
of an individual component rather than the sum of the real
and imaginary components.

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

20 months ago[PDB] Error on too large stream directories
Hans Wennborg [Fri, 27 Jan 2023 17:33:02 +0000 (18:33 +0100)]
[PDB] Error on too large stream directories

We hit this in Chromium builds where the PDB file was just under 4GB,
but the stream directory was actually too large to be correctly
represented.

llvm-pdbutil would error about this in llvm::msf::validateSuperBlock,
but lld should not write such PDB files in the first place.

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

20 months agoVerifier: Don't rely on bitmask enum when checking nofpclass value
Matt Arsenault [Fri, 24 Feb 2023 13:38:10 +0000 (09:38 -0400)]
Verifier: Don't rely on bitmask enum when checking nofpclass value

20 months ago[mlir][Vector][Trivial] Move a conversion to LLVM test to the conversion passes test...
Markus Böck [Fri, 24 Feb 2023 13:33:19 +0000 (14:33 +0100)]
[mlir][Vector][Trivial] Move a conversion to LLVM test to the conversion passes test directory and port it to opaque pointers

20 months ago[mlir][LLVM] Enable opaque-pointers in e2e lowering test pass
Markus Böck [Fri, 24 Feb 2023 13:26:02 +0000 (14:26 +0100)]
[mlir][LLVM] Enable opaque-pointers in e2e lowering test pass

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

Given this is only a test pass I believe it should be fine to switch it to opaque-pointers entirely while migrating.

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

20 months ago[mlir][LinalgToLLVM] Add pass option for emitting opaque-pointers
Markus Böck [Fri, 24 Feb 2023 13:10:26 +0000 (14:10 +0100)]
[mlir][LinalgToLLVM] Add pass option for emitting opaque-pointers

While the pass itself doesn't directly require any changes to be compatible with opaque-pointers, it does import patterns for lowering MemRefs to LLVM.
Adding this pass option allows any users of the pass to switch to emitting opaque-pointers via the pass option

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

20 months ago[Libomptarget] Remove unused image argument from global handler function
Joseph Huber [Fri, 24 Feb 2023 13:23:34 +0000 (07:23 -0600)]
[Libomptarget] Remove unused image argument from global handler function

Summary:
A previous patch got rid of the use of this image but forgot to remove
it from this function. Simply remove it as it is unused now.

20 months ago[libc++] Remove <experimental/{algorithm,functional}>
Nikolas Klauser [Tue, 21 Feb 2023 13:16:41 +0000 (14:16 +0100)]
[libc++] Remove <experimental/{algorithm,functional}>

The contents of these files have been implemented for at least two releases, so let's remove them according to our policy (https://libcxx.llvm.org/DesignDocs/ExperimentalFeatures.html#id4).

Reviewed By: Mordante, #libc

Spies: arichardson, libcxx-commits

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

20 months ago[sanitizer] Support v2 and v3 capabilities
Ilya Leoshkevich [Fri, 24 Feb 2023 12:10:15 +0000 (13:10 +0100)]
[sanitizer] Support v2 and v3 capabilities

capget() and capset() may read or write more than one cap_user_data_t,
depending on the version field of cap_user_header_t. Currently the
code assumes it's just one, so MSan complains if an application uses
version 2 or 3, where two cap_user_data_ts are used.

Parse the header in order to determine the number of cap_user_data_ts.
Also add a test.

Reviewed By: vitalybuka

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

20 months agoFix the LLVM Sphinx build
Aaron Ballman [Fri, 24 Feb 2023 12:56:47 +0000 (07:56 -0500)]
Fix the LLVM Sphinx build

This addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/32299

20 months ago[Tooling/Inclusion] Add the generic abs symbol to the table.
Haojian Wu [Fri, 24 Feb 2023 11:49:06 +0000 (12:49 +0100)]
[Tooling/Inclusion] Add the generic abs symbol to the table.

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

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

20 months agoRecommit "[SCCP] Remove legacy SCCP pass."
Florian Hahn [Fri, 24 Feb 2023 12:47:30 +0000 (13:47 +0100)]
Recommit "[SCCP] Remove legacy SCCP pass."

This reverts commit a9a1950115d7db95c7439128b14af2cefe8f796d.

The legacy PM uses in Polly have been removed, so recommit the patch.

Original message:
    This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.

    Reviewed By: aeubanks

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

20 months ago[clang-tidy] handle exceptions properly in `ExceptionAnalyzer`
isuckatcs [Fri, 7 Oct 2022 22:23:33 +0000 (00:23 +0200)]
[clang-tidy] handle exceptions properly in `ExceptionAnalyzer`

This patch implements the exception handling rules found in
N4849 14.4 and as a result fixes many false positives in
the bugprone-exception-escape checker.

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

20 months agoLLParser: Fix failing nofpclass test
Matt Arsenault [Fri, 24 Feb 2023 12:40:41 +0000 (08:40 -0400)]
LLParser: Fix failing nofpclass test

20 months ago[Polly] Remove CodegenCleanupPass.
Florian Hahn [Fri, 24 Feb 2023 12:39:32 +0000 (13:39 +0100)]
[Polly] Remove CodegenCleanupPass.

The pass uses a bunch of deprecated legacy passes and appears unused.
Remove it to unblock removing legacy passes.

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

Reviewed By: Meinersbur

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

20 months agoRevert "Add tests to reproduce pointer/index width confusion crashes"
Dmitri Gribenko [Fri, 24 Feb 2023 12:24:51 +0000 (13:24 +0100)]
Revert "Add tests to reproduce pointer/index width confusion crashes"

This reverts commit 5a4f193afa0d73f7ec459648d8f02535577dd604.

See https://reviews.llvm.org/D144673, this change broke multiple
buildbots.

20 months ago[Tooling/Inclusion] Add the missing NULL symbol to the table.
Haojian Wu [Fri, 24 Feb 2023 10:45:29 +0000 (11:45 +0100)]
[Tooling/Inclusion] Add the missing NULL symbol to the table.

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

20 months agoAMDGPU: Document denormal behavior
Matt Arsenault [Tue, 6 Dec 2022 18:50:35 +0000 (13:50 -0500)]
AMDGPU: Document denormal behavior

Not sure this is the right place for it next to the table.

20 months agoIR: Add nofpclass parameter attribute
Matt Arsenault [Tue, 6 Dec 2022 18:04:15 +0000 (13:04 -0500)]
IR: Add nofpclass parameter attribute

This carries a bitmask indicating forbidden floating-point value kinds
in the argument or return value. This will enable interprocedural
-ffinite-math-only optimizations. This is primarily to cover the
no-nans and no-infinities cases, but also covers the other floating
point classes for free. Textually, this provides a number of names
corresponding to bits in FPClassTest, e.g.

  call nofpclass(nan inf) @must_be_finite()
  call nofpclass(snan) @cannot_be_snan()

This is more expressive than the existing nnan and ninf fast math
flags. As an added bonus, you can represent fun things like nanf:

  declare nofpclass(inf zero sub norm) float @only_nans()

Compared to nnan/ninf:
  - Can be applied to individual call operands as well as the return value
  - Can distinguish signaling and quiet nans
  - Distinguishes the sign of infinities
  - Can be safely propagated since it doesn't imply anything about
    other operands.
  - Does not apply to FP instructions; it's not a flag

This is one step closer to being able to retire "no-nans-fp-math" and
"no-infs-fp-math". The one remaining situation where we have no way to
represent no-nans/infs is for loads (if we wanted to solve this we
could introduce !nofpclass metadata, following along with
noundef/!noundef).

This is to help simplify the GPU builtin math library
distribution. Currently the library code has explicit finite math only
checks, read from global constants the compiler driver needs to set
based on the compiler flags during linking. We end up having to
internalize the library into each translation unit in case different
linked modules have different math flags. By propagating known-not-nan
and known-not-infinity information, we can automatically prune the
edge case handling in most functions if the function is only reached
from fast math uses.

20 months ago[ARM] Remove redundant BTI instructions for table jumps
Jirui Wu [Thu, 16 Feb 2023 16:28:09 +0000 (16:28 +0000)]
[ARM] Remove redundant BTI instructions for table jumps

A BTI instruction was previously inserted at the beginning of each block
that has its address stored in a jump table. Jump tables only emit
indirect jumps in ARM or Thumb1 modes. However, PACBTI is not supported
in these modes. As a result, BTI instructions emitted by jump tables are
redundant. Removing redundant BTI instructions improves the code size
and prevents potential gadgets.

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

20 months ago[ARM] Accept .w suffixes for some memory instructions
Jirui Wu [Tue, 31 Jan 2023 10:11:24 +0000 (10:11 +0000)]
[ARM] Accept .w suffixes for some memory instructions

Some memory instructions in the following sections of Armv7-M ARM allow
the .w mnemonic suffix, even though the preferred disassembly is without
the suffix.

A7.7.46 LDRB (immediate) T3
A7.7.55 LDRH (immediate) T3
A7.7.59 LDRSB (immediate) T2
A7.7.63 LDRSH (immediate) T2
A7.7.163 STRB (immediate) T3
A7.7.170 STRH (immediate) T3

This patch accepts the .w suffixes for theses instructions.
Pseudo-instructions and custom parsing logic are used instead of simple
aliases. More discussions are in these relevant patches:
https://reviews.llvm.org/D68916
https://reviews.llvm.org/D96632

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

20 months ago[clang][dataflow] Fix wrong assert for CXXConstructExpr
Paul Semel [Wed, 22 Feb 2023 10:36:39 +0000 (10:36 +0000)]
[clang][dataflow] Fix wrong assert for CXXConstructExpr

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

20 months ago[Tooling][Inclusions] Add c-header and global namespace alternatives for size_t
Kadir Cetinkaya [Thu, 23 Feb 2023 15:33:03 +0000 (16:33 +0100)]
[Tooling][Inclusions] Add c-header and global namespace alternatives for size_t

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

20 months ago[clangd] Fix UB in scanPreamble
Kadir Cetinkaya [Fri, 24 Feb 2023 08:52:40 +0000 (09:52 +0100)]
[clangd] Fix UB in scanPreamble

getMemBufferCopy triggers an UB when it receives a default constructed
StringRef. Make sure that we're always passing the null-terminated string
created in ParseInputs throughout the scanPreamble.

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

20 months ago[clangd] Avoid using CompletionItemKind.Text for macro completions
Nathan Ridge [Fri, 24 Feb 2023 06:17:44 +0000 (01:17 -0500)]
[clangd] Avoid using CompletionItemKind.Text for macro completions

Fixes https://github.com/clangd/clangd/issues/1484

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

20 months ago[mlir][IR] Add Iterator template option to IR walkers
Matthias Springer [Fri, 24 Feb 2023 09:13:36 +0000 (10:13 +0100)]
[mlir][IR] Add Iterator template option to IR walkers

This allows users to specify a  top-down or bottom-up traversal of the IR, in addition to the already existing WalkOrder.

Certain transformations work better with a forward traversal. E.g., when cloning a piece of IR, operations should be cloned top-down so that all uses are defined when creating an op.

Certain transformations work better with a reverse traversal. E.g., when erasing a piece of IR, operations should be erased bottom-up to avoid erasing operations that still have users.

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

20 months ago[SCEV] Increase FoldID bits size cover common cases.
Florian Hahn [Fri, 24 Feb 2023 08:41:52 +0000 (09:41 +0100)]
[SCEV] Increase FoldID bits size cover common cases.

This should fix the regressions introduced by a53d940cee6f by making
sure no dynamic allocations are needed in the common case, while
retaining support for arbitrary SCEV expressions.

Alternative to D144335.

Compile-time impact:
* NewPM-O3: -0.11%
* NewPM-ReleaseThinLTO: -0.10%
*NewPM-ReleaseLTO-g: -0.08%

https://llvm-compile-time-tracker.com/compare.php?from=df016a9525e5722dfd1e1e1632cec3ed7b33bc8a&to=c1c64de4a973bcecaddbc4038a539234eb39413b&stat=instructions:u

Reviewed By: vitalybuka, nikic

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

20 months ago[flang] Perform default value initialization on abstract type if needed
Valentin Clement [Fri, 24 Feb 2023 08:21:45 +0000 (09:21 +0100)]
[flang] Perform default value initialization on abstract type if needed

Abstract derived-type components can have default value so perform
the default value initialization if necessary.

```
type, abstract :: a
  integer :: b = 10
end type

type, extends(a) :: b
  integer :: d
end type
```

Reviewed By: klausler

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

20 months ago[flang][hlfir] Array constructor lowering [part 4/4]
Jean Perier [Fri, 24 Feb 2023 08:18:15 +0000 (09:18 +0100)]
[flang][hlfir] Array constructor lowering [part 4/4]

Enable character and derived type array constructor lowering.
Nothing special needs to be done other than lowering the types
before the array constructor lowering.
Derived type are forced to use the runtime for now to avoid
undesired usage of user defined assignment that hlfir.assign
may trigger when using the runtime.

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

20 months ago[NFC] Make FPClassTest a bitmask enumeration
Serge Pavlov [Fri, 24 Feb 2023 08:11:16 +0000 (15:11 +0700)]
[NFC] Make FPClassTest a bitmask enumeration

This is recommit of 2e416cdd52, fixed to be accepatble by GCC.
The original commit message is below.

With this change bitwise operations are allowed for FPClassTest
enumeration, it must simplify using this type. Also some functions
changed to get argument of type FPClassTest instead of unsigned.

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

20 months ago[flang][hlfir] Array constructor lowering [part 3/4]
Jean Perier [Fri, 24 Feb 2023 08:09:52 +0000 (09:09 +0100)]
[flang][hlfir] Array constructor lowering [part 3/4]

Lower the cases that require runtime support to deal
with the allocation, reallocation, or copy of ac-values to
the array constructor storage.

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

20 months agoASAN: keep support for Global::location
Martin Liska [Mon, 20 Feb 2023 20:06:08 +0000 (21:06 +0100)]
ASAN: keep support for Global::location

We as GCC still emit __asan_global_source_location for global variables
and we would like to use it in the future. On other hand, we don't
support llvm-symbolizer and the default libbacktraace symbolizer
does not support location info.

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

20 months ago[flang] Do not include dangling ac-implied-do-index in folded shape inquiry
Jean Perier [Fri, 24 Feb 2023 08:07:25 +0000 (09:07 +0100)]
[flang] Do not include dangling ac-implied-do-index in folded shape inquiry

The current code was replacing inquiry to array constructor whose
ac-value shape depends on ac-implied-do-index with an expression
using the ac-implied-do-index without the implied-do (folding the
first case added in the test as in the second case with a regular
symbol).

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

20 months ago[flang] Preserve useResultSymbolShape_ option when folding array constructor shape
Jean Perier [Fri, 24 Feb 2023 08:06:14 +0000 (09:06 +0100)]
[flang] Preserve useResultSymbolShape_ option when folding array constructor shape

By default evaluate::GetShape(expr) may return a compiler generated expression
using symbols that are part of function interfaces if there are function
references in "expr".
It is not right to replace an inquiry of "expr" with such compiler
generated expression since the call context would be lost, along with
the meaning of the inquiry expression.
Inquiry folding uses GetContextFreeShape(expr) that sets-up
useResultSymbolShape_ in GetShapeHelper to prevent such bad rewrites. But this did not
work properly with array constructor: GetShapeHelper made a call to
GetShape, ignoring and losing the "useResultSymbolShape_" instruction.

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

20 months ago[gn build] Port fffbfe7c0ca8
LLVM GN Syncbot [Fri, 24 Feb 2023 07:34:42 +0000 (07:34 +0000)]
[gn build] Port fffbfe7c0ca8