platform/upstream/llvm.git
16 months ago[clang-format] Correctly annotate overloaded operator function name
Owen Pan [Sat, 15 Jul 2023 07:45:18 +0000 (00:45 -0700)]
[clang-format] Correctly annotate overloaded operator function name

The operator keyword preceded by a template closer should be annotated as
TT_FunctionDeclarationName.

Fixes #63879.

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

16 months ago[libc++][Modules] Restore the <string> include to <__format/format_functions.h>
Ian Anderson [Wed, 12 Jul 2023 20:54:16 +0000 (13:54 -0700)]
[libc++][Modules] Restore the <string> include to <__format/format_functions.h>

<__format/format_functions.h> was using <string>, we need to bring the include back that was removed in D154122.

Reviewed By: Mordante, #libc

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

16 months ago[ubsan] Disable sigaction.cpp on archs for debugging
Caslyn Tonelli [Fri, 14 Jul 2023 17:45:54 +0000 (17:45 +0000)]
[ubsan] Disable sigaction.cpp on archs for debugging

Add `ubsan-tsan` condition to test disablement.

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

16 months ago[X86] LowerMemArgument - remove else clause after return (style). NFC.
Simon Pilgrim [Sat, 15 Jul 2023 14:57:32 +0000 (15:57 +0100)]
[X86] LowerMemArgument - remove else clause after return (style). NFC.

16 months ago[X86] getIRStackGuard - remove else clause after return (style). NFC.
Simon Pilgrim [Sat, 15 Jul 2023 14:55:40 +0000 (15:55 +0100)]
[X86] getIRStackGuard - remove else clause after return (style). NFC.

16 months ago[X86] Fix znver4 fcmp/fma throughputs
Simon Pilgrim [Sat, 15 Jul 2023 14:46:16 +0000 (15:46 +0100)]
[X86] Fix znver4 fcmp/fma throughputs

Reported by SeeSpring - it looks like when the numbers were copied from the znver3 model, the resources were altered when it should have just been the latency.

Now matches uops.info / Agner / AMD SoG

Fixes #63877

16 months ago[libc++] Adds a missing include.
Mark de Wever [Sat, 15 Jul 2023 14:29:36 +0000 (16:29 +0200)]
[libc++] Adds a missing include.

It turns out D153336 needs a new include. This should fix the broken
LLVM CI runners.

16 months ago[libc++][tests] Fix a test testing wrong class
Piotr Fusik [Sat, 15 Jul 2023 09:14:02 +0000 (11:14 +0200)]
[libc++][tests] Fix a test testing wrong class

Reviewed By: #libc, Mordante

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

16 months ago[NFC][libc++][bitset] Refactors constructors.
Mark de Wever [Sun, 9 Jul 2023 13:36:12 +0000 (15:36 +0200)]
[NFC][libc++][bitset] Refactors constructors.

Based on the review comments in D153201 this combines the string and
c-string constructors. The common constructor is using a string_view:
- it allows propagating the _Traits, which are required to be used for
  comparison.
- it avoids allocating
- libc++ supports it in C++03

Reviewed By: philnik, #libc, ldionne

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

16 months ago[ValueTracking] Support vscale assumes for isKnownToBeAPowerOfTwo
zhongyunde [Sat, 15 Jul 2023 11:40:25 +0000 (19:40 +0800)]
[ValueTracking] Support vscale assumes for isKnownToBeAPowerOfTwo

This patch is separated from D154953 to see what tests are affected by this
change alone according comment.
Depend on the related updating of LangRef on D155193.

Reviewed By: paulwalker-arm, nikic, david-arm
Differential Revision: https://reviews.llvm.org/D155350

16 months ago[tests] precommit tests for D155350
zhongyunde [Sat, 15 Jul 2023 11:36:05 +0000 (19:36 +0800)]
[tests] precommit tests for D155350

Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D155363

16 months ago[libc++] add basic runtime assertions to <barrier>
Edoardo Sanguineti [Sat, 15 Jul 2023 10:48:10 +0000 (12:48 +0200)]
[libc++] add basic runtime assertions to <barrier>

Adding assertions will aid users that have bugs in their code to receive better error messages.

Reviewed By: #libc, ldionne

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

16 months ago[libc++][chrono] Fixes formatter duration.
Mark de Wever [Sat, 26 Nov 2022 17:15:45 +0000 (18:15 +0100)]
[libc++][chrono] Fixes formatter duration.

@EricWF spotted this issue in the post-commit review comments of
D134742. However the suggestion to just use chrono calculations can
result in similar issues when using small fractional seconds.

Reviewed By: EricWF, #libc

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

16 months ago[libc++] Fixes thread::id's operator<<.
Mark de Wever [Fri, 2 Jun 2023 09:25:50 +0000 (11:25 +0200)]
[libc++] Fixes thread::id's operator<<.

The output of

  template<class charT, class traits>
    basic_ostream<charT, traits>&
      operator<<(basic_ostream<charT, traits>& out, thread::id id);

is affected by the state of out. The wording states

[thread.thread.id]/2
  The text representation for the character type charT of an object of
  type thread::id is an unspecified sequence of charT such that, for two
  objects of type thread::id x and y, if x == y is true, the thread::id
  objects have the same text representation, and if x != y is true, the
  thread::id objects have distinct text representations.

[thread.thread.id]/9
  template<class charT, class traits>
    basic_ostream<charT, traits>&
      operator<< (basic_ostream<charT, traits>& out, thread::id id);

  Effects: Inserts the text representation for charT of id into out.

This wording changed in C++23 due to adding a formatter specialization for
thread::id. However the requirement was the same in older versions of C++.

This issue is that thread::id is an integral or pointer and affected by the
formatting manipulators for them. Thus the text representation can differ if
x == y which violates the requirements.

The fix has to hard-code some formatting style for the text
representation. It uses the Standard specified default values

Table 124: basic_ios::init() effects [tab:basic.ios.cons] flags()
  flags() skipws | dec

Fixes PR: https://llvm.org/PR62073

Reviewed By: #libc, ldionne

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

16 months ago[libc++][NFC] Remove redundant defined(_LIBCPP_BUILDING_LIBRARY)
Nikolas Klauser [Sat, 15 Jul 2023 08:38:07 +0000 (01:38 -0700)]
[libc++][NFC] Remove redundant defined(_LIBCPP_BUILDING_LIBRARY)

16 months agoRevert "Revert "[MemCpyOpt] implement single BB stack-move optimization which unify...
khei4 [Thu, 13 Jul 2023 09:59:21 +0000 (18:59 +0900)]
Revert "Revert "[MemCpyOpt] implement single BB stack-move optimization which unify the static unescaped allocas""

