platform/upstream/llvm.git
22 months ago[OpenMP][AMDGPU] Refactor setting uniform work group size attribute
Dominik Adamski [Fri, 14 Apr 2023 19:04:35 +0000 (14:04 -0500)]
[OpenMP][AMDGPU] Refactor setting uniform work group size attribute

Work group size attribute was set in Clang specific class. That's why
we cannot reuse this code in Flang.

If we move setting of this attribute to OpenMPIRBuilder, then we can reuse this
code in Flang and Clang. Function createOffloadEntry from OpenMPIRBuilder is
already used by Clang (via OpenMPIRBuilder::createOffloadEntriesAndInfoMetadata
function).

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

Reviewed By: jdoerfert

22 months agoRevert "Fix handling of special and large vals in expand pattern for `round`" and...
Mehdi Amini [Fri, 21 Apr 2023 06:13:55 +0000 (00:13 -0600)]
Revert "Fix handling of special and large vals in expand pattern for `round`" and "Add pattern that expands `math.roundeven` into `math.round` + arith"

This reverts commit 8d2bae9abdc30e104bab00a4dd0f9d39f5bdda6e and
commit ab2fc9521ec606603412645d4a4b3cf456acd153.

Tests are broken on Mac M2

22 months ago[BreakFalseDeps] Respect dead blocks.
Serguei Katkov [Fri, 14 Apr 2023 07:05:03 +0000 (14:05 +0700)]
[BreakFalseDeps] Respect dead blocks.

The pass uses ReachingDefAnalysis which has no information about
instructions in dead blocks.
So do not process them.

Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D148329

22 months ago[RuntimeDyld] Disable some ppc64 tests on 32-bit architectures.
Lang Hames [Fri, 21 Apr 2023 04:47:49 +0000 (21:47 -0700)]
[RuntimeDyld] Disable some ppc64 tests on 32-bit architectures.

These tests have been failing on 32-bit machines.

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

22 months ago[ORC-RT] Fix typo in include-guard comment.
Lang Hames [Fri, 21 Apr 2023 01:50:02 +0000 (18:50 -0700)]
[ORC-RT] Fix typo in include-guard comment.

22 months agoFix uninitialized scalar members in CodeGen
Akshay Khadse [Fri, 21 Apr 2023 04:22:28 +0000 (12:22 +0800)]
Fix uninitialized scalar members in CodeGen

This change fixes some static code analysis warnings.

Reviewed By: LuoYuanke

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

22 months ago[Attributor] Set up a dedicated simplification call back map for `GlobalVariable`
Shilei Tian [Fri, 21 Apr 2023 04:08:24 +0000 (00:08 -0400)]
[Attributor] Set up a dedicated simplification call back map for `GlobalVariable`

Currently we don't check call backs for global variable simplification.
What's more, the only way that we can register a simplification call back for
global variable is through its initializer (essentially a `Constant *`). It might
not correspond to the right global variable. In this patch, we set up a dedicated
simplification map for `GlobalVariable`.

Reviewed By: jdoerfert

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

22 months ago[lldb] Fix -Wctad-maybe-unsupported in PathMappingList.cpp (NFC)
Jie Fu [Fri, 21 Apr 2023 03:59:38 +0000 (11:59 +0800)]
[lldb] Fix -Wctad-maybe-unsupported in PathMappingList.cpp (NFC)

/home/jiefu/llvm-project/lldb/source/Target/PathMappingList.cpp:51:5: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
    std::scoped_lock locks(m_mutex, rhs.m_mutex);
    ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/mutex:692:11: note: add a deduction guide to suppress this warning
    class scoped_lock
          ^
/home/jiefu/llvm-project/lldb/source/Target/PathMappingList.cpp:72:3: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
  std::scoped_lock locks(m_mutex, rhs.m_mutex);
  ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/mutex:692:11: note: add a deduction guide to suppress this warning
    class scoped_lock
          ^
2 errors generated.

22 months ago[Coverity] Fix uninitialized scalar members
Akshay Khadse [Fri, 21 Apr 2023 03:41:42 +0000 (11:41 +0800)]
[Coverity] Fix uninitialized scalar members

This change fixes static code analysis errors

Reviewed By: LuoYuanke

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

22 months ago[gn build] Port c847b8e24cfd
LLVM GN Syncbot [Fri, 21 Apr 2023 03:37:17 +0000 (03:37 +0000)]
[gn build] Port c847b8e24cfd

22 months ago[libc++] Make bsd_locale_fallbacks.h modular and move it into __locale/locale_base_api/
Nikolas Klauser [Sat, 4 Mar 2023 01:37:37 +0000 (02:37 +0100)]
[libc++] Make bsd_locale_fallbacks.h modular and move it into __locale/locale_base_api/

This is a first step towards granularizing `<locale>`.

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits, mikhail.ramalho

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

22 months ago[libc] Another fix to add a null-terminator to the pthread name.
Siva Chandra Reddy [Fri, 21 Apr 2023 03:29:36 +0000 (03:29 +0000)]
[libc] Another fix to add a null-terminator to the pthread name.

This fix is similar to the one done in https://reviews.llvm.org/D148844.
This miss was caught by the risv64 builder.

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

22 months ago[libc++][PSTL] Remove current integration
Nikolas Klauser [Sun, 16 Apr 2023 20:31:25 +0000 (22:31 +0200)]
[libc++][PSTL] Remove current integration

We decided to go a different route. To make the switch easier, rip out the old integration first and build on a clean base.

Reviewed By: ldionne, #libc, #libc_abi

Spies: arichardson, libcxx-commits

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

22 months ago[dataflow] allow specifying path to dot with $GRAPHVIZ_DOT
Sam McCall [Fri, 21 Apr 2023 03:23:46 +0000 (05:23 +0200)]
[dataflow] allow specifying path to dot with $GRAPHVIZ_DOT

I'd like to use this in a CI system where it's easier to tell the
program about paths than manipulate $PATH.

22 months ago[doc] [C++20] [Modules] Document that the interfaces of header units is experimental
Chuanqi Xu [Fri, 21 Apr 2023 02:39:15 +0000 (10:39 +0800)]
[doc] [C++20] [Modules] Document that the interfaces of header units is experimental

Close https://github.com/llvm/llvm-project/issues/62241

In tooling group (SG15), it is still unclear how tools should support
header units. Add a warning in the documentation to avoid further
confusions.

22 months ago[Vector][NFC] Fix DEBUG_TYPE in LowerVectorTranspose.cpp
Diego Caballero [Fri, 21 Apr 2023 01:16:22 +0000 (01:16 +0000)]
[Vector][NFC] Fix DEBUG_TYPE in LowerVectorTranspose.cpp

