platform/upstream/llvm.git
20 months ago[OpenMP] generate the Windows import library that imports by name rather
Vadim Paretsky (Intel Americas Inc) [Mon, 13 Feb 2023 18:29:10 +0000 (10:29 -0800)]
[OpenMP] generate the Windows import library that imports by name rather
than ordinal

This check-in changes the OpenMP build script to generate the Windows
import library that imports by name rather than ordinal to reduce
ordinals order dependency and promote runtime flavors compatibility
going forward. The existing ordinals ordering is preserved to maintain
backward compatibility.

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

20 months ago[mlir] Add Float8E5M2FNUZ and Float8E4M3FNUZ types to MLIR
Jake Hall [Mon, 13 Feb 2023 14:10:20 +0000 (14:10 +0000)]
[mlir] Add Float8E5M2FNUZ and Float8E4M3FNUZ types to MLIR

Float8E5M2FNUZ and Float8E4M3FNUZ have been added to APFloat in D141863.
This change adds these types as MLIR builtin types alongside Float8E5M2
and Float8E4M3FN (added in D133823 and D138075).

Reviewed By: krzysz00

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

20 months ago[flang] Emit portability warning for extension
Peter Klausler [Mon, 6 Feb 2023 01:25:28 +0000 (17:25 -0800)]
[flang] Emit portability warning for extension

f18 accepts statement labels in fixed form source even if they follow
a semicolon -- i.e., they're not in the fixed form's label field.
Emit a warning for such usage.

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

20 months ago[mlir] Avoid building some shared libraries when PIC is off
Han Zhu [Mon, 30 Jan 2023 23:45:47 +0000 (15:45 -0800)]
[mlir] Avoid building some shared libraries when PIC is off

