platform/upstream/llvm.git
15 months agoFix warnings
Kazu Hirata [Fri, 24 Mar 2023 16:52:17 +0000 (09:52 -0700)]
Fix warnings

This patch fixes:

  clang/lib/Driver/ToolChains/OHOS.cpp:410:18: warning: unused
  variable ‘A’ [-Wunused-variable]

  clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp:293:15:
  warning: unused variable ‘II’ [-Wunused-variable]

  llvm/lib/ProfileData/RawMemProfReader.cpp:364:68: warning: suggest
  parentheses around ‘&&’ within ‘||’ [-Wparentheses]

15 months agoMake test more explicit on failure.
Doru Bercea [Fri, 24 Mar 2023 14:18:27 +0000 (10:18 -0400)]
Make test more explicit on failure.

Patch: https://reviews.llvm.org/D146812

15 months ago[support] Attempt to fix PrintNumber test for Solaris
Paul Kirth [Fri, 24 Mar 2023 16:02:49 +0000 (16:02 +0000)]
[support] Attempt to fix PrintNumber test for Solaris

NaN and Inf are still causing some problems in a formatting test.
This patch makes the checked format string exactly match the internal
JSON format string. If there are still problems, we should disable
testing Inf and NaN values until we can come to a portable solution.

Reviewed By: abhina.sreeskantharajan

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

15 months ago[extract_symbols.py] Export unique symbols
Tomas Matheson [Thu, 23 Mar 2023 15:18:34 +0000 (15:18 +0000)]
[extract_symbols.py] Export unique symbols

As described in a comment on D140637, PluginInlineOrderTest.NoInlineFoo
will fail with:

InlineOrderPlugin.so: undefined symbol: _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE

The symbol is unique in libLLVMCore and ends up local in AnalysisTests.
Fix this by exporting all unique symbols found in libraries.

AnalysisTests.symbols change in line count: 12464 -> 12499

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

15 months ago[mlir][linalg] Use affine apply in im2col gather index calculations
Quinn Dawkins [Fri, 24 Mar 2023 15:44:51 +0000 (11:44 -0400)]
[mlir][linalg] Use affine apply in im2col gather index calculations

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

15 months ago[libc] Update bazel build rules for 9c8bdbcbc502fac7d7d8da5c848cec448daf26ae
Augie Fackler [Fri, 24 Mar 2023 15:34:58 +0000 (11:34 -0400)]
[libc] Update bazel build rules for 9c8bdbcbc502fac7d7d8da5c848cec448daf26ae

15 months ago[AMDGPU] Add clang builtin for __builtin_amdgcn_ds_atomic_fadd_v2f16
Mariusz Sikora [Fri, 10 Mar 2023 07:50:16 +0000 (08:50 +0100)]
[AMDGPU] Add clang builtin for __builtin_amdgcn_ds_atomic_fadd_v2f16

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

15 months ago[LICM] Require MSSA in SinkAndHoistLICMFlags (NFC)
Nikita Popov [Fri, 24 Mar 2023 15:08:37 +0000 (16:08 +0100)]
[LICM] Require MSSA in SinkAndHoistLICMFlags (NFC)

Nowadays MSSA is required for LICM/LoopSink, so drop the checks
for whether its available or not.

15 months ago[sanitizer][win] Change cmdline check to allow double backslashs
Alvin Wong [Wed, 22 Mar 2023 10:14:40 +0000 (18:14 +0800)]
[sanitizer][win] Change cmdline check to allow double backslashs

When `llvm-symbolizer.exe` is on the PATH in an entry containing two
consecutive backslashes, sanitizers will try to launch llvm-symbolizer
with its absolute path containing these consecutive backslashes. This
fails a sanity check in `sanitizer_symbolizer_win.cpp`.

According to the documentation of `CommandLineToArgvW` [1] and a MS blog
post [2], backslashes in general, regardless of how many of them in a
row, do not have any special effect, unless when immediately followed by
a double quote.

There already exists a check that fails when the command line arguments
contains double quote, therefore the check for double backslashes can
simply be removed.

[1]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw
[2]: https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way

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

15 months ago[LoongArch] Add Scalar link component
Xiaodong Liu [Fri, 24 Mar 2023 14:57:22 +0000 (09:57 -0500)]
[LoongArch] Add Scalar link component

Fix the lld link error on ppc64le builders:
```
ld.lld: error: undefined symbol: llvm::createLoopDataPrefetchPass()
>>> referenced by LoongArchTargetMachine.cpp
>>>               lib/Target/LoongArch/CMakeFiles/LLVMLoongArchCodeGen.dir/LoongArchTargetMachine.cpp.o:((anonymous namespace)::LoongArchPassConfig::addIRPasses())
collect2: error: ld returned 1 exit status`
```

Reviewed By: sdesmalen

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

15 months ago[SelectionDAG] Correctly reduce BV to shuffle with zero on big endian
Nemanja Ivanovic [Fri, 24 Mar 2023 14:34:25 +0000 (10:34 -0400)]
[SelectionDAG] Correctly reduce BV to shuffle with zero on big endian

This DAG combine is correct on little endian targets but
is incorrect on big endian targets.
Add big endian code to correct it.

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

15 months ago[libc] Change RPC outbox stores to be relaxed
Joseph Huber [Fri, 24 Mar 2023 14:37:28 +0000 (09:37 -0500)]
[libc] Change RPC outbox stores to be relaxed

Summary:
These stored previously used `RELEASE`. This was done originally to
ensure that the stores to the shared memory buffer were flushed prior to
signaling that the other side can begin accessing it. However, this
should be accomplished by the memory fence above the store. This change
is required because NVPTX does not support non-relaxed atomics used on
unified shared memory.

15 months ago[AArch64][SME] SelectSMETileSlice should also match to 'reg+0' when slice is ADD...
Sander de Smalen [Wed, 22 Mar 2023 16:54:00 +0000 (16:54 +0000)]
[AArch64][SME] SelectSMETileSlice should also match to 'reg+0' when slice is ADD with non-constant RHS.

It would decompose an address into a `reg + 0` when the slice was not an ADD,
but when the RHS of the ADD was not a constant, it would simply not match.

This patch fixes that, by always resolving to a `reg + 0` slice.

15 months ago[clang] Extend pragma dump to support expressions
Vlad Serebrennikov [Fri, 24 Mar 2023 14:14:11 +0000 (17:14 +0300)]
[clang] Extend pragma dump to support expressions

Extend `#pragma clang __debug dump` to support not only single identifier, but an expression as well. This makes it possible to test ADL and overload resolution directly, without being creative to make them observable via diagnostics (e.g. when [[ http://eel.is/c++draft/over.match.best | over.match.best ]] is involved). This implementation has a known limitation of not supporting dependent expressions properly, but it's quite useful even without such support.

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