Fix wrong debug type.

Reviewed By: hanchung

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

22 months ago[nfc][thinlto] Separate `selectCallee` legality from cutoffs
Mircea Trofin [Wed, 19 Apr 2023 23:39:03 +0000 (16:39 -0700)]
[nfc][thinlto] Separate `selectCallee` legality from cutoffs

This makes it easier to reuse the legality part for other import
policies that wouldn't use thresholds.

Importing un-inlinable functions is also legal, because they could be
further specialized in a context-specific way, without inlining.

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

22 months ago[Demangle] fix another test on windows
Nick Desaulniers [Fri, 21 Apr 2023 00:23:22 +0000 (17:23 -0700)]
[Demangle] fix another test on windows

Alan spotted another test failure that was a result of
https://reviews.llvm.org/D148546 when running expensive checks tests
locally on windows.

Reviewed By: ayzhao

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

22 months ago[CMake] Add llvm-lib to Clang bootstrap dependency for LTO builds on Windows
Igor Kudrin [Fri, 21 Apr 2023 00:02:17 +0000 (17:02 -0700)]
[CMake] Add llvm-lib to Clang bootstrap dependency for LTO builds on Windows

Without this dependency, it is possible that llvm-lib.exe will not be
built, in which case CMake will try to use lib.exe to build libraries,
but this tool cannot handle bitcode files.

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

22 months ago[Demangle] fix windows tests
Nick Desaulniers [Thu, 20 Apr 2023 22:59:10 +0000 (15:59 -0700)]
[Demangle] fix windows tests

My reland of https://reviews.llvm.org/D148546 has caused a few windows
demangler tests to fail when run with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON
on windows.

I have a sneaking suspicion that MSVC's
std::string_view::iterator::operator* may be missing a nullptr check.

Link: https://lab.llvm.org/buildbot/#/builders/42/builds/9723/steps/7/logs/stdio
Reviewed By: ayzhao

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

22 months ago[libc] Added checks to src and dest types in bit_cast
Mikhail R. Gadelha [Thu, 20 Apr 2023 23:30:23 +0000 (20:30 -0300)]
[libc] Added checks to src and dest types in bit_cast

This patch adds assertions to prevent the compilation when we try to
bit cast a type that is not trivially copyable when using
__builtin_bit_cast, or when we try to bit cast a type that is not
trivially copyable and trivially constructable when using memcpy.

Reviewed By: sivachandra

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

22 months ago[libc] Set minimum CUDA PTX feature to +ptx60
Joseph Huber [Thu, 20 Apr 2023 22:59:21 +0000 (17:59 -0500)]
[libc] Set minimum CUDA PTX feature to +ptx60

Summary:
The `+ptx` features correspond to the related CUDA version. We require a
certain set of features from the `ptxas` assembler, which is tied to the
CUDA version. Some of the ones set here were insufficient, so I am
simply setting a cutoff to the CUDA 9.0 release as the minimum. This
roughly corresponds to what should be required for sm_60 to be compiled
with the source.

22 months agoFix i1 vector reduction miscompilation
Sp00ph [Thu, 20 Apr 2023 22:26:49 +0000 (15:26 -0700)]
Fix i1 vector reduction miscompilation

Previously, `vecreduce_{and,or} vNi1` could lead to miscompilations because the legalizer first decides to `any_ext` the operand (which is correct for `vecreduce_{and,or}`) and then decides to use `vecreduce_u{min,max}` instead (for which `any_ext` is incorrect). This patch changes it so the `vecreduce_u{min,max}` operations use `sign_ext` instead of `any_ext`.

Issue: https://github.com/llvm/llvm-project/issues/62211

Reviewed By: craig.topper

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

22 months ago[mlir][openacc] Restrict types for acc.bounds operands to index or integer type
Valentin Clement [Thu, 20 Apr 2023 21:42:56 +0000 (14:42 -0700)]
[mlir][openacc] Restrict types for acc.bounds operands to index or integer type

Values in bounds are expected to have integer or index types. Enforce
this expectation by restricting the type to be IntOrIndex.

Reviewed By: razvanlupusoru

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

22 months ago[libc] Add null-terminator to the thread name obtained from the syscall.
Siva Chandra Reddy [Thu, 20 Apr 2023 21:30:36 +0000 (21:30 +0000)]
[libc] Add null-terminator to the thread name obtained from the syscall.

This bug was caught by the aarch64 full build builder.

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

22 months ago[lld-macho] Tweak the names we give to archive members
Jez Ng [Thu, 20 Apr 2023 21:23:36 +0000 (17:23 -0400)]
[lld-macho] Tweak the names we give to archive members

In particular, make it `foo.a(foo.o)$ARCHIVE_OFFSET`. The goal is to
make it more similar to both ld64 implementation, which uses the
`foo.a(foo.o)$MODULE_ID` format. We dump some of these names in LTO
code, so matching ld64's format is helpful. This format is also more
similar to LLD-ELF's, which is `foo.a(foo.o at $ARCHIVE_OFFSET)`.

Reviewed By: #lld-macho, oontvoo

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

22 months ago[mlir][sparse] fix crash when generating coiteration loop with compressed-hi DLT.
Peiming Liu [Thu, 20 Apr 2023 21:12:12 +0000 (21:12 +0000)]
[mlir][sparse] fix crash when generating coiteration loop with compressed-hi DLT.

Reviewed By: aartbik

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

22 months ago[RISCV][WIP] Use vsetvli x0, x0 in more cases.
Craig Topper [Thu, 20 Apr 2023 20:58:24 +0000 (13:58 -0700)]
[RISCV][WIP] Use vsetvli x0, x0 in more cases.

If the AVL is a virtual register defined by a vsetvli with the same
vlmax we need and the previous vsetvli we saw in the data flow also
has that vlmax, we can use the x0, x0 form when we insert a vsetvli.

Not only does this avoid an update of the VL physical register, but
it may allow doLocalPostpass to completely remove the inserted vsetvli
by rewriting the vtype of the previous vsetvli.

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

22 months ago[RISCV] Pre-commit test case for D148735. NFC
Craig Topper [Thu, 20 Apr 2023 20:58:19 +0000 (13:58 -0700)]
[RISCV] Pre-commit test case for D148735. NFC

22 months ago[flang] Relax two !DIR$ IGNORE_TKR error cases with descriptor arguments
Peter Klausler [Thu, 20 Apr 2023 19:07:09 +0000 (12:07 -0700)]
[flang] Relax two !DIR$ IGNORE_TKR error cases with descriptor arguments