This reverts commit 36a6eb7d12a9f827bf3d5d4e5fdc68b8a62807b2.

[MemCpyOpt] check that load/store and dest/src alloca are all in the same bb

Differential Revision: https://reviews.llvm.org/D153453
Co-authored-by: serge-sans-paille <sguelton@mozilla.com>
16 months ago[MemCpyOpt] precommit tests to add multi-BB stack-move optimization to check crash...
khei4 [Thu, 13 Jul 2023 09:59:02 +0000 (18:59 +0900)]
[MemCpyOpt] precommit tests to add multi-BB stack-move optimization to check crash for D153453 (NFC)
Differential Revision: https://reviews.llvm.org/D155179
Co-authored-by: serge-sans-paille <sguelton@mozilla.com>
16 months ago[mlir][sparse][gpu] add the 2:4 spmm integration test from linalg
Kun Wu [Sat, 15 Jul 2023 05:58:48 +0000 (05:58 +0000)]
[mlir][sparse][gpu] add the 2:4 spmm integration test from linalg

Reviewed By: aartbik

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

16 months agoReformat
NAKAMURA Takumi [Sat, 15 Jul 2023 04:50:21 +0000 (13:50 +0900)]
Reformat

16 months agoRevert D150338, "[-Wunsafe-buffer-usage] Improving insertion of the [[clang::unsafe_b...
NAKAMURA Takumi [Sat, 15 Jul 2023 04:46:10 +0000 (13:46 +0900)]
Revert D150338, "[-Wunsafe-buffer-usage] Improving insertion of the [[clang::unsafe_buffer_usage]] attribute"

clangAnalysis should not depend on clangSema.

This reverts commit 5b012bf5ab5fcb840fe7f6c8664b8981ce6f24f3.

16 months ago[RISCV] Split clmul/clmulh/clmulr builtins into _32 and _64 versions.
Craig Topper [Sat, 15 Jul 2023 02:09:15 +0000 (19:09 -0700)]
[RISCV] Split clmul/clmulh/clmulr builtins into _32 and _64 versions.

This removes another use of 'long' to mean xlen from builtins.

I've also converted the types to unsigned as proposed in D154616.

clmul_32 is available to RV64 as its emulation is clmul+sext.w
clmulh_32 and clmulr_32 are not available on RV64 as their emulation
is currently 6 instructions in the worst case.

16 months ago[libc++] Set correct size at the end of growing std::string
Advenam Tacet [Thu, 13 Jul 2023 00:30:36 +0000 (02:30 +0200)]
[libc++] Set correct size at the end of growing std::string

This commit deprecates `std::basic_string::__grow_by`, which is part of ABIv1. The function is replaced by `std::basic_string:__grow_by_without_replace`, which is not part of ABI.

- The original function `__grow_by` is deprecated because it does not set the string size,  therefore it may not update the size when the size is changed, and it may also not set the size at all when the string was short initially. This leads to unpredictable size value. It is not removed or changed to avoid breaking the ABI.
- The commit adds `_LIBCPP_HIDE_FROM_ABI`  guarded by `_LIBCPP_ABI_VERSION >= 2` to `__grow_by`. This allows the function to be used in the dylib in ABIv1 without raising the `[abi:v170000]` error and removes it from future ABIs. `_LIBCPP_HIDE_FROM_ABI_AFTER_V1` cannot be used.
- Additionally, `__grow_by` has been removed from `_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST` in `libcxx/include/__string/extern_template_lists.h`.

This bugfix is necessary to implement string ASan annotations, because it mitigates the problems encountered in D132769.

Reviewed By: ldionne, #libc, philnik

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

16 months ago[RISCV][GlobalISel] Legalize add, sub and binary logical instructions for narrow...
Nitin John Raj [Fri, 14 Jul 2023 07:00:17 +0000 (00:00 -0700)]
[RISCV][GlobalISel] Legalize add, sub and binary logical instructions for narrow types

For rv32, we test the legalization of i8, i16 and i32. For rv64, we additionally test the legalization of i64.

This is the first of a series of commits aiming to legalize arithmetic instructions for RISCV.

Reviewed By: craig.topper, arsenm

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

16 months ago[mlir] Fix printing of dialect resources
Jeff Niu [Fri, 14 Jul 2023 23:30:17 +0000 (19:30 -0400)]
[mlir] Fix printing of dialect resources

It was forgetting commas.

Reviewed By: rriddle, jpienaar

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

16 months ago[LangRef] vscale_range implies the vscale is power-of-two
Zhongyunde [Sat, 15 Jul 2023 01:04:51 +0000 (09:04 +0800)]
[LangRef] vscale_range implies the vscale is power-of-two

According the discuss on D154953, we need to make the LangRef change
before the optimization relied on the new behaviour:
      vscale_range implies vscale is a power-of-two value, parse of the
  attribute to reject values that are not a power-of-two.

Thanks nikic for the wonderful summary of discussing on D154953:
To provide a bit more context here. We would like to have power of two vscale exposed in a target-independent way, so we can make use of this in places like ValueTracking, just like we currently do the vscale range. Some options that have been discussed are:
  - Remove support for non-power-of-two vscales entirely. (This is my personal preference, but this is hard to undo if it turns out someone does need them.)
  - Add an extra attribute vscale_pow2, or a data layout property.
  - Make vscale_range imply power-of-two vscale, as a compromise solution (what this patch does). This would be relatively easy to turn into one of the two above at a later point.

Reviewed By: paulwalker-arm, nikic, efriedma
Differential Revision: https://reviews.llvm.org/D155193

16 months ago[GitHub] Update repo lockdown to exclude lldb
Chris Bieneman [Sat, 15 Jul 2023 00:34:50 +0000 (19:34 -0500)]
[GitHub] Update repo lockdown to exclude lldb

This change enables the LLDB project to begin experimenting with
pull-request workflows to help identify issues was we move toward
adopting pull requests.

Reviewed By: tstellar, JDevlieghere

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

16 months ago[OpenMP][FIX] Adjust "known" attributes for runtime functions
Johannes Doerfert [Fri, 14 Jul 2023 23:14:56 +0000 (16:14 -0700)]
[OpenMP][FIX] Adjust "known" attributes for runtime functions

This showed up when we started to deduce readnone for the argument of
__kmpc_global_thread_num. The known attributes for "getters" did not
allow to read arguments, but that is sometimes the case.

16 months ago[libc++][hardening] Deprecate `_LIBCPP_ENABLE_ASSERTIONS`.
varconst [Fri, 14 Jul 2023 23:58:15 +0000 (16:58 -0700)]
[libc++][hardening] Deprecate `_LIBCPP_ENABLE_ASSERTIONS`.