15 months ago[LICM] Add tests for GEP reassociation (NFC)
Nikita Popov [Fri, 24 Mar 2023 14:24:21 +0000 (15:24 +0100)]
[LICM] Add tests for GEP reassociation (NFC)

15 months ago[Test] Regenerate test checks for some LSR tests (NFC)
Dmitry Makogon [Fri, 24 Mar 2023 13:34:55 +0000 (20:34 +0700)]
[Test] Regenerate test checks for some LSR tests (NFC)

15 months ago[Test] Add test to check that LCSSA is preserved by LSR (NFC)
Dmitry Makogon [Fri, 24 Mar 2023 12:02:25 +0000 (19:02 +0700)]
[Test] Add test to check that LCSSA is preserved by LSR (NFC)

Currently it fails as LSR doesn't preserve LCSSA in some cases.

15 months ago[mlir][Vector][Transforms] Improve the control over individual vector lowerings and...
Nicolas Vasilache [Fri, 24 Mar 2023 12:09:50 +0000 (12:09 +0000)]
[mlir][Vector][Transforms] Improve the control over individual vector lowerings and transforms

This revision adds vector transform operations that allow us to better inspect the composition
of various lowerings that were previously very opaque.

This commit is NFC in that it does not change patterns beyond adding `rewriter.notifyFailure` messages
and it does not change the tests beyond breaking them into pieces and using transforms instead of
throwaway opaque test passes.

Reviewed By: ftynse, springerm

Co-authored-by: Alex Zinenko <zinenko@google.com>
Differential Revision: https://reviews.llvm.org/D146755

15 months ago[SimplifyCFG] Don't merge invoke if this makes immarg non-constant (PR61265)
Nikita Popov [Thu, 23 Mar 2023 14:23:31 +0000 (15:23 +0100)]
[SimplifyCFG] Don't merge invoke if this makes immarg non-constant (PR61265)

Don't merge invokes if this replaces constant operands with phis
in a place where this is not legal.

This also disallows converting operand bundles from constant to
non-constant, in line with the restriction we use in other
transforms.

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

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

15 months ago[flang][Driver] Fix lto-flags.f90 on Solaris
Rainer Orth [Fri, 24 Mar 2023 13:24:07 +0000 (14:24 +0100)]
[flang][Driver] Fix lto-flags.f90 on Solaris

The `Flang :: Driver/lto-flags.f90` test `FAIL`s on Solaris:

  /vol/llvm/src/llvm-project/dist/flang/test/Driver/lto-flags.f90:30:13: error: THIN-LTO: expected string not found in input
  ! THIN-LTO: "-plugin-opt=thinlto"
              ^

This is no wonder since the native Solaris `ld` doesn't support the linker
plugin interface at all, so this patch marks the test as `UNSUPPORTED`.

Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.

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

15 months ago[GlobalOpt] Fix dead const handling in pointer root user cleanup (PR61674)
Nikita Popov [Fri, 24 Mar 2023 13:17:26 +0000 (14:17 +0100)]
[GlobalOpt] Fix dead const handling in pointer root user cleanup (PR61674)

Rather than cleanup up dead constant expressions as we go along,
do this once at the end. This aligns it with the
CleanupConstantGlobalUsers() implementation and avoids
any invalidation issues.

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

15 months ago[AggressiveInstCombine] use m_Deferred on funnel shift(NFC)
khei4 [Fri, 24 Mar 2023 10:21:25 +0000 (19:21 +0900)]
[AggressiveInstCombine] use m_Deferred on funnel shift(NFC)
Differential Revision: https://reviews.llvm.org/D146798
Reviewed By: nikic

15 months ago[AMDGPU] Create Subtarget Features for some of 16 bits atomic fadd instructions
Mariusz Sikora [Thu, 9 Mar 2023 10:29:33 +0000 (11:29 +0100)]
[AMDGPU] Create Subtarget Features for some of 16 bits atomic fadd instructions

Introducing Subtarget Features for instructions:
- ds_pk_add_bf16
- ds_pk_add_f16
- ds_pk_add_rtn_bf16
- ds_pk_add_rtn_f16
- flat_atomic_pk_add_f16
- flat_atomic_pk_add_bf16
- global_atomic_pk_add_f16
- global_atomic_pk_add_bf16
- buffer_atomic_pk_add_f16

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

15 months ago[gn] somewhat port 0c5cee779929 (lldb-server platform plugin)
Nico Weber [Fri, 24 Mar 2023 12:06:37 +0000 (13:06 +0100)]
[gn] somewhat port 0c5cee779929 (lldb-server platform plugin)

15 months ago[Local] Check for null VH in RecursivelyDeleteTriviallyDeadInstructionsPermissive()
Nikita Popov [Fri, 24 Mar 2023 11:55:02 +0000 (12:55 +0100)]
[Local] Check for null VH in RecursivelyDeleteTriviallyDeadInstructionsPermissive()

Peculiarly, the non-permissive variant handled this gracefully,
but the permissive one did not.

15 months ago[Test] Use autogenerated checks in uglygep.ll test for LSR (NFC)
Dmitry Makogon [Fri, 24 Mar 2023 11:22:47 +0000 (18:22 +0700)]
[Test] Use autogenerated checks in uglygep.ll test for LSR (NFC)

15 months agoFix Clang sphinx build
Aaron Ballman [Fri, 24 Mar 2023 11:27:07 +0000 (07:27 -0400)]
Fix Clang sphinx build

This addresses the issues found in:
https://lab.llvm.org/buildbot/#/builders/92/builds/41772

15 months ago[Flang][OpenMP] Add TODO message for common block privatisation
Kiran Chandramohan [Fri, 24 Mar 2023 11:02:18 +0000 (11:02 +0000)]
[Flang][OpenMP] Add TODO message for common block privatisation

This is a temporary message until the feature is implemented and
merged.