Allow two currently erroneous cases of !DIR$ IGNORE_TKR errors: allocatable
and pointers, and IGNORE_TKR(R) on (other) arguments passed via descriptors.
Downgrade these cases to warnings when they appear in external interfaces,
since their implementations may well be in C.  But retain the error status
on these cases for module procedures, since the Fortran implementation
probably can't work.

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

22 months ago[mlir] Prevent implicit downcasting to interfaces
Rahul Kayaith [Sun, 16 Apr 2023 21:28:48 +0000 (17:28 -0400)]
[mlir] Prevent implicit downcasting to interfaces

Currently conversions to interfaces may happen implicitly (e.g.
`Attribute -> TypedAttr`), failing a runtime assert if the interface
isn't actually implemented. This change marks the `Interface(ValueT)`
constructor as explicit so that a cast is required.

Where it was straightforward to I adjusted code to not require casts,
otherwise I just made them explicit.

Depends on D148491D148492

Reviewed By: rriddle

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

22 months ago[mlir] Make ElementsAttr inherit from TypedAttr
Rahul Kayaith [Sun, 16 Apr 2023 19:47:44 +0000 (15:47 -0400)]
[mlir] Make ElementsAttr inherit from TypedAttr

This allows implicit conversion from `ElementsAttr` to `TypedAttr`, but
required renaming the `ElementsAttr::getType()` interface method to
`getShapedType`.

Reviewed By: rriddle

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

22 months ago[mlir][arith] Add arith.constant materialization helper
Rahul Kayaith [Sun, 16 Apr 2023 21:26:03 +0000 (17:26 -0400)]
[mlir][arith] Add arith.constant materialization helper

This adds `arith::ConstantOp::materialize`, which builds a constant from
an attribute and type only if it would result in a valid op. This is
useful for dialect `materializeConstant` hooks, and allows for removing
the previous `Attribute, Type` builder which was only used during
materialization.

Reviewed By: rriddle

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

22 months ago[SLP][NFC]Add a test with an extra cost of the reused extractelement
Alexey Bataev [Thu, 20 Apr 2023 20:27:18 +0000 (13:27 -0700)]
[SLP][NFC]Add a test with an extra cost of the reused extractelement
instruction, NFC.

22 months agouse heap memory for position buffer allocated for PackOp.
Peiming Liu [Thu, 20 Apr 2023 17:42:19 +0000 (17:42 +0000)]
use heap memory for position buffer allocated for PackOp.

Reviewed By: aartbik

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

22 months agoAdd documentation for -Wwrite-strings
Aaron Ballman [Thu, 20 Apr 2023 20:11:42 +0000 (16:11 -0400)]
Add documentation for -Wwrite-strings

This is the first instance where we've really needed to add
documentation for a diagnostic group, but -Wwrite-strings really
deserves it.

This warning option changes the semantic behavior of code, so enabling
it can cause code to break (and disabling it can too). That's worth
calling out loudly in our documentation.

22 months ago[libc] Actually run integration tests.
Siva Chandra Reddy [Thu, 20 Apr 2023 07:47:31 +0000 (07:47 +0000)]
[libc] Actually run integration tests.

After the switch to `add_custom_target` to run integration tests, most
of them were not actually being run because of the difference in the way
the COMMAND value is treated between `add_custom_target` and
`add_custom_command`. This patch gets the integration tests to run
again by passing the correct set of arguments to `add_custom_target`.

Reviewed By: michaelrj

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

22 months ago[libc] Support constexpr uint initialization
Michael Jones [Wed, 19 Apr 2023 23:51:33 +0000 (16:51 -0700)]
[libc] Support constexpr uint initialization

Uint addition and subtraction normally use builtins which aren't
constexpr. This patch adds an rvalue overload version of the addition
and subtraction operation that is always constexpr.

Reviewed By: sivachandra

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

22 months agoModify test to explicitely use the size of the mapped array.
Doru Bercea [Thu, 20 Apr 2023 18:55:58 +0000 (14:55 -0400)]
Modify test to explicitely use the size of the mapped array.

Review: https://reviews.llvm.org/D148832

22 months ago[LIBC] Implement remainder of posix 'sched.h' minus `SCHED_SPORADIC`
Noah Goldstein [Thu, 20 Apr 2023 19:51:10 +0000 (14:51 -0500)]
[LIBC] Implement remainder of posix 'sched.h' minus `SCHED_SPORADIC`

Includes macros:
    linux/SCHED_OTHER // posix req
    linux/SCHED_FIFO // posix req
    linux/SCHED_RR // posix req
    linux/SCHED_BATCH
    linux/SCHED_ISO
    linux/SCHED_IDLE
    linux/SCHED_DEADLINE

Includes types:
    struct sched_param { int sched_priority; }

Includes functions:
    sched_setparam
    sched_getparam
    sched_setscheduler
    sched_getscheduler
    sched_get_priority_max
    sched_get_priority_min
    sched_rr_get_interval

Reviewed By: michaelrj

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

22 months ago[LIBC] Fix incorrect handling of `pthread_join(tid, nullptr)`
Noah Goldstein [Thu, 20 Apr 2023 19:50:00 +0000 (14:50 -0500)]
[LIBC] Fix incorrect handling of `pthread_join(tid, nullptr)`

Previously unconditionally stored to the return value. This is
incorrect, we should only return if user value is non-null.

Reviewed By: sivachandra

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

22 months agoAdd pattern that expands `math.roundeven` into `math.round` + arith
Ramiro Leal-Cavazos [Thu, 20 Apr 2023 19:35:57 +0000 (12:35 -0700)]
Add pattern that expands `math.roundeven` into `math.round` + arith

This commit adds a pattern that expands `math.roundeven` into
`math.round` + some ops from `arith`. This is needed to be able to run
`math.roundeven` in a vectorized manner.

Reviewed By: jpienaar

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

22 months ago[dataflow] Try to fix missing order dependency in HTMLLogger
Sam McCall [Thu, 20 Apr 2023 19:37:36 +0000 (21:37 +0200)]
[dataflow] Try to fix missing order dependency in HTMLLogger

22 months ago[gn build] Port 68c3d66a97a0
LLVM GN Syncbot [Thu, 20 Apr 2023 19:24:12 +0000 (19:24 +0000)]
[gn build] Port 68c3d66a97a0

22 months ago[fuzzer][test] Disable big-file-copy.test for everything but macOS
Roy Sundahl [Wed, 19 Apr 2023 16:32:05 +0000 (09:32 -0700)]
[fuzzer][test] Disable big-file-copy.test for everything but macOS