`_LIBCPP_ENABLE_ASSERTIONS` was used to enable the "safe" mode in
libc++. Libc++ now provides the hardened mode and the debug mode that
replace the safe mode.

For backward compatibility, enabling `_LIBCPP_ENABLE_ASSERTIONS` now
enables the hardened mode. Note that the hardened mode provides
a narrower set of checks than the previous "safe" mode (only
security-critical checks that are performant enough to be used in
production).

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

16 months ago[MLIR] Don't sort operand of commutative ops when comparing two ops as there is a...
tomnatan [Fri, 14 Jul 2023 23:11:46 +0000 (16:11 -0700)]
[MLIR] Don't sort operand of commutative ops when comparing two ops as there is a correctness issue

This feature was introduced in `D123492`.

Doing equivalence on pointers to sort operands of commutative operations is incorrect when checking equivalence of ops in separate regions (where the lhs and rhs operands are marked as equivalent but are not the same value).

It was also discussed in `D123492` and `D129480` that the correct solution would be to stable sort the operands in canonicalization (based on some numbering in the region maybe), but until that lands, reverting this change will unblock us and other users.

An example of a pass that might not work properly because of this is `DuplicateFunctionEliminationPass`.

Reviewed By: mehdi_amini, jpienaar

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

16 months ago[MLIR:Python] Make DenseElementsAttr.get() only request a buffer format if no explici...
Peter Hawkins [Fri, 14 Jul 2023 23:08:15 +0000 (16:08 -0700)]
[MLIR:Python] Make DenseElementsAttr.get() only request a buffer format if no explicit type was provided.

Not every NumPy type (e.g., the `ml_dtypes.bfloat16` NumPy extension
type) has a type in the Python buffer protocol, so exporting such a
buffer with `PyBUF_FORMAT` may fail.

However, we don't care about the self-reported type of a buffer if the
user provides an explicit type. In the case that an explicit type is
provided, don't request the format from the buffer protocol, which
allows arrays whose element types are unknown to the buffer protocol to
be passed.

Reviewed By: jpienaar, ftynse

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

16 months ago[Clang] Fix crash when emitting diagnostic for out of order designated initializers...
Shafik Yaghmour [Fri, 14 Jul 2023 22:56:17 +0000 (15:56 -0700)]
[Clang] Fix crash when emitting diagnostic for out of order designated initializers in C++

In C++ we are not allowed to use designated initializers to initialize fields
out of order. In some cases when diagnosing this we are crashing because we are
not indexing correctly and therefore going out of bounds.

This fixes: https://github.com/llvm/llvm-project/issues/63605

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

16 months agoAMDGPU: Expand testing of AMDGPUCodeGenPrepare fdiv handling
Matt Arsenault [Thu, 13 Jul 2023 10:21:46 +0000 (06:21 -0400)]
AMDGPU: Expand testing of AMDGPUCodeGenPrepare fdiv handling

- Switch to generated checks
- Use a different run line per denormal mode to reduce test duplication
- Add test coverage for rsqrt cases
- Add test coverage for repeated arcp denominator
- Fix the optnone test

16 months agoFix nanosecond printing for TimePoint formatter.
Eli Friedman [Fri, 14 Jul 2023 22:41:50 +0000 (15:41 -0700)]
Fix nanosecond printing for TimePoint formatter.

There was a copy-paste of the wrong field width, so the nanoseconds
weren't correctly padded with zeros.  Found by inspection.

16 months agoclang: Attach !fpmath metadata to __builtin_sqrt based on language flags
Matt Arsenault [Mon, 3 Jul 2023 20:04:52 +0000 (16:04 -0400)]
clang: Attach !fpmath metadata to __builtin_sqrt based on language flags

OpenCL and HIP have -cl-fp32-correctly-rounded-divide-sqrt and
-fno-hip-correctly-rounded-divide-sqrt. The corresponding fpmath metadata
was only set on fdiv, and not sqrt. The backend is currently underutilizing
sqrt lowering options, and the responsibility is split between the libraries
and backend and this metadata is needed.

CUDA/NVCC has -prec-div and -prev-sqrt but clang doesn't appear to be
aiming for compatibility with those. Don't know if OpenMP has a similar
control.

16 months agoMachineSink: Remove unnecessary empty block check
Matt Arsenault [Fri, 14 Jul 2023 20:43:40 +0000 (16:43 -0400)]
MachineSink: Remove unnecessary empty block check

16 months agoMachineSink: Move helper function and use more const
Matt Arsenault [Fri, 14 Jul 2023 17:06:25 +0000 (13:06 -0400)]
MachineSink: Move helper function and use more const

16 months ago[clang][JumpDiagnostics] bring VerifyIndirectOrAsmJumps to C++17
Nick Desaulniers [Fri, 14 Jul 2023 22:20:05 +0000 (15:20 -0700)]
[clang][JumpDiagnostics] bring VerifyIndirectOrAsmJumps to C++17

Update the code to more modern C++ style.

Reviewed By: void, MaskRay

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