When `LLVM_ENABLE_PIC = OFF`, shared libraries cannot be built against code
that's compiled without -fPIC. Example error message:
``
ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in lib/libLLVMSupport.a(StringMap.cpp.o)
>>> referenced by StringMap.cpp
>>>               StringMap.cpp.o:(llvm::StringMapImpl::StringMapImpl(unsigned
>>>               int, unsigned int)) in archive lib/libLLVMSupport.a
``
Similar to [how libclang handles
this](https://github.com/llvm/llvm-project/blob/main/clang/tools/clang-shlib/CMakeLists.txt#L2-L4),
skip building these shared libraries when `LLVM_ENABLE_PIC = OFF`.

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

20 months agoRevert "Reland "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if...
Michael Buch [Mon, 13 Feb 2023 18:04:44 +0000 (18:04 +0000)]
Revert "Reland "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing""

This reverts commit 19128792e2aa320c1a149f7f93638cbd7f3c83c6.

As pointed out in https://reviews.llvm.org/D143652 this implementation
doesn't quite work for subobject constructors/destructors because DWARF
can map multiple definitions of a ctor/dtor to the same specification DIE.
With the current implementation we would pick the first definition we
find and use that linkage name which means we can sometimes pick the
wrong dtor/ctor and fail to execute a valid expression.

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

20 months agoRevert "[lldb][Test][NFC] TestExternalCtorDtorLookup: add more instantiations to...
Michael Buch [Mon, 13 Feb 2023 18:03:44 +0000 (18:03 +0000)]
Revert "[lldb][Test][NFC] TestExternalCtorDtorLookup: add more instantiations to test linkage name is correct"

This reverts commit 3c160d3051dc5d637bd35cfa673871338589ad8e.

This patch depends on the reverted patch in https://reviews.llvm.org/D143652

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

20 months ago[docs] Speculative link syntax fix
Philip Reames [Mon, 13 Feb 2023 17:42:25 +0000 (09:42 -0800)]
[docs] Speculative link syntax fix

20 months ago[ADT] Add llvm::rotl and llvm::rotr to bit.h
Kazu Hirata [Mon, 13 Feb 2023 17:40:27 +0000 (09:40 -0800)]
[ADT] Add llvm::rotl and llvm::rotr to bit.h

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

20 months ago[libc++][doc] Updates format status page.
Mark de Wever [Mon, 13 Feb 2023 17:32:04 +0000 (18:32 +0100)]
[libc++][doc] Updates format status page.

This adds the papers voted in during the Issaquah plenary.

20 months ago[clang] fix DR status in cxx_status.html
Corentin Jabot [Mon, 13 Feb 2023 17:24:20 +0000 (09:24 -0800)]
[clang] fix DR status in cxx_status.html

20 months ago[Driver] Add --vfsoverlay flag
Alex Brachet [Mon, 13 Feb 2023 17:24:40 +0000 (17:24 +0000)]
[Driver] Add --vfsoverlay flag

This flag implies `-ivfsoverlay`, and additionally passes the same
argument to the linker if it supports it. At present the only linker
which does is lld-link, so this functionality has only been added to
the MSVC toolchain. Additionally this option has been made a
CoreOption so that clang-cl can use it without `-Xclang`

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

20 months ago[flang] Allow for user-defined intrinsic operators (regression)
Peter Klausler [Mon, 6 Feb 2023 23:25:53 +0000 (15:25 -0800)]
[flang] Allow for user-defined intrinsic operators (regression)

The recent code that uses an iterative rather than recursive walk
over the parse tree when processing expressions needs to allow for
the rare case in which an intrinsic operator (e.g., +) is extended
by a generic interface in the program.

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

20 months ago[CSSPGO][Preinliner] Set default value of sample-profile-inline-limit-max to 50000.
Hongtao Yu [Fri, 10 Feb 2023 01:48:53 +0000 (17:48 -0800)]
[CSSPGO][Preinliner] Set default value of sample-profile-inline-limit-max to 50000.

The previous threshold 3000 is too small to enable any inlining for giant functions which come in with bigger size than that. In real world, I've seen a big hot function with 34000 dissasembly size. Motivated by that I'm changing the value to 50000.

With the new value the allowance size growth should still be reasonable, as it is also bounded by another threshold, i.e, --sample-profile-inline-growth-limit , which defaults to 12. The new value should mostly only affect giant functions.

I've seen for serveral internal services, the new threshold boosts performance, and it has neutral impact for other services without hot giant functions. So far I haven't seen any performance regression with that.

Reviewed By: wenlei

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

20 months ago[Clang] Export CanPassInRegisters as a type trait
Roy Jacobson [Mon, 13 Feb 2023 17:14:22 +0000 (19:14 +0200)]
[Clang] Export CanPassInRegisters as a type trait

While working on D140664, I thought it would be nice to be able to write tests
for parameter passing ABI. Currently we test this by dumping the AST and
matching the results which makes it hard to write new tests.
Adding this builtin will allow writing better ABI tests which
can help improve our coverage in this area.

While less useful, maybe some users would also find it useful for asserting
against pessimisations for their classes.

Reviewed By: erichkeane

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

20 months ago[RISCV][docs] Describe status of zicsr and zifencei
Philip Reames [Mon, 13 Feb 2023 17:07:28 +0000 (09:07 -0800)]
[RISCV][docs] Describe status of zicsr and zifencei

This has been a repeated point of recent confusion. There are a couple attempts in flight to change the way we handle the extensions, but for the moment, let's just document what's going on.

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

20 months ago[Tooling/Inclusion] Add symbol mappings for `std::experimental::filesystem`
Younan Zhang [Mon, 13 Feb 2023 11:17:26 +0000 (19:17 +0800)]
[Tooling/Inclusion] Add symbol mappings for `std::experimental::filesystem`

Clangd maintains a symbol map from standard library, in order to prevent
unexpected header/symbol leaks from internal files. (e.g. files under
`bits/` for libstdc++) This symbol map was generated by a python script
that parses pages of offline cppreference archive. The script didn't
handle the case for `std::experimental::`, where most symbols are from
TS. It works well as symbols are directly laid out in the corresponding
header under `experimental` directory for most of time.

However, libstdc++'s implementation split symbols of TS FS into a few
header files located in `experimental/bits`. This would make the code
completion provide internal headers when we simply select the symbols.

There are slightly differences between TS FS and C++17 FS. Some
functions like `system_complete` was replaced by `absolute` and
relative-related operations were introduced later by another proposal.
Even so, all mainstream implementation are based on N4100, the final
filesystem TS draft that was published in 2014 and from which symbols
we've added are exported.

This fixes https://github.com/clangd/clangd/issues/1481

Reviewed By: kadircet

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

20 months agoReland "[lldb][DWARFASTParserClang] Correctly resolve imported namespaces during...
Michael Buch [Fri, 10 Feb 2023 15:38:10 +0000 (15:38 +0000)]
Reland "[lldb][DWARFASTParserClang] Correctly resolve imported namespaces during expression evaluation"

This relands a patch previously reverted
in `181d6e24ca3c09bfd6ec7c3b20affde3e5ea9b40`.
This wasn't quite working on Linux because we
weren't populating the manual DWARF index with
`DW_TAG_imported_declaration`. The relanded patch
does this.

**Summary**

This patch makes the expression evaluator understand
namespace aliases.

This will become important once `std::ranges` become
more widespread since `std::views` is defined as:

```
namespace std {
namespace ranges::views {}

namespace views = ranges::views;
}
```

**Testing**

* Added API test

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

20 months ago[RISCV] Fix -Wbraced-scalar-init warning. NFC
Philipp Tomsich [Mon, 13 Feb 2023 16:56:20 +0000 (17:56 +0100)]
[RISCV] Fix -Wbraced-scalar-init warning. NFC

Fix the following warning:
/lib/Target/RISCV/RISCVISelLowering.cpp:315:24: error: braces around scalar initializer [-Werror,-Wbraced-scalar-init]
    setOperationAction({ISD::CTLZ}, XLenVT, Legal);
                       ^~~~~~~~~~~

20 months ago[ORC] StaticLibraryDefinitionGenerator -- support in-memory universal binaries.
Lang Hames [Mon, 13 Feb 2023 16:28:07 +0000 (08:28 -0800)]
[ORC] StaticLibraryDefinitionGenerator -- support in-memory universal binaries.

Add new StaticLibraryDefinitionGenerator::Create methods to support construction
from in-memory universal binaries.

20 months ago[libc++] Reorganize exception_guard
Louis Dionne [Fri, 3 Feb 2023 22:27:39 +0000 (17:27 -0500)]
[libc++] Reorganize exception_guard

We try to keep as little code as possible within #ifdef.

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

20 months ago[AMDGPU] Allow architected SGPRs for workgroup IDs
Christudasan Devadasan [Fri, 10 Feb 2023 07:54:07 +0000 (13:24 +0530)]
[AMDGPU] Allow architected SGPRs for workgroup IDs

Some subtargets use architected SGPRs for workgroup
IDs instead of the regular SGPRs. This patch enables
the support for the same and is guarded under the
subtarget feature FeatureArchitectedSGPRs.

Reviewed By: foad

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

20 months ago[AMDGPU] Add switch to enable architected SGPRs.
Christudasan Devadasan [Fri, 10 Feb 2023 06:22:00 +0000 (11:52 +0530)]
[AMDGPU] Add switch to enable architected SGPRs.

Reviewed By: rampitec, foad

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

20 months ago[extract_symbols.py] Adjust usage of nm again
John Brawn [Mon, 13 Feb 2023 15:59:20 +0000 (15:59 +0000)]
[extract_symbols.py] Adjust usage of nm again

The previous change to extract_symbols.py means that building on macOS
with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS fails as we try to export some
local symbols, as the regex used to match external symbols wasn't good
enough. Solve this by using the -g option to nm, so we only get
external symbols and don't have to check for local symbols at all.

20 months ago[AArch64] Add NZCV Def for TLSDESC_CALLSEQ
Mirko Müller [Mon, 13 Feb 2023 16:14:23 +0000 (16:14 +0000)]
[AArch64] Add NZCV Def for TLSDESC_CALLSEQ

The glibc and older musl handlers of tlsdesc_dynamic use a cmp instruction
which will clobber NZCV.

See glibc's _dl_tlsdesc_dynamic:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/aarch64/dl-tlsdesc.S;hb=refs/heads/release/2.37/master

See v1.1.21 Musl's __tlsdesc_dynamic:
https://git.musl-libc.org/cgit/musl/tree/src/ldso/aarch64/tlsdesc.s?h=v1.1.21

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

20 months ago[DAGCombine] Allow DAGCombine to remove dead masked stores.
Dinar Temirbulatov [Mon, 13 Feb 2023 16:07:06 +0000 (16:07 +0000)]
[DAGCombine] Allow DAGCombine to remove dead masked stores.

Remove a dead masked store if another one has the same base pointer and mask or
the following store has all true constant mask and size if equal or bigger to
the first store.

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

20 months ago[mlir][spirv] Drop outdated TODO comment
Jakub Kuderski [Mon, 13 Feb 2023 16:01:51 +0000 (11:01 -0500)]
[mlir][spirv] Drop outdated TODO comment

We do not plan to handle wide vector types with SPIR-V arrays anymore.

Reviewed By: antiagainst

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

20 months ago[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension
Philipp Tomsich [Mon, 13 Feb 2023 15:29:31 +0000 (16:29 +0100)]
[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension

The vendor-defined XTHeadBb (predating the standard Zbb extension)
extension adds some bit-manipulation extensions with somewhat similar
semantics as some of the Zbb 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 XTHeadBb is
available from:
  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=8254c3d2c94ae5458095ea6c25446ba89134b9da

Depends on D143036

Reviewed By: craig.topper

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

20 months ago[NFC] Fix using-declspec.cpp test with non-C++17 compilers
Tobias Hieta [Mon, 13 Feb 2023 15:58:13 +0000 (16:58 +0100)]
[NFC] Fix using-declspec.cpp test with non-C++17 compilers

20 months ago[mlir][bufferization] Better propagation of bufferizesToMemoryWrite through regions
Matthias Springer [Mon, 13 Feb 2023 15:35:47 +0000 (16:35 +0100)]
[mlir][bufferization] Better propagation of bufferizesToMemoryWrite through regions

`bufferizesToMemoryWrite(OpResult)` looks for OpOperands that bufferize to memory writes inside the region of the defining op (if it has one). Currently, if the reverse use-def chain stops at any value inside of the region, the OpResult is considered to bufferize to a memory write.

It is always safe to have false positives among `bufferizesToMemoryWrite`, so the previous implementation is also correct. However, it can lead to additional buffer copies.

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

20 months ago[flang] Fix new assertion failure
Peter Klausler [Wed, 8 Feb 2023 18:25:44 +0000 (10:25 -0800)]
[flang] Fix new assertion failure

Don't compute the address of  element [0] of a vector when the vector
is empty, even if the address is not used.

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

20 months agoRevert "[libc++] Remove _LIBCPP_CONSTEVAL"
Hans Wennborg [Mon, 13 Feb 2023 15:17:02 +0000 (16:17 +0100)]
Revert "[libc++] Remove _LIBCPP_CONSTEVAL"

It causes mysterious memory leaks when comparing std::string, see GitHub
Issue #60709 and the code review.

> All supported compilers support `consteval`, so there is no more need for the macro.
>
> Reviewed By: ldionne, Mordante, #libc
>
> Spies: libcxx-commits
>
> Differential Revision: https://reviews.llvm.org/D143489

This reverts commit aaef3b82f4f0dd3924a3491b381d5015ff472b86.

20 months ago[RISCV] Add vendor-defined XTHeadBs (single-bit) extension
Philipp Tomsich [Mon, 13 Feb 2023 15:10:11 +0000 (16:10 +0100)]
[RISCV] Add vendor-defined XTHeadBs (single-bit) extension

The vendor-defined XTHeadBs (predating the standard Zbs extension)
extension adds a bit-test instruction (th.tst) with similar semantics
as bexti from Zbs.  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 XTHeadBs is
available from:
  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=8254c3d2c94ae5458095ea6c25446ba89134b9da

Reviewed By: craig.topper

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

20 months ago[libc][NFC] Fix typo in header guards
Guillaume Chatelet [Mon, 13 Feb 2023 15:22:31 +0000 (15:22 +0000)]
[libc][NFC] Fix typo in header guards

20 months ago[RISCV] edit document of Zcb to match the Implementation
WuXinlong [Mon, 13 Feb 2023 11:27:20 +0000 (19:27 +0800)]
[RISCV] edit document of Zcb to match the Implementation

This patch reorder the list of Experimental Extensions in doc,
and change the spec verision in doc to match the actual Implementation

if this patch is so small that it is not worth to submit separately, Apologies for bothering

Reviewed By: craig.topper

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

20 months ago[PowerPC] Fix float materialization patterns.
Stefan Pintilie [Mon, 13 Feb 2023 14:59:23 +0000 (09:59 -0500)]
[PowerPC] Fix float materialization patterns.

Two of the float materialization patterns use the VSSRC regsiter class. This
register class is not available before Power 8. The patterns will stay the same
for Power 8 and up but must use the class F4RC for Power 7 and earlier.

This patch fixes those patterns.

Reviewed By: nemanjai, amyk, #powerpc

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

20 months ago[X86][FP16] Combine two steps conversions into direct conversion
Phoebe Wang [Mon, 13 Feb 2023 14:33:20 +0000 (22:33 +0800)]
[X86][FP16] Combine two steps conversions into direct conversion

When both v8i64 and v4f16 are not legal in a v8i64->v8f16 conversion, legalizer will breaks it into v8i64->v4i64->v4f32->v8f32->v8f16.

Given we support v4i64->v8f16, we can combine them with a shuffle instruction.

Reviewed By: LuoYuanke

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

20 months agoRecommit [YAML IO] Check that mapping doesn't contain duplicating keys
Anton Sidorenko [Mon, 13 Feb 2023 14:10:39 +0000 (17:10 +0300)]
Recommit [YAML IO] Check that mapping doesn't contain duplicating keys

The revert reason is fixed in D143727 (test changes).

According to YAML specification keys must be unique for a mapping node:
"The content of a mapping node is an unordered set of key/value node pairs, with
the restriction that each of the keys is unique".

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

20 months ago[flang] Handle correctly optional intrinsic scalar to unlimited polymorphic optional
Valentin Clement [Mon, 13 Feb 2023 14:42:25 +0000 (15:42 +0100)]
[flang] Handle correctly optional intrinsic scalar to unlimited polymorphic optional

When an optional intrinsic scalar is passed to a function expecting an
unlimited polymorphic dummy argument, the presence test must be done
before the emboxing otherwise it will result in a program crash.

Depends on D143888

Reviewed By: jeanPerier, PeteSteinfeld

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

20 months ago[clang] Handle __declspec() attributes in using
Tobias Hieta [Thu, 9 Feb 2023 09:53:39 +0000 (10:53 +0100)]
[clang] Handle __declspec() attributes in using

This patch fixes so that declspec attributes are forwarded
to the alias declaration.

Before this patch this would assert:

class Test { int a; };
using AlignedTest = __declspec(align(16)) const Test;
static_assert(alignof(AlignedTest) == 16, "error");

But afterwards it behaves the same as MSVC does and doesn't
assert.

Fixes: llvm/llvm-project#60513

Reviewed By: aaron.ballman

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

20 months ago[flang] Fix output type when emboxing intrinsic type to unlimited polymorphic box
Valentin Clement [Mon, 13 Feb 2023 14:41:19 +0000 (15:41 +0100)]
[flang] Fix output type when emboxing intrinsic type to unlimited polymorphic box

When emboxing an intrinsic type to a polymorphic descriptor, directly set its
type to `fir.class<none>`.

`fir.class<i32>` is not a real type used anywhere in lowering so make it right directly
avoid unnecessary convert op to `fir.class<none>`. Also `fir.class<i32>` would not be
recognized as unlimited polymorphic.

Reviewed By: jeanPerier, PeteSteinfeld

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

20 months ago[mlir] support complex type in DenseElementsAttr::get.
Xiang Li [Sun, 12 Feb 2023 17:19:17 +0000 (12:19 -0500)]
[mlir] support complex type in DenseElementsAttr::get.

Fixes #60662 https://github.com/llvm/llvm-project/issues/60662

Allow ComplexType when create DenseElementsAttr.
Also allow build ConstantOp for integer complex.

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

20 months ago[AArch64] Reassociate sub(x, add(m1, m2)) to sub(sub(x, m1), m2)
David Green [Mon, 13 Feb 2023 14:35:10 +0000 (14:35 +0000)]
[AArch64] Reassociate sub(x, add(m1, m2)) to sub(sub(x, m1), m2)

The mid end will reassociate sub(sub(x, m1), m2) to sub(x, add(m1, m2)). This
reassociates it back to allow the creation of more mls instructions.

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

20 months ago[VPlan] Fix iterator invalidation in adjustFixedOrderRecurrences.
Florian Hahn [Mon, 13 Feb 2023 13:51:14 +0000 (13:51 +0000)]
[VPlan] Fix iterator invalidation in adjustFixedOrderRecurrences.

adjustFixedOrderRecurrences may insert instructions after immediately
after the PHI nodes in the block. This invalidates the phis() iterator.
To avoid crashing/accessing invalid recipes, first collect all
first-order recurrence phi recipes.

This should fix a crash reported by @dmgreen after D142589 landed.

20 months ago[libc++] Fix bug in allocate_shared_for_overwrite
Louis Dionne [Fri, 10 Feb 2023 23:10:35 +0000 (15:10 -0800)]
[libc++] Fix bug in allocate_shared_for_overwrite

Instead of destroying the object with allocator::destroy, we must
call its destructor directly. As a fly-by also mark LWG3008 as
fixed since it is handled by our implementation.

This was pointed out by Tim Song in https://reviews.llvm.org/D140913.

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

20 months ago[flang] Avoid infinite recursion in common block check
Leandro Lupori [Thu, 2 Feb 2023 20:28:32 +0000 (20:28 +0000)]
[flang] Avoid infinite recursion in common block check

Don't call CheckCommonBlockDerivedType() recursively if the
derived type symbol is the same symbol that is already being
processed. This can happen when a component is a pointer of the
same type as its parent component, for instance.

Fixes #60230

Reviewed By: klausler

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

20 months ago[libc++] Implement P2136R3 std::invoke_r
Louis Dionne [Tue, 7 Feb 2023 17:20:35 +0000 (09:20 -0800)]
[libc++] Implement P2136R3 std::invoke_r

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

20 months ago[Test][lldb] Fix YAML mapping keys duplication. NFC.
Anton Sidorenko [Fri, 10 Feb 2023 12:37:13 +0000 (15:37 +0300)]
[Test][lldb] Fix YAML mapping keys duplication. NFC.

YAML specification does not allow keys duplication an a mapping. However, YAML
parser in LLVM does not have any check on that and uses only the last key entry.
In this change duplicated keys are merged to satisfy the spec.

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

20 months agoRevert rG0b0a38a7a229b70d7261771ba0e702843bd34e97 : "[X86] combineX86ShufflesRecursiv...
Simon Pilgrim [Mon, 13 Feb 2023 13:28:42 +0000 (13:28 +0000)]
Revert rG0b0a38a7a229b70d7261771ba0e702843bd34e97 : "[X86] combineX86ShufflesRecursively - don't widen shuffle subvector inputs"

Reports of miscompiles, that I'm still trying to triage - reverting for now

20 months ago[mlir][MemRef][Transform] Don't apply multibuffer on "useless" allocs
Quentin Colombet [Fri, 10 Feb 2023 16:21:38 +0000 (17:21 +0100)]
[mlir][MemRef][Transform] Don't apply multibuffer on "useless" allocs

`alloc`s that have users outside of loops are guaranteed to fail in
`multibuffer`.

Instead of exposing ourselves to that failure in the transform dialect,
filter out the `alloc`s that fall in this category.

To be able to do this filtering we have to change the `multibuffer`
transform op from `TransformEachOpTrait` to a plain `TransformOp`. This is
because `TransformEachOpTrait` expects that every successful `applyToOne`
returns a non-empty result.

Couple of notes:
- I changed the assembly syntax to make sure we only get `alloc` ops as
  input. (And added a test case to make sure we reject invalid inputs.)
- `multibuffer` can still fail pretty easily when you know its limitations.
  See the updated `op failed to multibuffer` test case for instance.
  Longer term, instead of leaking/coupling the actual implementation (in
  this case the checks normally done in `memref::multiBuffer`) with the
  transform dialect (the added check in `::apply`), we may want to refactor
  how we structure the underlying implementation. E.g., we could imagine a
  `canApply` method for all the implementations that we want to hook up in
  the transform dialect.
  This has some implications on how not to duplicate work between
  `canApply` and the actual implementation but I thought I throw that here
  to have us think about it :).

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

20 months ago[gn] port c4f7cc867299 (CoroTests)
Nico Weber [Mon, 13 Feb 2023 13:03:00 +0000 (08:03 -0500)]
[gn] port c4f7cc867299 (CoroTests)

20 months ago[Libomptarget] Remove dependency on the DeviceRTL from the GPU plugins
Joseph Huber [Thu, 2 Feb 2023 16:58:16 +0000 (10:58 -0600)]
[Libomptarget] Remove dependency on the DeviceRTL from the GPU plugins

The GPU plugins have a dependency on the device libraries. Sometimes we
cannot build the device libraries because the user does not have a valid
`clang` to use or it was explicitly disabled. Currently this leads to a
transitive failure because we cannot meet this dependency. This patch
simply removes that dependency.

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

Reviewed By: tianshilei1992

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

20 months ago[lldb][Test][NFC] TestExternalCtorDtorLookup: add more instantiations to test linkage...
Michael Buch [Mon, 13 Feb 2023 12:50:31 +0000 (12:50 +0000)]
[lldb][Test][NFC] TestExternalCtorDtorLookup: add more instantiations to test linkage name is correct

20 months ago[AArch64] Fix LSE2/LSE128/RCPC3 precedence
Tomas Matheson [Tue, 7 Feb 2023 16:20:46 +0000 (16:20 +0000)]
[AArch64] Fix LSE2/LSE128/RCPC3 precedence

D142712 added tests for when both lse2 and lse128 are available, but
in practice there is no way to enable LSE128 without LSE2 from clang:
LSE128 is a v9 only feature and LSE2 has been mandatory since v8.4,
and +/-lse2 can not be specified on the clang command line.

Therefore it makes more sense that lse2+lse128 should emit lse128
instructions, otherwise they will not be emitted at all.

It also makes sense to remove the lse128-only backend tests if that set
of attributes is never set by the frontend.

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

20 months ago[libc++] Granularize <type_traits> includes in <algorithm>
Nikolas Klauser [Mon, 26 Dec 2022 15:24:01 +0000 (16:24 +0100)]
[libc++] Granularize <type_traits> includes in <algorithm>

Reviewed By: Mordante, #libc

Spies: libcxx-commits, wenlei

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

20 months agoReapply "[AMDGPU] Modify adjustInliningThreshold to also consider the cost of passing...
Janek van Oirschot [Fri, 10 Feb 2023 17:03:30 +0000 (17:03 +0000)]
Reapply "[AMDGPU] Modify adjustInliningThreshold to also consider the cost of passing function arguments through the stack"

Reapplies 142c28ffa1323e9a8d53200a22c80d5d778e0d0f as part of D140242 which got reverted due to amdgpu openmp test failures.

This diff fixes said failures by eliding most of `adjustInliningThresholdUsingCallee` for indirect calls as the callee function is unavailable for indirect calls.

Reviewed By: arsenm, #amdgpu

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

20 months ago[mlir][MemRef][TransformOps] Fix error reporting for multibuffer
Quentin Colombet [Fri, 10 Feb 2023 12:43:33 +0000 (13:43 +0100)]
[mlir][MemRef][TransformOps] Fix error reporting for multibuffer

Multibuffer will fail to apply on allocs that are used outside of loops.
This was properly caught in the current implementation but the way we report
it was broken.
Notes cannot be emitted on their own, they need to be attached to another
main diagnostic.

Long story short, change the severity of the report from Note to Error.

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

20 months ago[DWARFLinker] Refactor cloneAddressAttribute().
Alexey Lapshin [Thu, 2 Feb 2023 16:17:52 +0000 (17:17 +0100)]
[DWARFLinker] Refactor cloneAddressAttribute().

As a preparation for implementing DWARFv5 address ranges generation,
this patch refactors cloneAddressAttribute() method. It has special
handling for addresses which can be relocated in some unrelated value,
for applying relocations twice, for indexed addresses. Instead of
all these special handlings this patch uses general handling:

Read attribute value from InputDIE and apply PCOffset.

Another thing is that current handling of DW_FORM_addrx misses the
fact that relocations might be applied twice in some cases. This
patch fixes this problem also.

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

20 months ago[libc] Fix LIBC_LOOP_NOUNROLL being a noop
Guillaume Chatelet [Mon, 13 Feb 2023 11:14:13 +0000 (11:14 +0000)]
[libc] Fix LIBC_LOOP_NOUNROLL being a noop

20 months ago[Coroutines] Modify CoroFrame materializable into a callback
David Stuttard [Thu, 19 Jan 2023 13:55:49 +0000 (13:55 +0000)]
[Coroutines] Modify CoroFrame materializable into a callback

This change makes it possible to optionally provide a different callback to
determine if an instruction is materializable.

By default the behaviour is unchanged.

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

20 months ago[Coroutines] Improve rematerialization stage
David Stuttard [Mon, 23 Jan 2023 12:52:44 +0000 (12:52 +0000)]
[Coroutines] Improve rematerialization stage

As originally implemented, the rematerialization of valid instructions across
the suspend point would iterate 4 times, meaning that up to 4 instructions could
be rematerialized.

This implementation changes that approach to instead build a graph of
rematerializable instructions, then move all of them. This is faster than the
original approach and is not limited to an arbitrary limit.

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

20 months ago[Coroutines] Presubmit test for more coro remats
David Stuttard [Thu, 12 Jan 2023 11:08:12 +0000 (11:08 +0000)]
[Coroutines] Presubmit test for more coro remats

Added more tests that check for >4 instructions.
Also added a retcon-remat test that checks rematerialization into a suspend
block predecessor (such as when remat for a retcon suspend happens).

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

20 months ago[ARM] O3-pipeline fix
Samuel Parker [Mon, 13 Feb 2023 11:00:54 +0000 (11:00 +0000)]
[ARM] O3-pipeline fix

20 months ago[flang] RFC: -fstack-arrays
Tom Eccles [Wed, 7 Dec 2022 17:52:31 +0000 (17:52 +0000)]
[flang] RFC: -fstack-arrays

An RFC describing how -fstack-arrays will be implemented.

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

20 months ago[flang][hlfir] lower hlfir.sum into fir runtime call
Tom Eccles [Fri, 27 Jan 2023 18:01:44 +0000 (18:01 +0000)]
[flang][hlfir] lower hlfir.sum into fir runtime call

This duplicates some argument lowering and return value processing from
flang/lib/Lower/ConvertCall.cpp. The existing code in CovertCall lowers
directly into the fir.call (without the hlfir transformational intrinsic
operation), and it is too tied to the lowering code to move into
flang/lib/Optimizer to allow for more complete re-use here.

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

20 months ago[flang] lower sum intrinsic to hlfir.sum operation
Tom Eccles [Mon, 23 Jan 2023 09:52:31 +0000 (09:52 +0000)]
[flang] lower sum intrinsic to hlfir.sum operation

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

20 months ago[flang] add hlfir.sum operation
Tom Eccles [Tue, 17 Jan 2023 17:37:15 +0000 (17:37 +0000)]
[flang] add hlfir.sum operation

Add an HLFIR operation for the SUM transformational intrinsic, according
to the design set out in flang/doc/HighLevelFIR.md.

I decided to make hlfir.sum very lenient about the form of its
arguments. This allows the sum intrinsic to be lowered to only this HLFIR
operation, without needing several operations to convert and box
arguments. Having only one operation generated for the intrinsic
invocation should make optimisation passes on HLFIR simpler.

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

20 months ago[mlir][SCFToOpenMP] Add pass option to emit LLVM opaque pointers
Markus Böck [Sun, 12 Feb 2023 20:34:21 +0000 (21:34 +0100)]
[mlir][SCFToOpenMP] Add pass option to emit LLVM opaque pointers

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

There were luckily only very few changes that had to be made. To allow users to also specify the pass option from C++ code I have also migrated the pass to use autogenerated constructors to autogenerate a pass option struct.

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

20 months ago[mlir][Vector] add pass option to `convert-vector-to-llvm` to emit opaque pointers
Markus Böck [Sun, 12 Feb 2023 20:05:53 +0000 (21:05 +0100)]
[mlir][Vector] add pass option to `convert-vector-to-llvm` to emit opaque pointers

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

This patch allows the use of `convert-vector-to-llvm` with LLVM opaque pointer types. The changes required were relatively minor:
* there were a few GEPs and loads that required specifying the result or base type
* a few bitcasts, especially when interacting with memref have to not be emitted when using opaque pointers

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

20 months ago[flang] use mlir::LoopLikeOpInterface::blockIsInLoop
Tom Eccles [Thu, 9 Feb 2023 15:25:40 +0000 (15:25 +0000)]
[flang] use mlir::LoopLikeOpInterface::blockIsInLoop

The inlined version of this function can now go away because
https://reviews.llvm.org/D141401 has been merged.

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

20 months ago[LLDB] Apply FixCodeAddress to all forms of address arguments
David Spickett [Fri, 28 Oct 2022 09:52:06 +0000 (10:52 +0100)]
[LLDB] Apply FixCodeAddress to all forms of address arguments

This is a follow up to https://reviews.llvm.org/D141629
and applies the change it made to all paths through ToAddress
(now DoToAddress).

I have included the test from my previous attempt
https://reviews.llvm.org/D136938.

The initial change only applied fixing to addresses that
would parse as integers, so my test case failed. Since
ToAddress has multiple exit points, I've wrapped it into
a new method DoToAddress.

Now you can call ToAddress, it will call DoToAddress and
no matter what path you take, the address will be fixed.

For the memory tagging commands we actually want the full
address (to work out mismatches). So I added ToRawAddress
for that.

I have tested this on a QEMU AArch64 Linux system with
Memory Tagging, Pointer Authentication and Top Byte Ignore
enabled. By running the new test and all other tests in
API/linux/aarch64.

Some commands have had calls to the ABI plugin removed
as ToAddress now does this for them.

The "memory region" command still needs to use the ABI plugin
to detect the end of memory when there are non-address bits.

Reviewed By: jasonmolenda

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

20 months agoAdjust #pragma warning so GCC is not unhappy
Roger Ferrer Ibanez [Mon, 13 Feb 2023 09:51:48 +0000 (09:51 +0000)]
Adjust #pragma warning so GCC is not unhappy

In d768bf994f508d7eaf9541a568be3d71096febf5 a warning to help
transitioning was added to llvm/Support/Host.h but it includes extra
parentheses which make GCC unhappy (clang seems to accept them fine).

This change removes the parentheses around the string literal.

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

20 months ago[mlir][LinAlgTransformOps][NFC] Use emitSilenceableError
Quentin Colombet [Mon, 13 Feb 2023 09:18:19 +0000 (10:18 +0100)]
[mlir][LinAlgTransformOps][NFC] Use emitSilenceableError

Update the error reporting to the easier to use "emitSilenceableError"

NFC

20 months ago[HardwareLoops] NewPM support.
Samuel Parker [Mon, 13 Feb 2023 09:12:12 +0000 (09:12 +0000)]
[HardwareLoops] NewPM support.

With the NPM, we're now defaulting to preserving LCSSA, so a couple
of tests have changed slightly.

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

20 months agoAdd build for Windows on Arm in packaging script
Pierrick Bouvier [Mon, 13 Feb 2023 09:36:04 +0000 (14:36 +0500)]
Add build for Windows on Arm in packaging script

Reviewed By: hans

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

20 months ago[llvm][TableGen][Jupyter] Show llvm-tblgen not found error in notebook
David Spickett [Wed, 25 Jan 2023 11:25:03 +0000 (11:25 +0000)]
[llvm][TableGen][Jupyter] Show llvm-tblgen not found error in notebook

Previously this message was only shown on the command line,
which is not much help if you can't see that.
(you've full screened the browser or you aren't running Jupyter
on the same machine)

Instead return the error as stderr which will get printed in
the notebook just like stderr from llvm-tblgen would.

I've refactored the message sending along the way. Note that
even when we do not send a stream, we still need to send the
status reply. The send_... methods will do that for you.

Reviewed By: jpienaar

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

20 months ago[NFC] Set C++20 Named Modules for CodeGen in ASTContext in the early place
Chuanqi Xu [Mon, 13 Feb 2023 09:12:20 +0000 (17:12 +0800)]
[NFC] Set C++20 Named Modules for CodeGen in ASTContext in the early place

Previously we'll set the named modules for ASTContext in ParseAST. But
this is not intuitive and we need comments to tell the intuition. This
patch moves the code the right the place, where the corrresponding
module is first created/loaded. Now it is more intuitive and we can use
the value in the earlier places.

20 months ago[clangd] Drop includes from disabled PP regions in preamble patch
Kadir Cetinkaya [Wed, 8 Feb 2023 18:53:55 +0000 (19:53 +0100)]
[clangd] Drop includes from disabled PP regions in preamble patch

In rest of the clangd functionality we treat these includes as
non-existent. Do so under preamble patching.

Depends on D143197

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

20 months ago[clangd] Fix bugs in main-file include patching for stale preambles
Kadir Cetinkaya [Thu, 2 Feb 2023 13:15:56 +0000 (14:15 +0100)]
[clangd] Fix bugs in main-file include patching for stale preambles

- Make sure main file includes are present even when they're not patched
  (because they didn't change or we're explicitly not patching them).
- Populate extra fields for includes, which can be used by include-cleaner.

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

20 months ago[Test][SCEV] Add a test where the trip count can't be calculated
Maksim Kazantsev mkazantsev@azul.com [Mon, 13 Feb 2023 08:27:38 +0000 (08:27 +0000)]
[Test][SCEV] Add a test where the trip count can't be calculated

Add a test in which the trip count could have been calculated
correctly thanks to an assume since it is known to divide by the
step of the IV.

Patch by Alon Kom!

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

20 months ago[milr][llvm] Add remaining loop metadata support
Christian Ulmann [Mon, 13 Feb 2023 08:08:58 +0000 (09:08 +0100)]
[milr][llvm] Add remaining loop metadata support

This commit adds support for the last two loop metadata nodes produced
anywhere in the llvm-project.

Reviewed By: gysit

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

20 months agoRevert "[CMake] Remove custom ccache CMake logic"
Tobias Hieta [Mon, 13 Feb 2023 07:56:56 +0000 (08:56 +0100)]
Revert "[CMake] Remove custom ccache CMake logic"

This reverts commit 0fad18c44a14b909a1aa47165021273d4c10a665.

We need bots to be updated first.

20 months ago[mlir][llvm] Improve LoadOp and StoreOp import.
Tobias Gysi [Mon, 13 Feb 2023 07:12:09 +0000 (08:12 +0100)]
[mlir][llvm] Improve LoadOp and StoreOp import.

The revision supports importing the volatile keyword and nontemporal
metadata for the LoadOp and StoreOp. Additionally, it updates the
builders and uses an assembly format for printing and parsing.

The operation type still requires custom parse and print methods
due to the current handling of typed and opaque pointers.

Reviewed By: Dinistro

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

20 months ago[CMake] Remove custom ccache CMake logic
Tobias Hieta [Mon, 13 Feb 2023 07:42:04 +0000 (08:42 +0100)]
[CMake] Remove custom ccache CMake logic

CMake supports CMAKE_CXX_COMPILER_LAUNCHER since CMake 3.4
so this custom CMake logic we had in LLVM can now be removed.

The only downside with this is that we can't set ccache
options from LLVM CMake, but it's arguable that this doesn't
belong in LLVM but should be done in a script calling the
build.

This was discussed in the forums here:

https://discourse.llvm.org/t/tips-for-incremental-building/67289/4?u=tobiashieta

Reviewed By: phosek

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

20 months ago[gn build] Port b7b28c6cfe04
LLVM GN Syncbot [Mon, 13 Feb 2023 06:06:30 +0000 (06:06 +0000)]
[gn build] Port b7b28c6cfe04

20 months ago[clang-tidy][libc] Add an inline function checker for the libc project.
Siva Chandra Reddy [Thu, 26 Jan 2023 01:21:12 +0000 (01:21 +0000)]
[clang-tidy][libc] Add an inline function checker for the libc project.

The new checker checks if inline functions defined in header files are
tagged with the LIBC_INLINE macro. See https://libc.llvm.org/code_style.html
for more information about this macro.

Reviewed By: carlosgalvezp

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

20 months ago[AMDGPU] Use llvm::bit_cast (NFC)
Kazu Hirata [Mon, 13 Feb 2023 05:59:14 +0000 (21:59 -0800)]
[AMDGPU] Use llvm::bit_cast (NFC)

AFAICT, this is the only place where we pass a 64-bit value into
BitsToFloat.

20 months ago[llvm-debuginfo-analyzer] LLVM 16.0.0-rc1 Failing test on osx-64.
Carlos Alberto Enciso [Mon, 13 Feb 2023 05:25:17 +0000 (05:25 +0000)]
[llvm-debuginfo-analyzer] LLVM 16.0.0-rc1 Failing test on osx-64.

As describe in

https://github.com/llvm/llvm-project/issues/60363

the following DebugInfo LogicalView Tests unit tests failed:

- ELFReader
- SelectElements

The tests fail only on the OSX-64 platform with the CMake options:

-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON

Using the same options on a Linux platform all the tests pass:
- https://lab.llvm.org/buildbot/#/builders/196
- llvm-x86_64-debian-dylib

Basically it is a dynamic library initialization affecting a static
instance for the string pool (LVStringPool).

That string pool instance is accessed by all the logical elements
to store/retrieve any associated string during the creation of the
logical view.

For a logical view comparison, both logical readers (Reference and
Target) use retrieved indexes when comparing their strings.

Moved the static instance to LVSupport module (unnamed namespace).

Reviewed By: jmorse

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

20 months ago[llvm] Deprecate PowerOf2Floor and ByteSwap_{16,32,64}
Kazu Hirata [Mon, 13 Feb 2023 05:42:07 +0000 (21:42 -0800)]
[llvm] Deprecate PowerOf2Floor and ByteSwap_{16,32,64}

llvm/include/llvm/ADT/bit.h now has equivalent functions
forward-ported from C++20.

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

20 months ago[x86] Move combineAddOrSubToADCOrSBB within the source file (NFC)
Kazu Hirata [Mon, 13 Feb 2023 03:48:35 +0000 (19:48 -0800)]
[x86] Move combineAddOrSubToADCOrSBB within the source file (NFC)

D143838 needs to use combineAddOrSubToADCOrSBB just above combineOr.
This patch simply moves up combineAddOrSubToADCOrSBB within the source
file to avoid forward-declaring the functions.

20 months ago[X86] Precommit tests for D143838
Kazu Hirata [Mon, 13 Feb 2023 03:33:23 +0000 (19:33 -0800)]
[X86] Precommit tests for D143838

20 months agoRecommit [C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency...
Chuanqi Xu [Mon, 13 Feb 2023 03:12:08 +0000 (11:12 +0800)]
Recommit [C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency file within P1689 format (4/4)

Required in https://reviews.llvm.org/D137534.

The build systems needs the information to know that "header X changed,
scanning may have changed, so please rerun scanning". Although it is
possible to get the information by running clang-scan-deps for the
second time with make format, it is not user friendly clearly.

Reviewed By: jansvoboda11

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

20 months agoRecommit [C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified...
Chuanqi Xu [Mon, 13 Feb 2023 03:01:24 +0000 (11:01 +0800)]
Recommit [C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified compilation database in P1689 (3/4)

In a private chat with @ben.boeckel , we get in consensus it would be
great for cmake if the invocation of clang-scan-deps can get rid of
compilation database. Due to the compilation database can't do very well
for the files which are not existed yet. @ben.boeckel may have more
context to add here.

This patch should be innocent for others usages.

Reviewed By: jansvoboda11

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

20 months agoRecommit [C++20] [Modules] [ClangScanDeps] Add ClangScanDeps support for C++20 Named...
Chuanqi Xu [Fri, 10 Feb 2023 02:26:35 +0000 (10:26 +0800)]
Recommit [C++20] [Modules] [ClangScanDeps] Add ClangScanDeps support for C++20 Named Modules in P1689 format (2/4)

Close https://github.com/llvm/llvm-project/issues/51792
Close https://github.com/llvm/llvm-project/issues/56770

This patch adds ClangScanDeps support for C++20 Named Modules in P1689
format. We can find the P1689 format at:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1689r5.html.
After we land the patch, we're able to compile C++20 Named
Modules with CMake! And although P1689 is written by kitware people,
other build systems should be able to use the format to compile C++20
Named Modules too.

TODO: Support header units in P1689 Format.
TODO2: Support C++20 Modules in the full dependency format of
ClangScanDeps. We also want to support C++20 Modules and clang modules
together according to
https://discourse.llvm.org/t/how-should-we-support-dependency-scanner-for-c-20-modules/66027.
But P1689 format cares about C++20 Modules only for now. So let's focus
on C++ Modules and P1689 format. And look at the full dependency format
later.

I'll add the ReleaseNotes and Documentations after the patch get landed.

Reviewed By: jansvoboda11

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

20 months ago[flang] Handle forward references to modules
Peter Klausler [Sun, 5 Feb 2023 01:55:45 +0000 (17:55 -0800)]
[flang] Handle forward references to modules

When a USE of a module precedes its definition in the same source
file, ensure that the module is processed by name resolution before
the USE statement.  This prevents the risk of the USE statement using
an obsolete module file that is later overwritten during the same
compilation.

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

20 months ago[X86][FP16] Add tests to show suboptimal codegen, NFC
Phoebe Wang [Sun, 12 Feb 2023 14:55:27 +0000 (22:55 +0800)]
[X86][FP16] Add tests to show suboptimal codegen, NFC

20 months ago[flang] Warn on overflow folding DIM()
Peter Klausler [Sat, 4 Feb 2023 01:19:55 +0000 (17:19 -0800)]
[flang] Warn on overflow folding DIM()

The intrinsic function DIM can overflow when its second argument
is negative.  Detect this case for real and integer arguments and
emit a warning when necessary.

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

20 months ago[flang] Catch misuse of a procedure designator as an output item
Peter Klausler [Fri, 3 Feb 2023 00:50:09 +0000 (16:50 -0800)]
[flang] Catch misuse of a procedure designator as an output item

f18 was diagnosing the misuse of a procedure pointer as an output item,
but not the more general case of a procedure designator other than
a pointer.

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

20 months ago[gn build] Port 2a06757a200c
LLVM GN Syncbot [Sun, 12 Feb 2023 22:51:56 +0000 (22:51 +0000)]
[gn build] Port 2a06757a200c

20 months ago[libc++][spaceship] Implement `lexicographical_compare_three_way`
Adrian Vogelsgesang [Thu, 4 Aug 2022 22:21:27 +0000 (15:21 -0700)]
[libc++][spaceship] Implement `lexicographical_compare_three_way`

The implementation makes use of the freedom added by LWG 3410. We have
two variants of this algorithm:
* a fast path for random access iterators: This fast path computes the
  maximum number of loop iterations up-front and does not compare the
  iterators against their limits on every loop iteration.
* A basic implementation for all other iterators: This implementation
  compares the iterators against their limits in every loop iteration.
  However, it still takes advantage of the freedom added by LWG 3410 to
  avoid unnecessary additional iterator comparisons, as originally
  specified by P1614R2.

https://godbolt.org/z/7xbMEen5e shows the benefit of the fast path:
The hot loop generated of `lexicographical_compare_three_way3` is
more tight than for `lexicographical_compare_three_way1`. The added
benchmark illustrates how this leads to a 30% - 50% performance
improvement on integer vectors.

Implements part of P1614R2 "The Mothership has Landed"

Fixes LWG 3410 and LWG 3350

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

20 months ago[LV] Update recipe builder functions to pass VPlan directly (NFC).
Florian Hahn [Sun, 12 Feb 2023 22:35:14 +0000 (22:35 +0000)]
[LV] Update recipe builder functions to pass VPlan directly (NFC).

Passing VPlanPtr requires a dereference of std::unique_ptr on each
access, which is unnecessary. Just pass the plan by reference.