This test is heavy on test resources and involves moving a large 2GB+ file
across an ssh connection when testing on remote devices. Exclude all tests
except for macOS testing (on host). Remote device testing for macOS may
eventually cause a problem on macOS as well w/o better handling of tests
that require more resource/time than we currently handle.
    Introduced by:
        https://reviews.llvm.org/D146189
    Subsequent exclusion of all but darwin by:
        https://reviews.llvm.org/D147094
    Subsequent exclusion of tvOS and watchOS by:
        https://reviews.llvm.org/D147502
    Subsequent exclusion of all but macOS...

rdar://107570309

Reviewed By: yln, thetruestblue

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

22 months ago[libc++][format] Improves width estimate.
Mark de Wever [Tue, 21 Feb 2023 16:33:56 +0000 (17:33 +0100)]
[libc++][format] Improves width estimate.

As obvious from the paper's title this is an LWG issue and thus retroactively
applied to C++20. This change may the output for certain code points:
1 Considers 8477 extra codepoints as having a width 2 (as of Unicode 15)
  (mostly Tangut Ideographs)
2 Change the width of 85 unassigned code points from 2 to 1
3 Change the width of 8 codepoints (in the range U+3248 CIRCLED NUMBER
  TEN ON BLACK SQUARE ... U+324F CIRCLED NUMBER EIGHTY ON BLACK
  SQUARE) from 2 to 1, because it seems questionable to make an exception
  for those without input from Unicode

Note that libc++ already uses Unicode 15, while the Standard requires Unicode 12.
(The last time I checked MSVC STL used Unicode 14.)

So in practice the only notable change is item 3.

Implements
  P2675 LWG3780: The Paper
  format's width estimation is too approximate and not forward compatible

Benchmark before these changes
--------------------------------------------------------------------
Benchmark                          Time             CPU   Iterations
--------------------------------------------------------------------
BM_ascii_text<char>             3928 ns         3928 ns       178131
BM_unicode_text<char>          75231 ns        75230 ns         9158
BM_cyrillic_text<char>         59837 ns        59834 ns        11529
BM_japanese_text<char>         39842 ns        39832 ns        17501
BM_emoji_text<char>             3931 ns         3930 ns       177750
BM_ascii_text<wchar_t>          4024 ns         4024 ns       174190
BM_unicode_text<wchar_t>       63756 ns        63751 ns        11136
BM_cyrillic_text<wchar_t>      44639 ns        44638 ns        15597
BM_japanese_text<wchar_t>      34425 ns        34424 ns        20283
BM_emoji_text<wchar_t>          3937 ns         3937 ns       177684

Benchmark after these changes
--------------------------------------------------------------------
Benchmark                          Time             CPU   Iterations
--------------------------------------------------------------------
BM_ascii_text<char>             3914 ns         3913 ns       178814
BM_unicode_text<char>          70380 ns        70378 ns         9694
BM_cyrillic_text<char>         51889 ns        51877 ns        13488
BM_japanese_text<char>         41707 ns        41705 ns        16723
BM_emoji_text<char>             3908 ns         3907 ns       177912
BM_ascii_text<wchar_t>          3949 ns         3948 ns       177525
BM_unicode_text<wchar_t>       64591 ns        64587 ns        10649
BM_cyrillic_text<wchar_t>      44089 ns        44078 ns        15721
BM_japanese_text<wchar_t>      39369 ns        39367 ns        17779
BM_emoji_text<wchar_t>          3936 ns         3934 ns       177821

Benchmarks without "if(__code_point < (__entries[0] >> 14))"
--------------------------------------------------------------------
Benchmark                          Time             CPU   Iterations
--------------------------------------------------------------------
BM_ascii_text<char>             3922 ns         3922 ns       178587
BM_unicode_text<char>          94474 ns        94474 ns         7351
BM_cyrillic_text<char>         69202 ns        69200 ns        10157
BM_japanese_text<char>         42735 ns        42692 ns        16382
BM_emoji_text<char>             3920 ns         3919 ns       178704
BM_ascii_text<wchar_t>          3951 ns         3950 ns       177224
BM_unicode_text<wchar_t>       81003 ns        80988 ns         8668
BM_cyrillic_text<wchar_t>      57020 ns        57018 ns        12048
BM_japanese_text<wchar_t>      39695 ns        39687 ns        17582
BM_emoji_text<wchar_t>          3977 ns         3976 ns       176479

This optimization does carry its weight for the Unicode and Cyrillic
test. For the Japanese tests the gains are minor and for emoji it seems
to have no effect.

Reviewed By: ldionne, tahonermann, #libc

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