16 months ago[-Wunsafe-buffer-usage] Improving insertion of the [[clang::unsafe_buffer_usage]...
ziqingluo-90 [Fri, 14 Jul 2023 21:43:48 +0000 (14:43 -0700)]
[-Wunsafe-buffer-usage] Improving insertion of the [[clang::unsafe_buffer_usage]] attribute

For a fix-it that inserts the `[[clang::unsafe_buffer_usage]]`
attribute, it will lookup existing macros defined for the attribute
and use the (last defined such) macro directly. Fix-its will use raw
`[[clang::unsafe_buffer_usage]]` if no such macro is defined.

The implementation mimics how a similar machine for the
`[[fallthrough]]` attribute was implemented.

Reviewed by: NoQ (Artem Dergachev)

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

16 months ago[OMPT] Fix use of 'DEBUG_PREFIX' in the OMPT headers
Joseph Huber [Fri, 14 Jul 2023 17:36:00 +0000 (12:36 -0500)]
[OMPT] Fix use of 'DEBUG_PREFIX' in the OMPT headers

This is the only place that defines  this prefix in a header file and
was thus overriding and redefining other users of it. If we must use it
in a header file, at least repsect its old values.

Reviewed By: tianshilei1992

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

16 months ago[Attributor] Allow IR-attr deduction for non-IPO amendable functions
Johannes Doerfert [Mon, 10 Jul 2023 23:43:27 +0000 (16:43 -0700)]
[Attributor] Allow IR-attr deduction for non-IPO amendable functions

If the function is non-IPO amendable we do skip most attributes/AAs.
However, if an AA has a isImpliedByIR that can deduce the attribute from
other attributes, we can run those. For now, we manually enable them,
if we have more later we can use some automation/flag.

16 months ago[Attributor][NFC] Update all tests with the script
Johannes Doerfert [Fri, 14 Jul 2023 20:28:09 +0000 (13:28 -0700)]
[Attributor][NFC] Update all tests with the script

Three tests needed manual adjustment after
https://reviews.llvm.org/D148216 got reverted. See
https://github.com/llvm/llvm-project/issues/63746.

16 months agoRevert "[UTC] Add fallback support for specific metadata, and check their defs"
Johannes Doerfert [Fri, 14 Jul 2023 19:22:43 +0000 (12:22 -0700)]
Revert "[UTC] Add fallback support for specific metadata, and check their defs"

This reverts commit 8a3fdf7b908978625e9a7e57fbb443e4e6f98976 as it is
broken. See https://github.com/llvm/llvm-project/issues/63746.

Effectively fixes: https://github.com/llvm/llvm-project/issues/63746

16 months agoRevert "[UTC] Fix git URL regex"
Johannes Doerfert [Fri, 14 Jul 2023 19:22:20 +0000 (12:22 -0700)]
Revert "[UTC] Fix git URL regex"

This reverts commit 6d64faf3b1d96f4dba8c2c46b8b65f1cc978e82b, as it is
built on top of https://reviews.llvm.org/D148216 which is broken.

See also https://github.com/llvm/llvm-project/issues/63746

16 months agoRevert "[UTC] Generalize version regex"
Johannes Doerfert [Fri, 14 Jul 2023 19:21:55 +0000 (12:21 -0700)]
Revert "[UTC] Generalize version regex"

This reverts commit 4488ee259064532dda24024a7e96037fe9a3c0d9, as it is
built on top of https://reviews.llvm.org/D148216 which is broken.

See also https://github.com/llvm/llvm-project/issues/63746

16 months agoRevert "[UTC] Adapt version matcher to glob CLANG_VENDOR"
Johannes Doerfert [Fri, 14 Jul 2023 19:20:57 +0000 (12:20 -0700)]
Revert "[UTC] Adapt version matcher to glob CLANG_VENDOR"

This reverts commit 68f5d1be3d8f9b2ee2f25098203b24a32057b4e6 as it is
built on top of https://reviews.llvm.org/D148216 which is broken.

See also https://github.com/llvm/llvm-project/issues/63746

16 months agoORC: drop a FIXME that was addressed in dc078e6eaacf. NFC
Jon Roelofs [Fri, 14 Jul 2023 20:48:37 +0000 (13:48 -0700)]
ORC: drop a FIXME that was addressed in dc078e6eaacf. NFC

16 months agoTargetParser: fix getProcessTriple in universal builds
Jon Roelofs [Fri, 14 Jul 2023 20:23:00 +0000 (13:23 -0700)]
TargetParser: fix getProcessTriple in universal builds

The bug happens when you build e.g. an x64_64;arm64 JIT with
LLVM_HOST_TRIPLE=x86_64-apple-macos, and then run it on an apple-m1 not under
Rosetta. In that case, sys::getProcessTriple() will return an x86_64 triple,
not an arm64 one.

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

16 months agoRevert "[clang][Interp][NFC] Trim Source.h includes"
Sterling Augustine [Fri, 14 Jul 2023 20:34:26 +0000 (13:34 -0700)]
Revert "[clang][Interp][NFC] Trim Source.h includes"

This reverts commit 245d10b7a2c12ec25e7b5860a38c61991543a739 which causes
errors like the ones below on slightly older versions of clang:

```
In file included from .../clang/lib/AST/Interp/Source.h:17:
In file included from .../llvm/include/llvm/ADT/PointerUnion.h:19:
In file included from .../llvm/include/llvm/ADT/PointerIntPair.h:18:
.../llvm/include/llvm/Support/PointerLikeTypeTraits.h:61:28: error: invalid application of 'alignof' to an incomplete type 'clang::Decl'
   61 |       detail::ConstantLog2<alignof(T)>::value;
      |                            ^~~~~~~~~~
.../llvm/include/llvm/Support/PointerLikeTypeTraits.h:101:56: note: in instantiation of static data member 'llvm::PointerLikeTypeTraits<clang::Decl *>::NumLowBitsAvailable' requested here
  101 |   static constexpr int NumLowBitsAvailable = NonConst::NumLowBitsAvailable;
      |                                                        ^
.../llvm/include/llvm/ADT/PointerUnion.h:38:54: note: in instantiation of static data member 'llvm::PointerLikeTypeTraits<const clang::Decl *>::NumLowBitsAvailable' requested here
   38 |     return std::min<int>({PointerLikeTypeTraits<Ts>::NumLowBitsAvailable...});
      |                                                      ^
.../llvm/include/llvm/ADT/PointerUnion.h:52:48: note: in instantiation of function template specialization 'llvm::pointer_union_detail::lowBitsAvailable<const clang::Decl *, const clang::Stmt *>' requested here
   52 |     static constexpr int NumLowBitsAvailable = lowBitsAvailable<PTs...>();
      |                                                ^
.../llvm/include/llvm/ADT/PointerIntPair.h:169:28: note: in instantiation of static data member 'llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>::NumLowBitsAvailable' requested here
  169 |   static_assert(PtrTraits::NumLowBitsAvailable <
      |                            ^
.../llvm/include/llvm/ADT/PointerIntPair.h:111:13: note: in instantiation of template class 'llvm::PointerIntPairInfo<void *, 1, llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>>' requested here
  111 |     Value = Info::updateInt(Info::updatePointer(0, PtrVal),
      |             ^
.../llvm/include/llvm/ADT/PointerIntPair.h:89:5: note: in instantiation of member function 'llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>>::setPointerAndInt' requested here
   89 |     setPointerAndInt(PtrVal, IntVal);
      |     ^
.../llvm/include/llvm/ADT/PointerUnion.h:77:16: note: in instantiation of member function 'llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>>::PointerIntPair' requested here
   77 |         : Base(ValTy(const_cast<void *>(
      |                ^
.../clang/lib/AST/Interp/Source.h:76:31: note: in instantiation of member function 'llvm::pointer_union_detail::PointerUnionMembers<llvm::PointerUnion<const clang::Decl *, const clang::Stmt *>, llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>>, 1, const clang::Stmt *>::PointerUnionMembers' requested here
   76 |   SourceInfo(const Stmt *E) : Source(E) {}
      |                               ^
.../clang/lib/AST/Interp/Source.h:22:7: note: forward declaration of 'clang::Decl'
   22 | class Decl;
      |       ^
```

16 months ago[LV] Address post-commit NFC comments in interleave
Anna Thomas [Fri, 14 Jul 2023 20:24:04 +0000 (16:24 -0400)]
[LV] Address post-commit NFC comments in interleave

Addressed most of post-commit comments in D154309.

16 months agoPrecommit follow-up testcase for interleaved miscompile
Anna Thomas [Fri, 14 Jul 2023 20:03:08 +0000 (16:03 -0400)]
Precommit follow-up testcase for interleaved miscompile

Follow-up testcase for PR63602.

Suggested by Ayal in D154309, more complete fix coming up which should
handle this testcase as well.

16 months ago[llvm-objdump] Move printDynamicRelocations into ELFDump.cpp. NFC
Fangrui Song [Fri, 14 Jul 2023 20:01:11 +0000 (13:01 -0700)]
[llvm-objdump] Move printDynamicRelocations into ELFDump.cpp. NFC

16 months ago[flang][openacc] Add extent when creating acc.bounds in genBaseBoundsOps
Valentin Clement [Fri, 14 Jul 2023 19:56:35 +0000 (12:56 -0700)]
[flang][openacc] Add extent when creating acc.bounds in genBaseBoundsOps

The extent information is available here so just add it to the acc.bounds
operation so it can be retrieved easily if needed.

Reviewed By: razvanlupusoru

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

16 months ago[ARM] Adjust strd/ldrd codegen alignment requirements
Maurice Heumann [Fri, 14 Jul 2023 18:58:56 +0000 (11:58 -0700)]
[ARM] Adjust strd/ldrd codegen alignment requirements

In change https://reviews.llvm.org/D152790, it was discovered that the
alignment requirement calculation for LDRD/STRD codegen was suboptimal
and the calculation for volatile loads and stores was adjusted.

This change here adopts the calculation for the remaining non-volatile
occurances.

Recommitting after undefined behavior fix in D155093.

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

16 months ago[DWARF] Fix undefined behaviour in dwarf type printer
Maurice Heumann [Fri, 14 Jul 2023 18:56:58 +0000 (11:56 -0700)]
[DWARF] Fix undefined behaviour in dwarf type printer

The value to be formatted here, Val, is an int64_t which cannot be
formatted using %x. This commit adjusts all misuses I was able to find
in the llvm-dwarfdump project.

Failing tests in https://reviews.llvm.org/D153800 lead to the discovery
and analysis of this issue.

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

16 months ago[llvm-objdump] Create ObjectFile specific dumpers
Fangrui Song [Fri, 14 Jul 2023 19:44:41 +0000 (12:44 -0700)]
[llvm-objdump] Create ObjectFile specific dumpers

We pay the one-off boilerplate overhead to create `*Dumper` classes that derive
from objdump::Dumper a la llvm-readobj. This has two primary advantages.

First, a lot object file format specific code can be moved from
llvm-objdump.cpp to *Dump.cpp files. Refactor `printPrivateHeaders` as
an example.

Second, with the introduction of ELFDumper<ELFT>, we can simplify
a few dispatch functions in ELFDump.cpp.

In addition, the ObjectFile specific dumpers contains a ObjectFile specific
reference so that we can remove a lot of `cast<*ObjectFile>(Obj)`.

Reviewed By: mtrofin

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

16 months ago[NFC][AMDGPU] Add automated tests in or.ll
Konstantina Mitropoulou [Fri, 14 Jul 2023 06:32:56 +0000 (23:32 -0700)]
[NFC][AMDGPU] Add automated tests in or.ll

Reviewed By: arsenm

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

16 months ago[clang][NFC] Remove trailing whitespace from riscv_vector.td
Nikolas Klauser [Fri, 14 Jul 2023 19:38:29 +0000 (12:38 -0700)]
[clang][NFC] Remove trailing whitespace from riscv_vector.td

16 months agoReapply [RISCV] Fold binary op into select if profitable.
Mikhail Gudim [Wed, 14 Jun 2023 21:30:50 +0000 (17:30 -0400)]
Reapply [RISCV] Fold binary op into select if profitable.

This fixes some bugs in the original commit:
  (1) Operands are passed in correct order when creating new constant
  and the binary operator. New tests were added to cover these cases.
  (2) Check was added to see if it is safe to commute the select and the binary operator.

Reviewed By: Craig Topper

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

16 months ago[CMake] Don't exclude llvm-debuginfod if httplib isn't available
Petr Hosek [Fri, 14 Jul 2023 18:39:43 +0000 (18:39 +0000)]
[CMake] Don't exclude llvm-debuginfod if httplib isn't available

This will result in a tool that's not usable, but it'll still link
correctly rather than failing with a CMake error. This matches what
we do for other tools that have dependencies such as llvm-mt.

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

16 months ago[llvm-mca][RISCV] Add RISCV-SEW instrument
Michael Maitland [Wed, 28 Jun 2023 23:05:30 +0000 (16:05 -0700)]
[llvm-mca][RISCV] Add RISCV-SEW instrument

Now that RISCV pseudo instructions now account for SEW in some cases,
it useful that RISCV SEW instruments exist so that llvm-mca can use
the SEW specific scheduler classes.

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

16 months ago[RISCV] Add SEW to RISCVInversePseudoTable
Michael Maitland [Thu, 29 Jun 2023 18:41:27 +0000 (11:41 -0700)]
[RISCV] Add SEW to RISCVInversePseudoTable

Now that scheduler resources are split by SEW for some instructions,
add the ability to map (BaseInstr, LMUL, SEW) -> Pseudo. For
BaseInstrs that are not split by SEW, 0 is the default key.

This does not change the size of the table since there was an 8
bit hole.

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

16 months ago[mlir][GPU] Initialize LLVM exactly once during GPU compiles
Krzysztof Drewniak [Tue, 11 Jul 2023 20:28:29 +0000 (20:28 +0000)]
[mlir][GPU] Initialize LLVM exactly once during GPU compiles

No matter how one constructs their SerializeTo* pass, we want to
ensure that the LLVM initialization code runs once and only once. This
commit adds a static once_flag to ensure that.

I've run into mysterious segfaults when calling MLIR GPU compiles from
multiple threads, and this commit is a potential fix for the issue.

Reviewed By: fmorac

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

16 months ago[mlir][sparse][gpu][nvidia] add pruning step and check to 2:4 matrix multiplication
Aart Bik [Fri, 14 Jul 2023 18:11:48 +0000 (11:11 -0700)]
[mlir][sparse][gpu][nvidia] add pruning step and check to 2:4 matrix multiplication

(1) without the check, the results may silently be wrong, so check is needed
(2) add pruning step to guarantee 2:4 property

Note, in the longer run, we may want to split out the pruning step somehow,
or make it optional.

Reviewed By: K-Wu

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

16 months ago[OpenMP] Build device runtimes for sm_87
Adrian Munera [Fri, 14 Jul 2023 18:48:25 +0000 (13:48 -0500)]
[OpenMP] Build device runtimes for sm_87

Summary:
These were missing from the list of all architectures.

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

16 months ago[PowerPC][Future] Enable __builtin_mma_xxm[t|f]acc
Kamau Bridgeman [Fri, 14 Jul 2023 18:05:32 +0000 (13:05 -0500)]
[PowerPC][Future] Enable __builtin_mma_xxm[t|f]acc

Future cpu instructions dmxxinstdmr512 and dmxxextfdmr512 insert and extract
quad vectors from the new wide accumulator(wacc) register class.
The introduction of these new instructions renders the p10 instructions
xxmtacc and xxmfacc obsolete since the new wacc register class is a better
choice for handing quad vector operations. This patch ensures that, for
future cpu, instructions dmxxinstdmr512 and dmxxextfdmr512 are generated
by custom lowering the intrinsics for xxm[t|f]acc to produce no instructions.

Reviewed By: amyk, lei

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

16 months ago[Debuginfod][unittest] Include llvm/Support/StringExtras.h
Caslyn Tonelli [Fri, 14 Jul 2023 18:37:46 +0000 (18:37 +0000)]
[Debuginfod][unittest] Include llvm/Support/StringExtras.h

Include the "llvm/ADT/StringExtras.h" in unittest to resolve a
"use of undeclared identifier 'utostr'" error that surfaces on mac-x64
builds after https://reviews.llvm.org/D155178.

Reviewed By: phosek

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

16 months ago[llvm-objcopy] Remove stray periods from usage text
Thomas Köppe [Fri, 14 Jul 2023 18:31:43 +0000 (11:31 -0700)]
[llvm-objcopy] Remove stray periods from usage text

The convention for TableGen help messages is to omit the period.

Reviewed By: MaskRay

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

16 months ago[OpenMP] Add documentation on using the `libc` in OpenMP
Joseph Huber [Fri, 14 Jul 2023 18:05:33 +0000 (13:05 -0500)]
[OpenMP] Add documentation on using the `libc` in OpenMP

This points users to the `libc` documentation and explains the basics of
how it's used inside the runtime.

Reviewed By: jdoerfert

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

16 months ago[X86] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D81833
Fangrui Song [Fri, 14 Jul 2023 18:27:53 +0000 (11:27 -0700)]
[X86] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D81833

16 months ago[RISCV] Support i32 clmul* intrinsics on RV64.
Craig Topper [Fri, 14 Jul 2023 18:20:03 +0000 (11:20 -0700)]
[RISCV] Support i32 clmul* intrinsics on RV64.

We can use an i64 clmul to emulate i32 clmul.
For clmulh and clmulr we need to zero extend the 32 bit input
to 64 bits then extract either bits [63:32] or [62:31].

Unfortunately, without Zba we need to use 2 shifts for the
zero extends. These can be optimized out later if the producing
instruction already zeroed the upper bits or if we can use lwu.

There are alternative sequences we can use for clmulh/clmulr
when the zero extend isn't free, but those are best handled by
a DAG combine to give the best opportunity for removing the extend.

This allows us to implement i32 clmul C intrinsics proposed in
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/44.

Reviewed By: asb

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

16 months ago[RISCV] Make __builtin_riscv_clz/ctz return an unsigned int instead of signed int.
Craig Topper [Fri, 14 Jul 2023 18:09:05 +0000 (11:09 -0700)]
[RISCV] Make __builtin_riscv_clz/ctz return an unsigned int instead of signed int.

This is different than the target independent __builtin_clz/ctz, but
logically makes more sense.

16 months ago[gn build] Port 20c6b9d451ca
LLVM GN Syncbot [Fri, 14 Jul 2023 18:01:24 +0000 (18:01 +0000)]
[gn build] Port 20c6b9d451ca

16 months ago[PowerPC] Add DFP test instruction definitions and MC tests
Kamau Bridgeman [Fri, 14 Jul 2023 14:01:43 +0000 (09:01 -0500)]
[PowerPC] Add DFP test instruction definitions and MC tests

Adding the td definitions, and their associated assembly and disassembly
test cases for the decimal floating point test instructions defined in
section 5.6.3 of ISA 3.1

Reviewed By: lei, amyk

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

16 months ago[libc++][mdspan] Implement default_accessor
Christian Trott [Fri, 14 Jul 2023 17:47:59 +0000 (11:47 -0600)]
[libc++][mdspan] Implement default_accessor

This commit implements default_accessor in support of C++23 mdspan
(https://wg21.link/p0009). default_accessor is the trivial accessor
using plain pointers and reference to element types.

Co-authored-by: Damien L-G <dalg24@gmail.com>
Differential Revision: https://reviews.llvm.org/D153935

16 months ago[ORC] Switch from strncpy to memcpy to silence more GCC warnings.
Lang Hames [Fri, 14 Jul 2023 17:37:47 +0000 (10:37 -0700)]
[ORC] Switch from strncpy to memcpy to silence more GCC warnings.

GCC warns when strncpy doesn't copy the null terminator. See discussion at
https://reviews.llvm.org/rG9d701c8a8d65.

16 months ago[lldb][NFCI] Remove unneeded temporary std::string allocations in SBAPI
Alex Langford [Wed, 12 Jul 2023 00:38:10 +0000 (17:38 -0700)]
[lldb][NFCI] Remove unneeded temporary std::string allocations in SBAPI

This uses some friend class trickery to avoid some unneeded temporary
std::string allocations.

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

16 months agoDisable GetOrCreateModuleWithCachedModule and GetOrCreateModuleWithCachedModuleAndSym...
Shubham Sandeep Rastogi [Fri, 14 Jul 2023 17:40:48 +0000 (13:40 -0400)]
Disable GetOrCreateModuleWithCachedModule and GetOrCreateModuleWithCachedModuleAndSymbol tests on arm64, because of test failures

16 months ago[lldb][Windows] Fix TestLocateModuleCallback
Kazuki Sakamoto [Wed, 12 Jul 2023 21:48:13 +0000 (14:48 -0700)]
[lldb][Windows] Fix TestLocateModuleCallback

D153735 added the tests but it is failing due to POSIX path vs Windows path.
https://lab.llvm.org/buildbot/#/builders/219/builds/4084

Fix it.
- MODULE_PLATFORM_PATH is POSIX path.
- Normalize self.input_dir, FileSpec and SymbolFileSpec fullpath.

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

16 months ago[RISCV] Cleanups in CORE-V (xcv) extensions
Simon Cook [Fri, 14 Jul 2023 17:21:08 +0000 (18:21 +0100)]
[RISCV] Cleanups in CORE-V (xcv) extensions

This is a mostly NFC change cleaning up and clarifying components of the
in-tree CORE-V (xcv*) extensions following discussions on the remaining
extensions.

This makes the following changes to the xcbitmanip and xcvmac support:

1. Add missing extensions from RISCVISAInfo, such that they can be
   supported in clang's -march option.
2. Clarify the extension version number is 1.0.0 in documentation.
3. Clarify the extensions are by OpenHW Group, and the capitilization
   of the CORE-V extension family.
4. Add CORE-V to extension name in RISCVFeatures, both to be consistent
   with other vendors, and also better distinguish e.g. CORE-V bit
   manipulation vs RISC-V's standard Zb extensions.

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

16 months ago[RISCV] Add support for custom CSRs for Sifive S76.
Garvit Gupta [Fri, 14 Jul 2023 16:51:15 +0000 (09:51 -0700)]
[RISCV] Add support for custom CSRs for Sifive S76.

Support for below CSRs is addeed -
1. Branch Prediction Mode CSR
2. Feature Disable CSR
3. Power Dial CSR
4. RNMI CSRs

spec:https://sifive.cdn.prismic.io/sifive/767804da-53b2-4893-97d5-b7c030ae0a94_s76mc_core_complex_manual_21G3.pdf

This patch removes AltName field from SysReg class because we are now using
separate class for custom vendor CSRs. Also, all use of AltName have been changed
to DeprecatedName because both were interchangeably used for old names which are
not in use in latest RISCV spec.

Reviewed By: craig.topper

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

16 months agoubsan: disable sigaction test for aarch64
Dmitry Vyukov [Fri, 14 Jul 2023 16:35:52 +0000 (16:35 +0000)]
ubsan: disable sigaction test for aarch64

The test seems to segfault on aarch64 with tsan:
https://lab.llvm.org/buildbot/#/builders/179/builds/6662
Reason unknown, needs debugging.

Reviewed By: melver, Caslyn

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

16 months agoRevert "[InstSimplify] Make simplifyWithOpReplaced() recursive (PR63104)"
Nikita Popov [Fri, 14 Jul 2023 16:32:34 +0000 (18:32 +0200)]
Revert "[InstSimplify] Make simplifyWithOpReplaced() recursive (PR63104)"

This is very likely the cause of a stage 2 failure in
Transforms/LoopVectorize/check-prof-info.ll. Revert until I can
investigate this.

This reverts commit 3d199d086e076f0b9b90d4c59f2226a417a639b5.

16 months ago[clang][Sema] Add fixit for scoped enum format error
Alex Brachet [Fri, 14 Jul 2023 16:23:22 +0000 (16:23 +0000)]
[clang][Sema] Add fixit for scoped enum format error

This helps transition code bases to handle the new warning added in 3632e2f5179

Before:
```
clang/test/FixIt/format.cpp:10:16: warning: format specifies type 'int' but the argument has type 'N::E' [-Wformat]
   10 |   printf("%d", N::E::One); // expected-warning{{format specifies type 'int' but the argument has type 'N::E'}}
      |           ~~   ^~~~~~~~~
      |           %d
```
After:
```
clang/test/FixIt/format.cpp:10:16: warning: format specifies type 'int' but the argument has type 'N::E' [-Wformat]
   10 |   printf("%d", N::E::One); // expected-warning{{format specifies type 'int' but the argument has type 'N::E'}}
      |           ~~   ^~~~~~~~~
      |                static_cast<int>( )
```

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

16 months ago[clang][Sema] Suggest static_cast in C++ code
Alex Brachet [Fri, 14 Jul 2023 16:22:06 +0000 (16:22 +0000)]
[clang][Sema] Suggest static_cast in C++ code

This patch changes the -Wformat diagnostic to suggest static_cast over
a C-style cast for {,Objective}C++ when recommending the argument be
casted rather than changing the format string.

Before:
```
clang/test/FixIt/format.mm:11:16: warning: format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'wchar_t' [-Wformat]
   11 |   NSLog(@"%C", wchar_data);  // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'wchar_t'}}
      |           ~~   ^~~~~~~~~~
      |                (unsigned short)
```
After:
```
clang/test/FixIt/format.mm:11:16: warning: format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'wchar_t' [-Wformat]
   11 |   NSLog(@"%C", wchar_data);  // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'wchar_t'}}
      |           ~~   ^~~~~~~~~~
      |                static_cast<unsigned short>( )
```

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

16 months ago[PowerPC] Add DFP format instructions definitions and MC tests
Lei Huang [Tue, 4 Jul 2023 21:41:48 +0000 (17:41 -0400)]
[PowerPC] Add DFP format instructions definitions and MC tests

Add td definitions and asm/disasm tests for the dfp format
instructions in ISA 3.1 section 5.6.6

Reviewed By: stefanp, kamaub

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

16 months ago[AArch64] Mark some operands as OPERAND_IMMEDIATE.
David Green [Fri, 14 Jul 2023 15:58:51 +0000 (16:58 +0100)]
[AArch64] Mark some operands as OPERAND_IMMEDIATE.

This allows llvm-exegesis to generate them as constants.

16 months ago[libc++][NFC] Update emojis in the buildkite pipeline
Nikolas Klauser [Fri, 14 Jul 2023 15:19:56 +0000 (08:19 -0700)]
[libc++][NFC] Update emojis in the buildkite pipeline

16 months agoRevert "Revert "[lldb][LocateModuleCallback] Fix LocateModuleCallbackTest""
Shubham Sandeep Rastogi [Fri, 14 Jul 2023 15:18:53 +0000 (11:18 -0400)]
Revert "Revert "[lldb][LocateModuleCallback] Fix LocateModuleCallbackTest""

This reverts commit 668a3efd42e7fea19a0d331f73345f2ac13cdf4f.

Reverting because of build errors:

In file included from /Users/buildslave/jenkins/workspace/as-lldb-cmake/llvm-project/lldb/source/API/SBPlatform.cpp:19:
/Users/buildslave/jenkins/workspace/as-lldb-cmake/llvm-project/lldb/include/lldb/Target/Target.h:1035:18: warning: parameter 'merged' not found in the function declaration [-Wdocumentation]

16 months agoRevert "Revert "[lldb][LocateModuleCallback] Call locate module callback""
Shubham Sandeep Rastogi [Fri, 14 Jul 2023 15:18:03 +0000 (11:18 -0400)]
Revert "Revert "[lldb][LocateModuleCallback] Call locate module callback""

This reverts commit df054499c35cdda02b196b2ca5c0a326abdc0a29.

Reverting because of build errors

In file included from /Users/buildslave/jenkins/workspace/as-lldb-cmake/llvm-project/lldb/source/API/SBPlatform.cpp:19:
/Users/buildslave/jenkins/workspace/as-lldb-cmake/llvm-project/lldb/include/lldb/Target/Target.h:1035:18: warning: parameter 'merged' not found in the function declaration [-Wdocumentation]

16 months ago[X86][FPEnv] Lowering of {get,set,reset}_fpenv
Serge Pavlov [Fri, 14 Jul 2023 15:10:53 +0000 (22:10 +0700)]
[X86][FPEnv] Lowering of {get,set,reset}_fpenv

The change implements lowering of `get_fpenv`, `set_fpenv` and
`reset_fpenv`.

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

16 months agoPrecommit tests on lowering *_fpenv on X86
Serge Pavlov [Fri, 12 May 2023 11:12:14 +0000 (18:12 +0700)]
Precommit tests on lowering *_fpenv on X86

16 months ago[mlir][bufferization] Add `buffer_loop_hoisting` transform op
Matthias Springer [Fri, 14 Jul 2023 13:47:06 +0000 (15:47 +0200)]
[mlir][bufferization] Add `buffer_loop_hoisting` transform op

This op hoists buffer allocation from loops.

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

16 months ago[SystemZ] Use named MI sub-operands
Ilya Leoshkevich [Fri, 14 Jul 2023 15:04:45 +0000 (17:04 +0200)]
[SystemZ] Use named MI sub-operands

Prepare for removing the MemOpsEmitted workaround for symbolic
displacements by letting TableGen know about the offsets of the
displacement sub-operands within the instruction.

There are alternative ways to do this that were tried and rejected:

- Creating encoders and decoders for each possible displacement offset.
  This is too repetitive.

- Use VarLenCodeEmitter [1]. The resulting diff is quite large.

Instead, use the named sub-operand support introduced by commit
a538d1f13a13 ("[TableGen][CodeEmitterGen] Allow local names for
sub-operands in a operand list.").

Describe instruction encodings in terms of sub-operands instead of
operands (e.g. B, D, L vs BDL) - this also better matches the pictures
from the Principles of Operation. Decompose operands into sub-operands
using the new (bdaddr12only $B1, $D1):$BD1 syntax. Replace the
encoders and the decoders of the operands with these of the
sub-operands.

Since DecodeADDR64BitRegisterClass() is now used for bases and indices,
change it to return NoRegister when decoding 0. This also changes the
disassembly of some instructions, e.g., br %r0 becomes br 0. Since this
better captures the instruction semantics, namely, that the value of
%r0 is not used, keep this change and update the tests.

[1] https://m680x0.github.io/blog/2022/02/varlen-encoder.html

Reviewed By: uweigand

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

16 months agoRevert "[lldb][LocateModuleCallback] Call locate module callback"
Shubham Sandeep Rastogi [Fri, 14 Jul 2023 15:03:54 +0000 (11:03 -0400)]
Revert "[lldb][LocateModuleCallback] Call locate module callback"

This reverts commit 7f1028e9df52b4e7246f189a24684b1ca8c9bfbe.

This is because test failures

lldb-unit.Target/_/TargetTests/LocateModuleCallbackTest.GetOrCreateModuleWithCachedModule
lldb-unit.Target/_/TargetTests/LocateModuleCallbackTest.GetOrCreateModuleWithCachedModuleAndBreakpadSymbol

16 months agoRevert "[lldb][LocateModuleCallback] Fix LocateModuleCallbackTest"
Shubham Sandeep Rastogi [Fri, 14 Jul 2023 15:03:02 +0000 (11:03 -0400)]
Revert "[lldb][LocateModuleCallback] Fix LocateModuleCallbackTest"

This reverts commit fb087c17c82309404fe0ebf3505c186642a719f7.

This is because of test failures:

lldb-unit.Target/_/TargetTests/LocateModuleCallbackTest.GetOrCreateModuleWithCachedModule
lldb-unit.Target/_/TargetTests/LocateModuleCallbackTest.GetOrCreateModuleWithCachedModuleAndBreakpadSymbol

16 months ago[mlir] Add an IntNEQValue predicate
Nicolas Vasilache [Fri, 14 Jul 2023 14:56:50 +0000 (16:56 +0200)]
[mlir] Add an IntNEQValue predicate

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

16 months ago[mlir] NFC - Basic improvements to IndexingUtils (product and sum)
Nicolas Vasilache [Fri, 14 Jul 2023 14:35:06 +0000 (16:35 +0200)]
[mlir] NFC - Basic improvements to IndexingUtils (product and sum)

16 months ago[InstSimplify] Make simplifyWithOpReplaced() recursive (PR63104)
Nikita Popov [Thu, 13 Jul 2023 15:25:18 +0000 (17:25 +0200)]
[InstSimplify] Make simplifyWithOpReplaced() recursive (PR63104)

Support replacement of operands not only in the immediate
instruction, but also instructions it uses.

To the most part, this extension is straightforward, but there are
two bits worth highlighting:

First, we can now no longer assume that if the Op is a vector, the
instruction also returns a vector. If Op is a vector and the
instruction returns a scalar, we should consider it as a cross-lane
operation.

Second, for the x ^ x special case, we can no longer assume that
the operand is RepOp, as we might have a replacement higher up the
instruction chain.

There is one optimization regression, but it is in a fuzzer-generated
test case.

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

16 months agoRevert "[mlir][memref] NFC - Move utility function declaration from IR/MemRef.h to...
Nicolas Vasilache [Fri, 14 Jul 2023 14:31:00 +0000 (16:31 +0200)]
Revert "[mlir][memref] NFC - Move utility function declaration from IR/MemRef.h to Utils/MemRefUtils.h"

This reverts commit 8b161e977298ea8207ae4bdcee8483ce47601f31.

This creates cyclic dependencies that cannot be easily untangled for now.

16 months ago[InstCombine] Regenerate AMDGPU test checks
Jay Foad [Fri, 14 Jul 2023 14:20:22 +0000 (15:20 +0100)]
[InstCombine] Regenerate AMDGPU test checks