Note: There is a proposed patch (https://reviews.llvm.org/D127215)

Reviewed By: peixin

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

15 months ago[JITLink] Fix MSVC build error: fully qualify llvm::object::ELFFile
Stefan Gränitz [Fri, 24 Mar 2023 11:01:52 +0000 (12:01 +0100)]
[JITLink] Fix MSVC build error: fully qualify llvm::object::ELFFile

15 months ago[OpenCL] Emit EOL at end of generated header
Sven van Haastregt [Fri, 24 Mar 2023 11:03:10 +0000 (11:03 +0000)]
[OpenCL] Emit EOL at end of generated header

15 months ago[include-cleaner] Attribute references to explicit specializations
Kadir Cetinkaya [Thu, 23 Mar 2023 16:36:54 +0000 (17:36 +0100)]
[include-cleaner] Attribute references to explicit specializations

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

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

15 months ago[compiler-rt] Fix signed integer overflow in int_mulo_impl.inc
Karl-Johan Karlsson [Fri, 24 Mar 2023 09:33:46 +0000 (10:33 +0100)]
[compiler-rt] Fix signed integer overflow in int_mulo_impl.inc

When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warning:

UBSan:/repo/uabkaka/llvm-project/compiler-rt/lib/builtins/int_mulo_impl.inc:24:23: signed integer overflow: -1 * -2147483648 cannot be represented in type 'si_int' (aka 'long')

This can be avoided by doing the multiplication in a matching unsigned variant
of the type.

This was found in an out of tree target.

Reviewed By: phosek

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

15 months ago[AVR] Do not emit 'LPM Rd, Z' on devices without FeatureLPMX
Ben Shi [Mon, 9 Jan 2023 04:05:00 +0000 (12:05 +0800)]
[AVR] Do not emit 'LPM Rd, Z' on devices without FeatureLPMX

The 'LPM' instruction has three forms:

------------------------
| form       | feature |
| ---------- | --------|
| LPM        | hasLPM  |
| LPM Rd, Z  | hasLPMX |
| LPM Rd, Z+ | hasLPMX |
------------------------

The second form is always selected in ISelDAGToDAG, even on devices
without FeatureLPMX. This patch emits "LPM + MOV" on devices with
only FeatureLPM.

Reviewed By: jacquesguan

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

15 months ago[NFC][LoopVectorize] Change trip counts for some tests to guarantee a scalar tail
David Sherwood [Thu, 16 Mar 2023 11:39:00 +0000 (11:39 +0000)]
[NFC][LoopVectorize] Change trip counts for some tests to guarantee a scalar tail

Quite a few vectoriser tests were using a trip count of 1024,
which meant:

1. For fixed-length VFs we would never actually tail-fold, e.g.
see Transforms/LoopVectorize/RISCV/uniform-load-store.ll. This
is because we can prove at compile-time there will never be a
scalar tail.
2. As of D146199 the same optimisation mentioned above will also
apply to scalable VFs too.

I've changed all such trip counts to be 1025 instead.

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

15 months ago[NFC] Fix auto usage to avoid copies
Akshay Khadse [Fri, 24 Mar 2023 09:14:30 +0000 (17:14 +0800)]
[NFC] Fix auto usage to avoid copies

Fixes some usages of the "auto" keyword to avoid creation of copies.

Reviewed By: LuoYuanke

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

15 months ago[clang-format] NFC Format.h and ClangFormatStyleOptions.rst are out of date
mydeveloperday [Fri, 24 Mar 2023 09:27:23 +0000 (09:27 +0000)]
[clang-format] NFC Format.h and ClangFormatStyleOptions.rst are out of date

Regenerate the style documentation, requires some minor sphinx changes to avoid warnings

Reviewed By: klimek

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

15 months agoReland "[JITLink] Initial AArch32 backend"
Stefan Gränitz [Thu, 23 Mar 2023 10:10:39 +0000 (11:10 +0100)]
Reland "[JITLink] Initial AArch32 backend"

This first version lays the foundations for AArch32 support in JITLink. ELFLinkGraphBuilder_aarch32 processes REL-type relocations and populates LinkGraphs from ELF object files for both big- and little-endian systems. The ArmCfg member controls subarchitecture-specific details throughout the linking process (i.e. it's passed to ELFJITLinker_aarch32).

Relocation types follow the ABI documentation's division into classes: Data (endian-sensitive), Arm (32-bit little-endian) and Thumb (2x 16-bit little-endian, "Thumb32" in the docs). The implementation of instruction encoding/decoding for relocation resolution is implemented symmetrically and is testable in isolation (see AArch32 category in JITLinkTests).

Callable Thumb functions are marked with a ThumbSymbol target-flag and stored in the LinkGraph with their real addresses. The thumb-bit is added back in when the owning JITDylib requests the address for such a symbol.

The StubsManager can generate (absolute) Thumb-state stubs for branch range extensions on v7+ targets. Proper GOT/PLT handling is not yet implemented.

This patch is based on the backend implementation in ez-clang and has just enough functionality to model the infrastructure and link a Thumb function `main()` that calls `printf()` to dump "Hello Arm!" on Armv7a. It was tested on Raspberry Pi with 32-bit Raspbian OS.

Reviewed By: lhames

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

15 months ago[RISCV] Add test for shuffles that could be done as vmerges
Luke Lau [Thu, 23 Mar 2023 10:59:59 +0000 (10:59 +0000)]
[RISCV] Add test for shuffles that could be done as vmerges

Reviewed By: reames

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

15 months ago[mlir][arith] Extend the `floordivsi` converter
Andrzej Warzynski [Thu, 23 Mar 2023 17:39:48 +0000 (17:39 +0000)]
[mlir][arith] Extend the `floordivsi` converter

This patch extends the `createConst` method so that it can generate
constant vectors (it can already generate scalars). This change is
required to be able to apply the converter for `arith.floordivsi`
(i.e. `FloorDivSIOpConverter`) to vectors.

While `arith.floordivsi` is my main motivation for this change, this
patch should also allow other Arith ops to be converted in vector cases.
In my example, the Linalg vectorizer updates `arith.floordivsi` to
operate on vectors and hence the need for this change.

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

15 months ago[NFC] Regenerate test of InstCombine/load-combine-metadata-dominance.ll
luxufan [Fri, 24 Mar 2023 08:35:56 +0000 (16:35 +0800)]
[NFC] Regenerate test of InstCombine/load-combine-metadata-dominance.ll

15 months ago[Test] Regenerate checks in test file
Max Kazantsev [Fri, 24 Mar 2023 08:42:23 +0000 (15:42 +0700)]
[Test] Regenerate checks in test file

15 months ago[CMake] Respect variables for specifying host tools even without LLVM_USE_HOST_TOOLS set
Martin Storsjö [Wed, 22 Mar 2023 22:44:18 +0000 (00:44 +0200)]
[CMake] Respect variables for specifying host tools even without LLVM_USE_HOST_TOOLS set

When LLVM_NATIVE_TOOL_DIR was introduced in
d3da9067d143f3d4ce59b6d9ab4606a8ef1dc937 / D131052, it consisted
of refactoring a couple cases of manual logic for tools in
clang-tools-extra/clang-tidy, clang-tools-extra/pseudo/include
and mlir/tools/mlir-linalg-ods-gen. The former two had the same
consistent behaviour while the latter was slightly different, so
the refactoring would end up slightly adjusting one or the other.

The difference was that the clang-tools-extra tools respected the
external variable for setting the tool name, regardless of the
LLVM_USE_HOST_TOOLS variable, while mlir-linalg-ods-gen tool
only checked its external variable if LLVM_USE_HOST_TOOLS was set.

LLVM_USE_HOST_TOOLS is supposed to be enabled automatically whenever
cross compiling, so this shouldn't have been an issue.

In https://github.com/llvm/llvm-project/issues/60784, it seems like
some users do cross compile LLVM, without CMake knowing about it
(without CMAKE_CROSSCOMPILING being set). In these cases, their
build broke, as the variables for pointing to external host tools
no longer were being respected.

The fact that CMAKE_CROSSCOMPILING wasn't set stems from a
non-obvious behaviour of CMake; CMAKE_CROSSCOMPILING isn't supposed
to be set by the user (and if it was, it gets overridden), but one
has to set CMAKE_SYSTEM_NAME to indicate that one is cross compiling,
even if the target OS is the same as the current host.

Skip the checks for LLVM_USE_HOST_TOOLS and always respect the
variables for pointing to external tools (both the old tool specific
variables, and the new LLVM_NATIVE_TOOL_DIR), if they're set. This
makes the logic within setup_host_tool more exactly match the
logic for the clang-tools-extra tools from before the refactoring
in d3da9067d143f3d4ce59b6d9ab4606a8ef1dc937. This makes the behaviour
consistent with that of the tablegen executables, which also respect
the externally set variables regardless of LLVM_USE_HOST_TOOLS.

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

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

15 months ago[MLIR][LLVM] Add debug output to the LLVM inliner.
Johannes de Fine Licht [Fri, 24 Mar 2023 08:27:27 +0000 (09:27 +0100)]
[MLIR][LLVM] Add debug output to the LLVM inliner.

This revealed a test case that wasn't hitting the intended branch
because the inlinees had no function definition.

Depends on D146628

Reviewed By: gysit

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

15 months ago[LLD] [test] Add a missing REQUIRES: x86 in a new test
Martin Storsjö [Fri, 24 Mar 2023 08:23:50 +0000 (10:23 +0200)]
[LLD] [test] Add a missing REQUIRES: x86 in a new test

This test somewhat unconventionally assembles both aarch64 and
x86 object files.

This fixes test failures in build configurations with the aarch64
target enabled but x86 target disabled.

15 months ago[NFC] Regenerate test NewGVN/metadata-nonnull.ll
luxufan [Fri, 24 Mar 2023 08:26:32 +0000 (16:26 +0800)]
[NFC] Regenerate test NewGVN/metadata-nonnull.ll

15 months agoRevert "Recommit [Modules] Remove unnecessary check when generating name lookup table...
Dmitry Chernenkov [Thu, 23 Mar 2023 16:20:42 +0000 (16:20 +0000)]
Revert "Recommit [Modules] Remove unnecessary check when generating name lookup table in ASTWriter"

This reverts commit 25557aa38a0dab76f5b7a4518942f69d879693c0.

15 months ago[mlir][llvm] Switch remaining LLVM dialect tests to opaque pointers.
Tobias Gysi [Fri, 24 Mar 2023 06:57:24 +0000 (07:57 +0100)]
[mlir][llvm] Switch remaining LLVM dialect tests to opaque pointers.

The revision switches the remaining LLVM dialect tests to use opaque
pointers. Selected tests are copied to a postfixed test file for the
time being.

A number of tests disappear once we fully switch to opaque pointers.
In particular, all tests that check verify a pointer element type
matches another type as well as tests of recursive types.

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

Reviewed By: Dinistro, zero9178

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

15 months ago[clang-tidy][NFC] Improve naming convention in google-readability-avoid-underscore...
Carlos Galvez [Thu, 23 Mar 2023 12:16:40 +0000 (12:16 +0000)]
[clang-tidy][NFC] Improve naming convention in google-readability-avoid-underscore-in-googletest-name

According to the Google docs, the convention is
TEST(TestSuiteName, TestName). Apply that convention to the
source code, test and documentation of the check.

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

15 months ago[Driver] Change multilib selection algorithm
Michael Platings [Tue, 14 Mar 2023 19:40:58 +0000 (19:40 +0000)]
[Driver] Change multilib selection algorithm

The new algorithm is:
1. Find all multilibs with flags that are a subset of the requested
   flags.
2. If more than one multilib matches, choose the last.

In addition a new selection mechanism is permitted via an overload of
MultilibSet::select() for which multiple multilibs are returned.
This allows layering multilibs on top of each other.

Since multilibs are now ordered within a list, they no longer need a
Priority field.

The new algorithm is different to the old algorithm, but in practise
the old algorithm was always used in such a way that the effect is the
same.
The old algorithm was to find the set intersection of the requested
flags (with the first character of each removed) with each multilib's
flags (ditto), and for that intersection check whether the first
character matched. However, ignoring the first characters, the
requested flags were always a superset of all the multilibs flags.
Therefore the new algorithm can be used as a drop-in replacement.

The exception is Fuchsia, which needs adjusting slightly to set both
fexceptions and fno-exceptions flags.

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

15 months ago[X86] Precommit a test
Kazu Hirata [Fri, 24 Mar 2023 06:48:17 +0000 (23:48 -0700)]
[X86] Precommit a test

This patch precommits a test for:

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

15 months ago[lldb] Fix type of --apply-fixits (NFC)
Dave Lee [Fri, 24 Mar 2023 05:14:10 +0000 (22:14 -0700)]
[lldb] Fix type of --apply-fixits (NFC)

15 months ago[BugFix] Fix VSELECT ISel fail
Xiang1 Zhang [Tue, 21 Mar 2023 09:33:54 +0000 (17:33 +0800)]
[BugFix] Fix VSELECT ISel fail

Reviewed By: Luo yuanke

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

15 months ago[AArch64] Add tests for umax(x, 1u)
Kazu Hirata [Fri, 24 Mar 2023 03:20:20 +0000 (20:20 -0700)]
[AArch64] Add tests for umax(x, 1u)

This patch adds tests for umax(x, 1u).

This patch fixes:

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

It turns out that commit 86b4d8645fc1b86693fef564cef68f24599c930f on
Feb 8, 2023 already performs the instcombine transformation proposed
in the issue, so the issue requires no change on the codegen side.

15 months ago[LoongArch] Enable LoopDataPrefetch pass
Xiaodong Liu [Fri, 24 Mar 2023 03:08:21 +0000 (11:08 +0800)]
[LoongArch] Enable LoopDataPrefetch pass

Keep `EnableLoopDataPrefetch` option off for now because
we need a few more TTIs and ISels.

This patch is inspired by http://reviews.llvm.org/D17943.

Reviewed By: SixWeining

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

15 months ago[InstCombine] Try to recognize bswap pattern when calling funnel shifts
Jun Zhang [Fri, 24 Mar 2023 02:28:02 +0000 (10:28 +0800)]
[InstCombine] Try to recognize bswap pattern when calling funnel shifts

Alive2: https://alive2.llvm.org/ce/z/dxxD7B
Fixes: https://github.com/llvm/llvm-project/issues/60690

Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D146637

15 months agoPrecommit tests for #60690
Jun Zhang [Fri, 24 Mar 2023 02:27:02 +0000 (10:27 +0800)]
Precommit tests for #60690

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

Signed-off-by: Jun Zhang <jun@junz.org>
15 months ago[NFC][X86]remove trailing space in X86InstrArithmetic.td
XinWang10 [Fri, 24 Mar 2023 02:32:18 +0000 (22:32 -0400)]
[NFC][X86]remove trailing space in X86InstrArithmetic.td

In this file, most of the line don't have trailing spaces,
but some of them have. To keep consistent, remove the trailing
spaces.

Reviewed By: skan

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

15 months ago[InstCombine] Generate better code for std::bit_ceil
Kazu Hirata [Fri, 24 Mar 2023 02:26:43 +0000 (19:26 -0700)]
[InstCombine] Generate better code for std::bit_ceil

Without this patch, std::bit_ceil<uint32_t> is compiled as:

  %dec = add i32 %x, -1
  %lz = tail call i32 @llvm.ctlz.i32(i32 %dec, i1 false)
  %sub = sub i32 32, %lz
  %res = shl i32 1, %sub
  %ugt = icmp ugt i32 %x, 1
  %sel = select i1 %ugt, i32 %res, i32 1

With this patch, we generate:

  %dec = add i32 %x, -1
  %ctlz = tail call i32 @llvm.ctlz.i32(i32 %dec, i1 false)
  %sub = sub nsw i32 0, %ctlz
  %and = and i32 %1, 31
  %sel = shl nuw i32 1, %and
  ret i32 %sel

https://alive2.llvm.org/ce/z/pwezvF

This patch recognizes the specific pattern from std::bit_ceil in
libc++ and libstdc++ and drops the conditional move.  In addition to
the LLVM IR generated for std::bit_ceil(X), this patch recognizes
variants like:

  std::bit_ceil(X - 1)
  std::bit_ceil(X + 1)
  std::bit_ceil(X + 2)
  std::bit_ceil(-X)
  std::bit_ceil(~X)

This patch fixes:

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

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

15 months ago[SelectionDAG] Use isOneConstant (NFC)
Kazu Hirata [Fri, 24 Mar 2023 02:26:42 +0000 (19:26 -0700)]
[SelectionDAG] Use isOneConstant (NFC)

15 months ago[NFC] Fix Windows builds that use MSVC 14.x
Rahul Joshi [Thu, 23 Mar 2023 23:06:37 +0000 (16:06 -0700)]
[NFC] Fix Windows builds that use MSVC 14.x

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

15 months ago[builtins][test] Fix divmodti4_test.c on Windows
Arthur Eubanks [Fri, 24 Mar 2023 02:08:53 +0000 (19:08 -0700)]
[builtins][test] Fix divmodti4_test.c on Windows

By making the 64 bit integer literals unsigned. Otherwise some of them
are unexpectedly sign extended (and the compiler rightly diagnosed this
with warnings)

Initially added in D80506.

Reviewed By: MaskRay

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

15 months ago[LegalizeTypes][RISCV] Add a special case for (add X, -1) to ExpandIntRes_ADDSUB
LiaoChunyu [Fri, 24 Mar 2023 01:04:59 +0000 (09:04 +0800)]
[LegalizeTypes][RISCV] Add a special case for (add X, -1) to ExpandIntRes_ADDSUB

 On targets without ADDCARRY or ADDE, we need to emit a separate
 SETCC to determine carry from the low half to the high half.
 The high half is calculated by a series of ADDs.

 When RHSLo and RHSHi are -1, without this patch, we get:
   Hi = (add (add LHSHi,(setult Lo, LHSLo), -1)
 Where as with the patch we get:
   Hi = (sub LHSHi, (seteq LHSLo, 0))

 Only RHSLo is -1 we can instead do (setne Lo, 0).

 Similar to gcc: https://godbolt.org/z/M83f6rz39

Reviewed By: craig.topper

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

15 months ago[mlir][linalg] Refactor convolution to img2col conversion to use gather semantics
Quinn Dawkins [Thu, 23 Feb 2023 16:30:20 +0000 (11:30 -0500)]
[mlir][linalg] Refactor convolution to img2col conversion to use gather semantics

Following up on the comments in https://reviews.llvm.org/D144108 this
patch refactors the im2col conversion patterns for `linalg.conv_2d_nhwc_hwcf`
and `linalg.conv_2d_nchw_fchw` convolutions to use gather semantics for the im2col
packing `linalg.generic`.

Follow up work can include a similar pattern for depthwise convolutions
and a generalization of the patterns here to work with any `LinalgOp` as
well.

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

15 months ago[Builtins] Add __builtin_assume_separate_storage
Bruno Cardoso Lopes [Thu, 23 Mar 2023 21:34:12 +0000 (14:34 -0700)]
[Builtins] Add __builtin_assume_separate_storage

Plumbing from the language level to the assume intrinsics with
separate_storage operand bundles.

Patch by David Goldblatt (davidtgoldblatt)

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

15 months ago[Driver] Remove remnant mips64el-linux-android code after D146565
Fangrui Song [Thu, 23 Mar 2023 23:00:16 +0000 (16:00 -0700)]
[Driver] Remove remnant mips64el-linux-android code after D146565

15 months agoAndroid.rules: remove mips* rules
Fangrui Song [Thu, 23 Mar 2023 22:58:42 +0000 (15:58 -0700)]
Android.rules: remove mips* rules

They have been obsoleted for a long time and D146565 recently removed
Clang support.

15 months ago[Driver][test] Remove remnant mips*-linux-android tests after 805f51f9fedf90d2aa0ad46...
Fangrui Song [Thu, 23 Mar 2023 22:49:38 +0000 (15:49 -0700)]
[Driver][test] Remove remnant mips*-linux-android tests after 805f51f9fedf90d2aa0ad46c61cb4c9c0c5bcfe9

15 months ago[WebAssembly] Tidy up DebugValueManager (NFC)
Heejin Ahn [Thu, 23 Mar 2023 02:14:00 +0000 (19:14 -0700)]
[WebAssembly] Tidy up DebugValueManager  (NFC)

Misc. cleanups for `WebAssemblyDebugValueManager`.
- Use `Register` for registers
- Simpler for loop iteration
- Rename a variable
- Reorder methods
- Reduce `SmallVector` size for `DBG_VALUE`s to 1; one def usually have
  a single `DBG_VALUE` attached to it in most cases
- Add a few more lines of comments

Reviewed By: dschuff

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

15 months ago[clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position...
NagaChaitanya Vellanki [Thu, 23 Mar 2023 21:38:37 +0000 (14:38 -0700)]
[clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position degrade to id

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

Reviewed By: dang

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

15 months ago[llvm][TextAPI] Handle implicitly upgraded deployment versions
Cyndy Ishida [Thu, 23 Mar 2023 21:51:37 +0000 (14:51 -0700)]
[llvm][TextAPI] Handle implicitly upgraded deployment versions

Sometimes the clang driver will receive a target triple where the
deployment version is too low to support the platform + arch. In those
cases, the compiler upgrades the final minOS which is what gets recorded
ultimately by the linker in LC_BUILD_VERSION. TextAPI should also reuse
this logic for capturing minOS in recorded TBDv5 files.

Reviewed By: ributzka

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

15 months ago[JITLink] Add a jitlink::Section::empty operation.
Lang Hames [Thu, 23 Mar 2023 21:43:23 +0000 (14:43 -0700)]
[JITLink] Add a jitlink::Section::empty operation.

15 months agoRevert "[scudo] Add a Timer class to assist performance measurement"
Chia-hung Duan [Thu, 23 Mar 2023 21:49:02 +0000 (21:49 +0000)]
Revert "[scudo] Add a Timer class to assist performance measurement"

This reverts commit e0361396c2281a108a36d186161ace1843925431.

15 months ago[llvm] Handle duplicate call bases when applying branch funneling
Leonard Chan [Thu, 23 Mar 2023 21:44:59 +0000 (21:44 +0000)]
[llvm] Handle duplicate call bases when applying branch funneling

It's possible to segfault in `DevirtModule::applyICallBranchFunnel` when
attempting to call `getCaller` on a call base that was erased in a prior
iteration. This can occur when attempting to find devirtualizable calls
via `findDevirtualizableCallsForTypeTest` if the vtable passed to
llvm.type.test is a global and not a local. The function works by taking
the first argument of the llvm.type.test call (which is a vtable),
iterating through all uses of it, and adding any relevant all uses that
are calls associated with that intrinsic call to a vector. For most
cases where the vtable is actually a *local*, this wouldn't be an issue.
Take for example:

```
define i32 @fn(ptr %obj) #0 {
  %vtable = load ptr, ptr %obj
  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2")
  call void @llvm.assume(i1 %p)
  %fptr = load ptr, ptr %vtable
  %result = call i32 %fptr(ptr %obj, i32 1)
  ret i32 %result
}
```

`findDevirtualizableCallsForTypeTest` will check the call base ` %result
= call i32 %fptr(ptr %obj, i32 1)`, find that it is associated with a
virtualizable call from `%vtable`, find all loads for `%vtable`, and add
any instances those load results are called into a vector. Now consider
the case where instead `%vtable` was the global itself rather than a
local:

```
define i32 @fn(ptr %obj) #0 {
  %p = call i1 @llvm.type.test(ptr @vtable, metadata !"typeid2")
  call void @llvm.assume(i1 %p)
  %fptr = load ptr, ptr @vtable
  %result = call i32 %fptr(ptr %obj, i32 1)
  ret i32 %result
}
```

`findDevirtualizableCallsForTypeTest` should work normally and add one
unique call instance to a vector. However, if there are multiple
instances where this same global is used for llvm.type.test, like with:

```
define i32 @fn(ptr %obj) #0 {
  %p = call i1 @llvm.type.test(ptr @vtable, metadata !"typeid2")
  call void @llvm.assume(i1 %p)
  %fptr = load ptr, ptr @vtable
  %result = call i32 %fptr(ptr %obj, i32 1)
  ret i32 %result
}

define i32 @fn2(ptr %obj) #0 {
  %p = call i1 @llvm.type.test(ptr @vtable, metadata !"typeid2")
  call void @llvm.assume(i1 %p)
  %fptr = load ptr, ptr @vtable
  %result = call i32 %fptr(ptr %obj, i32 1)
  ret i32 %result
}
```

Then each call base `%result = call i32 %fptr(ptr %obj, i32 1)` will be
added to the vector twice. This is because for either call base `%result
= call i32 %fptr(ptr %obj, i32 1) `, we determine it is associated with
a virtualizable call from `@vtable`, and then we iterate through all the
uses of `@vtable`, which is used across multiple functions. So when
scanning the first `%result = call i32 %fptr(ptr %obj, i32 1)`, then
both call bases will be added to the vector, but when scanning the
second one, both call bases are added again, resulting in duplicate call
bases in the CSInfo.CallSites vector.

Note this is actually accounted for in every other instance WPD iterates
over CallSites. What everything else does is actually add the call base
to the `OptimizedCalls` set and just check if it's already in the set.
We can't reuse that particular set since it serves a different purpose
marking which calls where devirtualized which `applyICallBranchFunnel`
explicitly says it doesn't. For this fix, we can just account for
duplicates with a map and do the actual replacements afterwards by
iterating over the map.

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

15 months ago[OpenMP] Fix test after updating NVPTX atomic inlines
Joseph Huber [Thu, 23 Mar 2023 21:41:25 +0000 (16:41 -0500)]
[OpenMP] Fix test after updating NVPTX atomic inlines

Summary:
The previous patch fixed how we handle emitting atomics for targeting
NVPTX directly. This is the only other file that really does that and
has atomics and I forgot to update it.

15 months ago[libc][NFC] Fix misspelled variable name in cmake message
Joseph Huber [Thu, 23 Mar 2023 21:30:31 +0000 (16:30 -0500)]
[libc][NFC] Fix misspelled variable name in cmake message

15 months ago[NVPTX] Set the atomic inling threshold when targeting NVPTX directly
Joseph Huber [Thu, 23 Mar 2023 19:15:01 +0000 (14:15 -0500)]
[NVPTX] Set the atomic inling threshold when targeting NVPTX directly

Since Clang 16.0.0 users can target the `NVPTX` architecture directly
via `--target=nvptx64-nvidia-cuda`. However, this does not set the
atomic inlining size correctly. This leads to spurious warnings and
emission of runtime atomics that are never implemented. This patch
ensures that we set this to the appropriate pointer width. This will
always be 64 in the future as `nvptx64` will only be supported moving
forward.

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

Reviewed By: tra

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

15 months ago[lld][WebAssembly] Initial support for stub libraries
Sam Clegg [Wed, 7 Dec 2022 00:49:13 +0000 (16:49 -0800)]
[lld][WebAssembly] Initial support for stub libraries

See the docs in lld/docs/WebAssembly.rst for more on this.

This feature unlocks a lot of simplification in the emscripten toolchain
since we can represent the JS libraries to wasm-ld as stub libraries.

See https://github.com/emscripten-core/emscripten/issues/18875

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

15 months agoFix highlighting issue with _complex and initialization list with more than 2 items
NagaChaitanya Vellanki [Thu, 23 Mar 2023 21:16:25 +0000 (14:16 -0700)]
Fix highlighting issue with _complex and initialization list with more than 2 items

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

Reviewed By: aaron.ballman

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

15 months agoRemove Android-mips related tests
AdityaK [Thu, 23 Mar 2023 20:54:58 +0000 (13:54 -0700)]
Remove Android-mips related tests

Split from: https://reviews.llvm.org/D146565, already reviewed there.

15 months ago[lldb][NFC] makeArrayRef -> ArrayRef
Arthur Eubanks [Thu, 23 Mar 2023 18:28:49 +0000 (11:28 -0700)]
[lldb][NFC] makeArrayRef -> ArrayRef

makeArrayRef is deprecated.

15 months ago[LLDB] Fix for D139955 Summary:
Alexander Yermolovich [Thu, 23 Mar 2023 20:20:38 +0000 (13:20 -0700)]
[LLDB] Fix for D139955 Summary:

Fixing a small typo.

Reviewed By: clayborg

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

15 months agoRevert "[JITLink] Initial AArch32 backend"
Gulfem Savrun Yeniceri [Thu, 23 Mar 2023 20:54:21 +0000 (20:54 +0000)]
Revert "[JITLink] Initial AArch32 backend"

This reverts commit c2de8ff92753acdb1ace7a27cc11cb09f28eb8fa.
It caused a segmentation fault while running ExecutionEngine
tests on Mac.
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-mac-x64/b8785839382041226465/overview

15 months agoRemove mips target triple for Android
AdityaK [Tue, 21 Mar 2023 22:42:25 +0000 (15:42 -0700)]
Remove mips target triple for Android

Reviewers: enh, phosek, srhines, MaskRay

thanks to @enh for pointing these out.

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

15 months ago[PATCH] Enable targeting riscv64-linux-android
Colin Cross [Thu, 23 Mar 2023 20:22:32 +0000 (13:22 -0700)]
[PATCH] Enable targeting riscv64-linux-android

Reviewers: ccross, asb, phosek, enh, srhines, hiraditya

Putting: https://android.googlesource.com/toolchain/llvm_android/+/refs/heads/master/patches/Enable-targeting-riscv64-linux-android.patch for review.

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

15 months ago[HWASAN] Fix decorate_proc_maps to work with HWASAN
Kirill Stoimenov [Thu, 23 Mar 2023 20:25:47 +0000 (20:25 +0000)]
[HWASAN] Fix decorate_proc_maps to work with HWASAN

15 months ago[lldb-server] Use Platform plugin corresponding to the host
Alex Langford [Wed, 22 Mar 2023 23:17:49 +0000 (16:17 -0700)]
[lldb-server] Use Platform plugin corresponding to the host

In ee232506b870ce5282cc4da5ca493d41d361feb3 I moved UnixSignal
initialization from lldbTarget to the various platform plugins. This
inadvertently broke lldb-server because lldb-server doesn't use
Platform plugins. lldb-server still needs to be able to create a
UnixSignals object for the host platform so we can add the relevant
platform plugin to lldb-server to make sure we always have a
HostPlatform.

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

15 months ago[StackProtector] attribute __stack_chk_fail as NoReturn
Nick Desaulniers [Thu, 23 Mar 2023 19:38:57 +0000 (12:38 -0700)]
[StackProtector] attribute __stack_chk_fail as NoReturn

When GCC added support for stack smashing protections, it was defined
that:

> This hook returns a CALL_EXPR that alerts the runtime that the stack
> protect guard variable has been modified. This expression should
> involve a call to a noreturn function.
> The default version of this hook invokes a function called
> ‘__stack_chk_fail’, taking no arguments.

Do so as well for __stack_smash_handler for OpenBSD.

Every libc implementation I could find has __stack_chk_fail marked
noreturn, or the implementation calls abort, exit, or panic (which
themselves are noreturn).

Glibc: https://sourceware.org/git/?p=glibc.git;a=blob;f=debug/stack_chk_fail.c
Musl: https://git.musl-libc.org/cgit/musl/tree/src/env/__stack_chk_fail.c
Bionic: https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/bionic/__stack_chk_fail.cpp
FreeBSD: https://cgit.freebsd.org/src/tree/lib/libc/secure/stack_protector.c
OpenBSD: https://github.com/openbsd/src/blob/master/lib/libc/sys/stack_protector.c
NetBSD: https://github.com/NetBSD/src/blob/trunk/lib/libc/misc/stack_protector.c
Linux Kernel: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/panic.c
Apple: https://opensource.apple.com/source/Libc/Libc-1439.40.11/sys/OpenBSD/stack_protector.c.auto.html

Link: https://gcc.gnu.org/onlinedocs/gccint/Stack-Smashing-Protection.html#Stack-Smashing-Protection
This will later help us diagnose functions that fall through to other
functions vs end in calls to functions that are noreturn.

Reviewed By: efriedma

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

15 months ago[scudo] Add a Timer class to assist performance measurement
Chia-hung Duan [Thu, 23 Mar 2023 19:38:48 +0000 (19:38 +0000)]
[scudo] Add a Timer class to assist performance measurement

Add Timer and TimingManager which provide convenient way to meause the
execution time of code snippets. The output looks like,

```
-- Average Operation Time -- -- Name (# of Calls) --
          1747.2(ns)            popBatch (59)
            92.3(ns)            popBatchImpl (73)
           101.6(ns)              EmptyBatchProcess (5)
          2587.0(ns)            pushBlocksImpl (13)
```

Note that `EmptyBatchProcess` is nested under the timer `popBatchImpl`.

Reviewed By: cferris

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

15 months ago[X86] combineVectorSizedSetCCEquality - update arguments to use individual SETCC...
Simon Pilgrim [Thu, 23 Mar 2023 19:36:29 +0000 (19:36 +0000)]
[X86] combineVectorSizedSetCCEquality - update arguments to use individual SETCC operands. NFC.

15 months ago[libc] Move fma and fmaf into generic dir
Alex Brachet [Thu, 23 Mar 2023 18:43:09 +0000 (18:43 +0000)]
[libc] Move fma and fmaf into generic dir

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

15 months ago[mlir][Vector] NFC - Reorganize vector patterns
Nicolas Vasilache [Thu, 23 Mar 2023 15:32:48 +0000 (08:32 -0700)]
[mlir][Vector] NFC - Reorganize vector patterns

Vector dialect patterns have grown enormously in the past year to a point where they are now impenetrable.
Start reorganizing them towards finer-grained control.

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

15 months ago[TSan][Darwin] Test fix external-swift-debugging.cpp
Julian Lettner [Thu, 23 Mar 2023 18:01:33 +0000 (11:01 -0700)]
[TSan][Darwin] Test fix external-swift-debugging.cpp

My recent change [1] extended the external-swift-debugging.cpp test, but
didn't account for PAC under which function pointers aren't trivially
comparable. We could use `ptrauth_strip()`, but for the test it's easier
to just the symbol name.

[1] https://reviews.llvm.org/D146264

15 months ago[mlir][Vector] Retire one old filter-based test
Nicolas Vasilache [Thu, 23 Mar 2023 17:47:04 +0000 (10:47 -0700)]
[mlir][Vector] Retire one old filter-based test

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

15 months ago[CodeGenPrepare][NFC] Pre-commit test for memory use count fix
Momchil Velikov [Thu, 23 Mar 2023 17:38:07 +0000 (17:38 +0000)]
[CodeGenPrepare][NFC] Pre-commit test for memory use count fix

Reviewed By: mkazantsev

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

15 months ago[X86] Refactor movmsk(icmp_eq(and(x,c1),0)) -> movmsk(not(shl(x,c2))) fold to use...
Simon Pilgrim [Thu, 23 Mar 2023 17:49:39 +0000 (17:49 +0000)]
[X86] Refactor movmsk(icmp_eq(and(x,c1),0)) -> movmsk(not(shl(x,c2))) fold to use KnownBits

We don't need an explicit AND mask, we can use KnownBits to determine if each element has (the same) single non-zero bit and shift that into the msb/signbit for MOVMSK to access directly.

15 months ago[support] Fix PrintNumber Test on AIX
Paul Kirth [Thu, 23 Mar 2023 17:13:35 +0000 (17:13 +0000)]
[support] Fix PrintNumber Test on AIX

When fixing the test earlier, we missed the JSON case for NaN and INF,
so handle those the same as for non-JSON, by creating the string
dynamically.

Reviewed By: abhina.sreeskantharajan

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

15 months ago[clang-format] Allow trailing return types in macros
Emilia Dreamer [Thu, 23 Mar 2023 17:31:39 +0000 (19:31 +0200)]
[clang-format] Allow trailing return types in macros

The trailing return type arrow checker verifies that a declaration is
being parsed, however, this isn't true when inside of macros.

It turns out the existence of the auto keyword is enough to make
sure that we're dealing with a trailing return type, and whether we're
in a declaration doesn't matter.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

15 months ago[CodeGenPrepare] Don't give up if unable to sink first arg to a cold call
Momchil Velikov [Thu, 23 Mar 2023 17:16:31 +0000 (17:16 +0000)]
[CodeGenPrepare] Don't give up if unable to sink first arg to a cold call

Reviewed By: mkazantsev

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

15 months ago[libcxx] Fix build bustage with threads disabled
Mike Hommey [Thu, 23 Mar 2023 17:09:00 +0000 (17:09 +0000)]
[libcxx] Fix build bustage with threads disabled

Building with -DLIBCXX_ENABLE_THREADS=OFF -DLIBCXXABI_ENABLE_THREADS=OFF
(like e.g. for wasm) fails after D146228 because of a misplaced std
namespace begin/end.

Reviewed By: philnik, #libc

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

15 months ago[libc++][ranges] P2711R1 Making multi-param constructors of views explicit
Hristo Hristov [Wed, 22 Mar 2023 21:24:22 +0000 (23:24 +0200)]
[libc++][ranges] P2711R1 Making multi-param constructors of views explicit

Implemented [[ https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2711r1.html | P2711R1 ]] for existing views.
 (`join_with_view` is not yet implemented)

Reviewed By: #libc, philnik

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