22 months ago[ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified
Fangrui Song [Thu, 20 Apr 2023 19:17:26 +0000 (12:17 -0700)]
[ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified

When --threads= is unspecified, we set it to
`parallel::strategy.compute_thread_count()`, which uses
sched_getaffinity (Linux)/cpuset_getaffinity (FreeBSD)/std::thread::hardware_concurrency (others).
With extensive testing on many machines (many configurations from
{aarch64,x86-64} x {Linux,FreeBSD,Windows} x allocators(native,mimalloc,rpmalloc) combinations)
with varying workloads, we discovered that when the concurrency is larger than
16, the linking process is slower than using --threads=16 due to parallelism
overhead outweighs optimizations. This is particularly harmful for machines with
many cores or when the link job competes with other jobs.

Cap parallel::strategy when --threads= is unspecified.
For some workloads changing the concurrency from 8 to 16 has nearly no improvement.

--thinlto-jobs= is unchanged since ThinLTO backend compiles are embarrassingly
parallel.

Link: https://discourse.llvm.org/t/avoidable-overhead-from-threading-by-default/69160
Reviewed By: peter.smith, andrewng

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

22 months ago[libc++][doc] Update format status.
Mark de Wever [Sun, 16 Apr 2023 10:16:36 +0000 (12:16 +0200)]
[libc++][doc] Update format status.

Reviewed By: ldionne, #libc

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

22 months ago[ThinLTO] Remove BlockCount for non partial sample profile builds
Teresa Johnson [Wed, 19 Apr 2023 21:51:10 +0000 (14:51 -0700)]
[ThinLTO] Remove BlockCount for non partial sample profile builds

As pointed out in
https://discourse.llvm.org/t/undeterministic-thin-index-file/69985, the
block count added to distributed ThinLTO index files breaks incremental
builds on ThinLTO - if any linked file has a different number of BBs,
then the accumulated sum placed in the index files will change, causing
all ThinLTO backend compiles to be redone.

The block count is only used for scaling of partial sample profiles, and
was added in D80403 for D79831.

This patch simply removes this field from the index files of non partial
sample profile compiles, which is NFC on the output of the compiler.

We subsequently need to see if this can be removed for partial sample
profiles without signficant performance loss, or redesigned in a way
that does not destroy caching.

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

22 months ago[dwarfdump][dwarf] Fix parsing of tu-index
Alexander Yermolovich [Wed, 19 Apr 2023 23:38:08 +0000 (16:38 -0700)]
[dwarfdump][dwarf] Fix parsing of tu-index

Fixed issue where {tu,cu}-index fixup code for DWARF5 that would report an error when
fixup map is empty. Which is the case when seciton(s) are not over 4GB or
--manaully-generate-unit-index is not specified

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

22 months ago[BOLT] Make BOLT_ENABLE_RUNTIME user-configurable
Nathan Sidwell [Wed, 19 Apr 2023 20:08:25 +0000 (16:08 -0400)]
[BOLT] Make BOLT_ENABLE_RUNTIME user-configurable

Defaults to ON for x86_64 && (Linux | Darwin).

If enabled, checks that /proc/self/map_files is readable. Some systems are configured so that getdents fails with EPERM.

Reviewed By: rafauler

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

22 months agoFix failure with team-wide allocated variable
Doru Bercea [Tue, 4 Apr 2023 19:12:08 +0000 (15:12 -0400)]
Fix failure with team-wide allocated variable

Review: https://reviews.llvm.org/D147572

22 months ago[CostModel][X86] Improve i8 and vXi8 MUL costs
Simon Pilgrim [Thu, 20 Apr 2023 18:38:40 +0000 (19:38 +0100)]
[CostModel][X86] Improve i8 and vXi8 MUL costs

We were treating vXi8 multiply as the sum of a trunc(mul(extend(),extend())) which diverged from the costs from llvm-mcaonce we extended beyond legal types

Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates

Helps address some of the regressions identified in D148806

22 months ago[compiler-rt] Include system headers before optionally defining HWCAP macros
Dimitry Andric [Thu, 20 Apr 2023 17:43:37 +0000 (19:43 +0200)]
[compiler-rt] Include system headers before optionally defining HWCAP macros

In https://reviews.llvm.org/D141285 the optional definitions of `HWCAP`
macros were moved to before their usage. However, they were also moved
to before the inclusion of system headers which can optionally define
them. If any of those system headers then actually defined any of the
`HWCAP` macros, it would result in a redefinition error.

Move the system header includes to just before the optional definitions,
to avoid this problem.

Reviewed By: ilinpv

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

22 months ago[clang][modules] Avoid re-exporting PCH imports on every later module import
Ben Langmuir [Wed, 12 Apr 2023 21:54:55 +0000 (14:54 -0700)]
[clang][modules] Avoid re-exporting PCH imports on every later module import

We only want to make PCH imports visible once for the the TU, not
repeatedly after every subsequent import. This causes some incorrect
behaviour with submodule visibility, and causes us to get extra module
dependencies in the scanner. So far I have only seen obviously incorrect
behaviour when building with -fmodule-name to cause a submodule to be
textually included when using the PCH, though the old behaviour seems
wrong regardless.

rdar://107449644

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

22 months agoReland: [Demangle] replace use of llvm::StringView w/ std::string_view
Nick Desaulniers [Thu, 20 Apr 2023 18:08:04 +0000 (11:08 -0700)]
Reland: [Demangle] replace use of llvm::StringView w/ std::string_view

This reverts commit d81cdb49d74064e88843733e7da92db865943509.

This refactoring was waiting on converting LLVM to C++17.

Leave StringView.h and cleanup around for subsequent cleanup.

Additional fixes for missing std::string_view conversions for MSVC.

Reviewed By: MaskRay, DavidSpickett, ayzhao

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

22 months ago[mlir] Expose Arith::ExpandOps options in constructor
Robert Suderman [Thu, 20 Apr 2023 18:10:23 +0000 (18:10 +0000)]
[mlir] Expose Arith::ExpandOps options in constructor

ExpandOpsPass could only be configured via command line flags. Updated
to allowed constructing using the specified Options structure.

Reviewed By: NatashaKnk

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

22 months ago[clang][deps] Print timing information
Jan Svoboda [Thu, 20 Apr 2023 18:03:02 +0000 (11:03 -0700)]
[clang][deps] Print timing information

This patch adds new `-print-timing` option to `clang-scan-deps`. It measures the wall and process time taken to scan dependencies for the compilation database. This provides more representative data compared to measuring the timing for the whole tool invocation, since that includes parsing and generating JSON files, which can be significant for larger inputs.

Reviewed By: akyrtzi

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

22 months agoFix handling of special and large vals in expand pattern for `round`
Ramiro Leal-Cavazos [Thu, 20 Apr 2023 18:00:08 +0000 (18:00 +0000)]
Fix handling of special and large vals in expand pattern for `round`

The current expand pattern for `math.round` does not handle the
special values -0.0, +-inf, and +-nan correctly. It also does not
properly handle values with magnitude |x| >= 2^23. Lastly, the pattern
generates invalid IR when the input to `math.round` is a vector. This
patch fixes these issues.

Reviewed By: rsuderman

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

22 months ago[DAG] Retain nuw flags when reassociating adds
David Green [Thu, 20 Apr 2023 18:05:45 +0000 (19:05 +0100)]
[DAG] Retain nuw flags when reassociating adds

Given two adds that are both nuw, they will still be nuw after being
reassociated. (They only increase in value and at no point wrap).
https://alive2.llvm.org/ce/z/JrYM6H

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

22 months ago[flang][openacc] Support array section with constant lb or ub for data operand
Valentin Clement [Thu, 20 Apr 2023 17:52:45 +0000 (10:52 -0700)]
[flang][openacc] Support array section with constant lb or ub for data operand

Add support for array section with constant lower or upper bound.
The current lowering will trigger a TODO when the array is assumed size
or if the lower or upper bound is a variable.

Depends on D148721

Reviewed By: razvanlupusoru, jeanPerier

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

22 months agoarm_bf16.td: fix copy/paste typo in comment header
Dimitry Andric [Thu, 20 Apr 2023 14:12:10 +0000 (16:12 +0200)]
arm_bf16.td: fix copy/paste typo in comment header

22 months ago[doc][RISCV] Add missed release note about vector crypto extension update
Alex Bradbury [Thu, 20 Apr 2023 17:30:53 +0000 (18:30 +0100)]
[doc][RISCV] Add missed release note about vector crypto extension update

I meant to fold this into cb7dffdc9a83f400410657431bda14e79f6e0176 but
failed to do so.

22 months ago[RISCV] Zvk (vector crypto) specification update to 0.5.1 (Zvbb/Zvbc/Zvkt/Zvkng/Zvksg)
Eric Gouriou [Thu, 20 Apr 2023 17:24:34 +0000 (18:24 +0100)]
[RISCV] Zvk (vector crypto) specification update to 0.5.1 (Zvbb/Zvbc/Zvkt/Zvkng/Zvksg)

Update the Zvk support from 0.3.x to 0.5.1, tracking the extension as
documented in
<https://github.com/riscv/riscv-crypto/releases/download/v20230407/riscv-crypto-spec-vector.pdf>.

- Zvkb is split into Zvbb and Zvbc
- Zvbc (vector carryless multiply) requires 64 bit elements (Zve64x)
- Use the extension descriptions from the specification for Zvbb/Zvbc
- Zvkt is introduced (no instructions, but adds an attribute and macro)
- Zvkn and Zvks both imply Zvkt
- Zvkng and Zvksg are introduced, adding Zvkg (GMAC) to Zvkn and Zvks
- In Zvbb, add vrev.v, vclz.v, vctz.v, vcpop.v, vwsll.{vv,vx,vi}

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

22 months ago[AArch64] Improve fsh(l|r) cost modeling if 3rd arg is constant.
Zain Jaffal [Thu, 20 Apr 2023 17:20:01 +0000 (18:20 +0100)]
[AArch64] Improve fsh(l|r) cost modeling if 3rd arg is constant.

In that case, the cost for i32 and i64 should be 1 (a single EXTR
instruction). For v4i32 and v2i64 it should be 3 (USHR + SHL + ORR).

Other sizes smaller than 64 bits require an extra instruction for
conversion to i32/i64.

This recovers a SLP regression revealed by D140392.

Reviewed By: dmgreen

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

22 months ago[libcxxabi][demangle] create helper for std::string_view::starts_with
Nick Desaulniers [Thu, 20 Apr 2023 17:02:28 +0000 (10:02 -0700)]
[libcxxabi][demangle] create helper for std::string_view::starts_with

Add C++ 20 style starts_with to replace StringView::startsWith in
LLVMDemangle. Due to library layering (LLVMSupport depends on
LLVMDemangle), we add the utility header under llvm/Demangle, instead of
llvm/ADT or llvm/Support.

Modify this in libcxxabi, then copy this over to llvm.

Reviewed By: MaskRay, #libc_abi, phosek

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

22 months ago[RISCV] Add an option to emit the Tag_RISCV_arch attribute based on the assembler...
Craig Topper [Thu, 20 Apr 2023 16:57:18 +0000 (09:57 -0700)]
[RISCV] Add an option to emit the Tag_RISCV_arch attribute based on the assembler's subtarget

This adds an option to emit the command line -mattr/-march into the
attributes of an object file. This can be useful to get objdump to
disassemble instructions that aren't in the base without forcing
users to add a .attribute to the assembly file.

The binutils assembler does this by default.

Similar option exists for ARM. I will wire it to a clang option in
another patch. Similar to https://reviews.llvm.org/D31813

Reviewed By: asb, kito-cheng

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

22 months ago[TableGen] Remove BitsRecTy::typeIsA override. NFC
Craig Topper [Thu, 20 Apr 2023 16:56:08 +0000 (09:56 -0700)]
[TableGen] Remove BitsRecTy::typeIsA override. NFC

BitsRecTy objects are uniqued based on size. If the sizes are equal, then
the BitsRecTy objects are the same objects. We can use the base class
implementation that checks for pointer equality.

22 months agoInstructions to run libc++ test suite
AdityaK [Tue, 11 Apr 2023 22:11:25 +0000 (15:11 -0700)]
Instructions to run libc++ test suite

Reviewers: ldionne, philnik, EricWF

Reviewed By: EricWF

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

22 months ago[AArch64] Additional hadd/rhadd tests. NFC
David Green [Thu, 20 Apr 2023 16:51:54 +0000 (17:51 +0100)]
[AArch64] Additional hadd/rhadd tests. NFC

See D148809

22 months agoRevert D147493 "[ELF] Cap parallel::strategy to 16 threads when --threads= is unspeci...
Fangrui Song [Thu, 20 Apr 2023 16:49:22 +0000 (09:49 -0700)]
Revert D147493 "[ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified"

This reverts commit da68d2164efcc1f5e57f090e2ae2219056b120a0.

This change is correct, but left a `config->threadCount` use that is error-prone
and may harm performance when parallel::strategy.compute_thread_count() > 16.

22 months ago[libc] Zero initialize Uint<T>::val
Mikhail R. Gadelha [Thu, 20 Apr 2023 16:43:46 +0000 (13:43 -0300)]
[libc] Zero initialize Uint<T>::val

This fix a regression introduced by commit 5db12eca1f70bb9c2dab33ff88dcccdfba75af6e

Fixes the compilation failure reported by libc-x86_64-debian-gcc-fullbuild-dbg:

.../libc/src/__support/UInt.h:26:31: note: ‘struct __llvm_libc::cpp::UInt<192>’ has no user-provided default constructor
   26 | template <size_t Bits> struct UInt {
      |                               ^~~~
.../libc/src/__support/UInt.h:38:13: note: constructor is not user-provided because it is explicitly defaulted in the class body
   38 |   constexpr UInt() = default;

22 months ago[mlir] Add a utility function to make a region isolated from above.
Mahesh Ravishankar [Thu, 20 Apr 2023 16:30:14 +0000 (16:30 +0000)]
[mlir] Add a utility function to make a region isolated from above.

The utility functions takes a region and makes it isolated from above
by appending to the entry block arguments that represent the captured
values and replacing all uses of the captured values within the region
with the newly added arguments. The captures values are returned.

The utility function also takes an optional callback that allows
cloning operations that define the captured values into the region
during the process of making it isolated from above. The cloned value
is no longer a captured values. The operands of the operation are then
captured values. This is done transitively allow cloning of a DAG of
operations into the region based on the callback.

Reviewed By: jpienaar

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

22 months ago[SLP][X86]Fix the cost of reused gathers/buildvectors and floats insert.
Alexey Bataev [Wed, 19 Apr 2023 20:04:12 +0000 (13:04 -0700)]
[SLP][X86]Fix the cost of reused gathers/buildvectors and floats insert.

There are 2 problems in the cost estimation for buildvector/gather.
1. If the buildvector/gather node is the same as another one node, need
   to estimate the cost of this node as 0.
2. The cost of inserting float point register to non-poison vector is
   not 0, it should not be considered free.

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

22 months ago[Sema] -Wformat: recognize %lb for the printf/scanf family of functions
Fangrui Song [Thu, 20 Apr 2023 16:34:34 +0000 (09:34 -0700)]
[Sema] -Wformat: recognize %lb for the printf/scanf family of functions

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

D131057 added `bArg` and `BArg` in the `AsLongLong` label in
`FormatSpecifier::hasValidLengthModifier`, but missed the `AsLong` label,
therefore `%llb` is allowed while `%lb` (e.g. `printf("%lb", (long)10)`) has a
spurious warning. Add the missing case labels.

Reviewed By: aaron.ballman, enh

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

22 months agoHeaders: use C++ inline semantics in C++ mode
Saleem Abdulrasool [Thu, 20 Apr 2023 15:56:15 +0000 (08:56 -0700)]
Headers: use C++ inline semantics in C++ mode

When building with the 17.5.0 preview toolset for MSVC and building with
modules, the definition of _addcarry_u64 and _subborrow_u64 seem to
cause issues due to the use of GNU inline semantics. Change the headers
to prefer C++ inline semantics for C++ compilation, falling back to GNU
inlining semantics for C compilation.

This is motivated by https://github.com/microsoft/STL/issues/2520.

Differential Revision: https://reviews.llvm.org/D139749
Reviewed By: fsb4000

22 months ago[libc] Make UInt<T> trivially copyable
Mikhail R. Gadelha [Thu, 20 Apr 2023 16:00:04 +0000 (13:00 -0300)]
[libc] Make UInt<T> trivially copyable

This patch defaults the copy constructor and copy operator so it can be
used with __builtin_bit_cast

Reviewed By: sivachandra

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

22 months ago[AArch64] Add extra fshr tests with large types.
Florian Hahn [Thu, 20 Apr 2023 15:39:04 +0000 (16:39 +0100)]
[AArch64] Add extra fshr tests with large types.

Extra tests discussed in D147322.

22 months ago[AArch64] Add extra fshl tests with large types.
Florian Hahn [Thu, 20 Apr 2023 15:34:59 +0000 (16:34 +0100)]
[AArch64] Add extra fshl tests with large types.

Extra tests discussed in D147322.

22 months ago[Coroutines] Convert tests to opaque pointers (NFC)
Nikita Popov [Thu, 13 Apr 2023 14:39:42 +0000 (16:39 +0200)]
[Coroutines] Convert tests to opaque pointers (NFC)

22 months agoworkflows/release-binaries: Install missing dependencies
Tom Stellard [Thu, 20 Apr 2023 15:21:51 +0000 (08:21 -0700)]
workflows/release-binaries: Install missing dependencies

Reviewed By: thieta

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

22 months agoworkflows/release-tasks: Always run apt-get update before installing deps
Tom Stellard [Thu, 20 Apr 2023 15:15:49 +0000 (08:15 -0700)]
workflows/release-tasks: Always run apt-get update before installing deps

There is a bug in the package tree of on the default images that
causes some dependencies not to be found.  Running apt-get gets us
the latest package lists rather than relying on the default lists
in the GitHub Runner imgae, which can be up to a week old.

Running apt-get update before intstalling packages is also recommended in
the official github documentation:

https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners#installing-software-on-ubuntu-runners

Reviewed By: thieta

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

22 months ago[ConstraintElim] Fix integer overflow in getConstraint.
Florian Hahn [Thu, 20 Apr 2023 15:14:06 +0000 (16:14 +0100)]
[ConstraintElim] Fix integer overflow in getConstraint.

Use SubOverflow to avoid signed integer overflow when combining
coefficients.

Fixes #62226.

22 months agoRevert "[AArch64] Fix incorrect `isLegalAddressingMode`"
Momchil Velikov [Thu, 20 Apr 2023 15:07:51 +0000 (16:07 +0100)]
Revert "[AArch64] Fix incorrect `isLegalAddressingMode`"

This reverts commit 0827e2fa3fd15b49fd2d0fc676753f11abb60cab.

Failing buildbot, perhaps due to `-std=c++20`.

22 months ago[Clang][AIX] Remove error for -fprofile-instr-generate/use on AIX
Zarko Todorovski [Thu, 20 Apr 2023 14:00:52 +0000 (10:00 -0400)]
[Clang][AIX] Remove error for -fprofile-instr-generate/use on AIX

Instrumented profiling now works on AIX and there is no dependency
on LTO for PGO. Remove the error.

Reviewed By: qiongsiwu1

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

22 months agoRevert "[mlir][irdl] Add IRDL registration"
Arjun P [Thu, 20 Apr 2023 14:55:21 +0000 (15:55 +0100)]
Revert "[mlir][irdl] Add IRDL registration"

This reverts commit e0d884de360b5c3fe79c6a53f8f88b57f0e42275.

Reverting due to buildbot failure.

22 months ago[AArch64] Make stack tagging compatible with SLH
Kristof Beyls [Mon, 17 Apr 2023 09:19:26 +0000 (11:19 +0200)]
[AArch64] Make stack tagging compatible with SLH

See https://github.com/llvm/llvm-project/issues/61830

Speculative Load Hardening (SLH) requires that conditional branches are
implemented using B.cc branches, not using {TC}B{N}Z branches.

Stack tagging was expanding one of the pseudo instructions it uses to
cbnz. This commit changes that to use b.ne instead.

Note that the added regression test was added to settag.ll rather than
speculation-hardening.ll. The speculation-hardening.ll tests also check
that all tests in the file work with global-isel. It seems that stack
tagging does not work yet with global-isel. Therefore, testing the
combination of stack tagging and SLH hard to be added to a test file
that doesn't test global-isel, i.e. settag.ll

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

22 months ago[AArch64] Fix incorrect `isLegalAddressingMode`
Momchil Velikov [Thu, 20 Apr 2023 13:51:47 +0000 (14:51 +0100)]
[AArch64] Fix incorrect `isLegalAddressingMode`

`AArch64TargetLowering::isLegalAddressingMode` has a number of
defects, including accepting an addressing mode which consists of only
an immediate operand, or not checking the offset range for an
addressing mode in the form `1*ScaledReg + Offs`.

This patch fixes the above issues.

Reviewed By: dmgreen

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

Change-Id: I756fa21941844ded44f082ac7eea4391219f9851

22 months ago[mlir][irdl] Add IRDL registration
Mathieu Fehr [Thu, 20 Apr 2023 14:33:00 +0000 (15:33 +0100)]
[mlir][irdl] Add IRDL registration

This patch add support for loading IRDL dialects at runtime
with `mlir-opt`.

Given the following `dialect.irdl` file:
```mlir
module {
  irdl.dialect @cmath {
    irdl.type @complex {
      %0 = irdl.is f32
      %1 = irdl.is f64
      %2 = irdl.any_of(%0, %1)
      irdl.parameters(%2)
    }

    irdl.operation @norm {
      %0 = irdl.any
      %1 = irdl.parametric @complex<%0>
      irdl.operands(%1)
      irdl.results(%0)
    }
}
```

the IRDL file can be loaded with the `mlir-opt --irdl-file=dialect.irdl`
command, and the following file can then be parsed:

```mlir
func.func @conorm(%p: !cmath.complex<f32>, %q: !cmath.complex<f32>) -> f32 {
  %norm_p = "cmath.norm"(%p) : (!cmath.complex<f32>) -> f32
  %norm_q = "cmath.norm"(%q) : (!cmath.complex<f32>) -> f32
  %pq = arith.mulf %norm_p, %norm_q : f32
  return %pq : f32
}
```

To minimize the size of this patch, the operation, attribute, and type verifier are all always returning `success()`.

Depends on D144692

Reviewed By: rriddle, Mogball, mehdi_amini

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

22 months ago[ConstantFolding] Fix crash when folding vector llvm.is.fpclass
Jay Foad [Thu, 20 Apr 2023 14:03:47 +0000 (15:03 +0100)]
[ConstantFolding] Fix crash when folding vector llvm.is.fpclass

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

22 months ago[gn build] Port 4bc6499f8843
LLVM GN Syncbot [Thu, 20 Apr 2023 14:25:08 +0000 (14:25 +0000)]
[gn build] Port 4bc6499f8843

22 months ago[C11] Allow casting to an _Atomic-qualified type
Aaron Ballman [Thu, 20 Apr 2023 14:20:54 +0000 (10:20 -0400)]
[C11] Allow casting to an _Atomic-qualified type

We were failing to strip off atomic qualification when forming the cast
destination type, but properly stripping off cvr qualification. Now we
accept atomic, qualified, or unqualified destination types.

Note: the semantics of the cast still drop the qualifier, so such a
cast does not result in an atomic rvalue.

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

22 months agoAMDGPU: Fix assertion with multiple uses of f64 fneg of select
Matt Arsenault [Thu, 20 Apr 2023 12:00:02 +0000 (08:00 -0400)]
AMDGPU: Fix assertion with multiple uses of f64 fneg of select

A bitcast needs to be inserted back to the original type. Just
skip the multiple use case for a safer quick fix. Handling
the multiple use case seems to be beneficial in some but not
all cases.

22 months agoReapply D146987 "[Assignment Tracking] Enable by default"
OCHyams [Thu, 20 Apr 2023 13:51:58 +0000 (14:51 +0100)]
Reapply D146987 "[Assignment Tracking] Enable by default"

See https://discourse.llvm.org/t/rfc-enable-assignment-tracking/69399

This sets the -Xclang -fexperimental-assignment-tracking flag to the value
enabled which means it will be enabled so long as none of the following are
true: it's an LTO build, LLDB debugger tuning has been specified, or it's an O0
build (no work is done in any case if -g is not specified or -gmlt is used).

This reverts commit a65ca4546b9ee042d6c40149d3f820893edbd766 which reverts
https://reviews.llvm.org/D146987

22 months ago[libc++][NFC] Remove one apply_cv implementation
Nikolas Klauser [Sun, 16 Apr 2023 15:22:02 +0000 (17:22 +0200)]
[libc++][NFC] Remove one apply_cv implementation

Reviewed By: #libc, ldionne

Spies: arichardson, libcxx-commits

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

22 months ago[Clangd] Make the type hint length limit configurable
zhangyi1357 [Thu, 20 Apr 2023 10:13:44 +0000 (12:13 +0200)]
[Clangd] Make the type hint length limit configurable

This commit is about clangd's type name hint length limit. The past behavior was 32 characters fixed limit. It is now configurable.

Projects can now add the following config fragment to their .clangd:

```
InlayHints:
  TypeNameLimit: 34
```

Ref: [[ https://github.com/clangd/clangd/issues/1357  | Make the type hint length limit configurable ]]

Reviewed By: hokein

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

22 months ago[NFC] Return unique dbg intrinsics from findDbgValues and findDbgUsers
OCHyams [Thu, 20 Apr 2023 12:51:06 +0000 (13:51 +0100)]
[NFC] Return unique dbg intrinsics from findDbgValues and findDbgUsers

The out-param vector from findDbgValues and findDbgUsers should not include
duplicates, which is possible if the debug intrinsic uses the value multiple
times. This filter is already in place for multiple uses in a `DIArgLists`;
extend it to cover dbg.assigns too because a Value may be used in both the
address and value components.

Additionally, refactor the duplicated functionality between findDbgValues and
FindDbgUsers into a new function findDbgIntrinsics.

Reviewed By: jmorse, StephenTozer

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

22 months ago[LangRef] Update list of supported constant expressions (NFC)
Nikita Popov [Thu, 20 Apr 2023 12:33:06 +0000 (14:33 +0200)]
[LangRef] Update list of supported constant expressions (NFC)

For binary ops explicitly list all supported ops, as it's no
longer all of them.

22 months agoRevert "[ORC][LLJIT] Use JITLink by default on ELF/x86-64."
Nikita Popov [Thu, 20 Apr 2023 12:20:43 +0000 (14:20 +0200)]
Revert "[ORC][LLJIT] Use JITLink by default on ELF/x86-64."

This reverts commit 85c649bc02a6605f541b09b33a200a78275ed90f.

Has been causing test failures in OrcV2Examples for the past few
days.

22 months agoReapply [SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating
Nikita Popov [Wed, 22 Mar 2023 10:53:01 +0000 (11:53 +0100)]
Reapply [SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating

This exposed another miscompile in GVN, which was fixed by
20e9b31f88149a1d5ef78c0be50051e345098e41.

-----

After D141386, violation of nonnull, range and align metadata
results in poison rather than immediate undefined behavior,
which means that these are now safe to retain when speculating.
We only need to remove UB-implying metadata like noundef.

This is done by adding a dropUBImplyingAttrsAndMetadata() helper,
which lists the metadata which is known safe to retain on speculation.

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