platform/upstream/llvm.git
12 months agoRevert D153927 "Resubmit with fix: [NFC] Refactor MBB hotness/coldness into templated...
Fangrui Song [Wed, 28 Jun 2023 07:30:52 +0000 (00:30 -0700)]
Revert D153927 "Resubmit with fix: [NFC] Refactor MBB hotness/coldness into templated PSI functions."

This reverts commit 4d8cf2ae6804e0d3f2b668dbec0f5c1983358328.

There is a library layering violation. LLVMAnalysis cannot depend on LLVMCodeGen.

```
llvm/include/llvm/Analysis/ProfileSummaryInfo.h:19:10: fatal error: 'llvm/CodeGen/MachineFunction.h' file not found
   19 | #include "llvm/CodeGen/MachineFunction.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

12 months ago[mlir][complex] Canonicalize complex.mul with 1 and 0
Kai Sasaki [Wed, 28 Jun 2023 05:55:42 +0000 (14:55 +0900)]
[mlir][complex] Canonicalize complex.mul with 1 and 0

We can fold the complex.mul if the right value is obvious 1 or 0.

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

12 months ago[llvm-exegesis] Adjust GLIBC_INITS_RSEQ condition
Fangrui Song [Wed, 28 Jun 2023 07:23:38 +0000 (00:23 -0700)]
[llvm-exegesis] Adjust GLIBC_INITS_RSEQ condition

Commit 9f80831f3627e800709e2434bbbd5bb179b1576e introduced `#include <sys/rseq.h>`,
but RSEQ_SIG is only defined by some glibc ports (aarch64,arm,mips,powerpc,s390,x86),
causing other hosts (e.g., riscv64, loongarch64) to fail to build.

Reviewed By: aidengrossman, xen0n

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

12 months agoSummary: [lldb] Fix libncurses, libpanel library link order
Hau Hsu [Wed, 28 Jun 2023 06:59:09 +0000 (14:59 +0800)]
Summary: [lldb] Fix libncurses, libpanel library link order

libpanel depends on libcurses, so when linking static libraries, libpanel
should be places prior to libcurses.

This patch resolves error like:
```
.../x86_64-centos6-linux-gnu/bin/ld:
.../lib/libpanelw.a(p_show.o):
in function `show_panel':
p_show.c:(.text+0x39): undefined reference to `_nc_panelhook_sp'
.../x86_64-centos6-linux-gnu/bin/ld:
.../lib/libpanelw.a(p_show.o):
in function `update_panels_sp':
p_update.c:(.text+0x1f): undefined reference to `_nc_panelhook_sp'
collect2: error: ld returned 1 exit status
```

Reviewed By: JDevlieghere

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

12 months agoRevert "Revert "[mlir][Transform] Add support for mma.sync m16n8k16 f16 rewrite....
Nicolas Vasilache [Tue, 27 Jun 2023 09:02:31 +0000 (09:02 +0000)]
Revert "Revert "[mlir][Transform] Add support for mma.sync m16n8k16 f16 rewrite." and "[mlir][Transform] Introduce nvgpu transform extensions""

This reverts commit 6506692fe619ef8a1f7c6ea829d9a9eceb31622d.

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

12 months ago[flang][hlfir] Do not reuse hlfir.expr mask when saving RHS.
Jean Perier [Wed, 28 Jun 2023 06:32:21 +0000 (08:32 +0200)]
[flang][hlfir] Do not reuse hlfir.expr mask when saving RHS.

In WHERE and masked FORALL assignment, both the mask and the
RHS may need to be saved in some temporary storage before evaluating
the assignment.

The code was trying to "optimize" that case when evaluating the RHS
by not fetching the mask temporary that was just created, but in simple
cases of WHERE construct where the evaluated mask is an hlfir.expr,
this caused the hlfir.expr to be both used in an hlfir.associate and
later in an hlfir.apply to create the fir.if to mask the RHS evaluation.
This double usage prevents codegen from inlining the hlfir.expr at the
hlfir.apply, and from "moving" the hlfir.expr storage into the temp
during hlfir.associate bufferization. So this is pessimizing the code:
this would lead to created two mask array temporary storages

This was caught by the unexpectedly high number of "not yet implemented:
hlfir.associate of hlfir.expr with more than one use" that were firing.

Use the mask temporary instead (the hlfir.associate result) when possible.
Some temporary (the "inlined stack") do not support fetching and pushing
in the same run (a single counter is used to keep track of the fetching
and pushing position). Add a canBeFetchedAfterPush() for safety,
but this limitation is anyway not relevant for hlfir.expr since the
inlined stack is only used to save "trivial" scalars.

Also update the temporary storage name to only indicate "forall" if
the top level construct is a FORALL. This is not a very precise name,
but it should at least give a correct context to indicate in the IR
why some temporary array storage was created.

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

12 months ago[flang] do not merge block after lowering
Jean Perier [Wed, 28 Jun 2023 06:27:16 +0000 (08:27 +0200)]
[flang] do not merge block after lowering

Lowering relies on dead code generation / unreachable block deletion
to delete some code that is potentially invalid.

However, calling mlir::simplifyRegion also merges block, which may
promote SSA values to block arguments. Not all FIR types are intended
to be block arguments.
The added test shows an example where block merging led to
fir.shape<> being block arguments (and a failure later in codegen).

Reviewed By: tblah, clementval, vdonaldson

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

12 months ago[AMDGPU] Use SSAUpdater in PromoteAlloca
pvanhout [Tue, 13 Jun 2023 07:49:38 +0000 (09:49 +0200)]
[AMDGPU] Use SSAUpdater in PromoteAlloca

This allows PromoteAlloca to not be reliant on a second SROA run to remove the alloca completely. It just does the full transformation directly.

Note PromoteAlloca is still reliant on SROA running first to
canonicalize the IR. For instance, PromoteAlloca will no longer handle aggregate types because those should be simplified by SROA before reaching the pass.

Reviewed By: #amdgpu, arsenm

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

12 months agoPre-commit test for D151696.
Freddy Ye [Wed, 28 Jun 2023 05:06:05 +0000 (13:06 +0800)]
Pre-commit test for D151696.

Meanwhile this patch added missing tests for supported CPU names
of cpu_dispatch/specific attribute and added more CHECKs for
resolver function.

Reviewed By: pengfei, skan

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

12 months ago[Fuchsia] Enable libcxx filesystem on Windows for stage 1 build
Petr Hosek [Wed, 28 Jun 2023 05:42:06 +0000 (05:42 +0000)]
[Fuchsia] Enable libcxx filesystem on Windows for stage 1 build

This is a follow up to D153931 but for the first stage.

12 months ago[NFC] [C++20] [Modules] Add a test for merging lambda types
Chuanqi Xu [Wed, 28 Jun 2023 05:41:36 +0000 (13:41 +0800)]
[NFC] [C++20] [Modules] Add a test for merging lambda types

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

This should be fixed with the series of bc73ef0. Add the test case for
C++20 Named modules.

12 months agoResubmit with fix: [NFC] Refactor MBB hotness/coldness into templated PSI functions.
Han Shen [Tue, 27 Jun 2023 23:37:25 +0000 (16:37 -0700)]
Resubmit with fix: [NFC] Refactor MBB hotness/coldness into templated PSI functions.

In D152399, we calculate BPI->BFI in MachineFunctionSplit pass just to
use PSI->isFunctionHotInCallGraph, which is expensive. Instead, we can
implement this directly with MBFI.

Reviewer mentioned in the comment, that machine_size_opts already has
isFunctionColdInCallGraph, isFunctionHotInCallGraphNthPercentile, etc
implemented. These can be refactored and reused across MFS and machine
size opts.

This CL does this - it refactors out those internal static functions
into PSI as templated functions, so they can be accessed easily.

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

12 months agosanitizer_allocator_test: guard SpecialSizeClassMap test with !ALLOCATOR64_SMALL_SIZE
Fangrui Song [Wed, 28 Jun 2023 04:17:34 +0000 (21:17 -0700)]
sanitizer_allocator_test: guard SpecialSizeClassMap test with !ALLOCATOR64_SMALL_SIZE

This artificial size class map uses a very large kMaxSize (1<<34) which is not
suitable for small kAddressSpaceSize systems (aarch64-*-linux-android, riscv64).
Exposed by D153664.

12 months ago[test] Replace aarch64-*-eabi with aarch64
Fangrui Song [Wed, 28 Jun 2023 03:02:52 +0000 (20:02 -0700)]
[test] Replace aarch64-*-eabi with aarch64

Using "eabi" for aarch64 targets is a common mistake and warned by Clang Driver.
We want to avoid it elsewhere as well. Just use the common "aarch64" without
other triple components.

12 months ago[sanitizer] Relax the restriction on SizeClassAllocator64::kAllocatorSize
Fangrui Song [Wed, 28 Jun 2023 02:47:03 +0000 (19:47 -0700)]
[sanitizer] Relax the restriction on SizeClassAllocator64::kAllocatorSize

Commit 278ccdacdcbde3399f1fa4b3ab929212e4e0322c says that kAllocatorSize
must be >= (1<<32), but this is not accurate. This static_assert causes 128GiB
kAllocatorSize to be unable to select DefaultSizeClassMap (kRegionSize is
1<<31).

Relax the restriction to be able to satisfy the largest size class. This allows
DefaultSizeClassMap to be usable with 128GiB kAllocatorSize, with
check-{asan,lsan,sanitizer} passing.

Reviewed By: #sanitizers, vitalybuka, kstoimenov

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

12 months ago[test] Replace aarch64-arm-none-eabi with aarch64
Fangrui Song [Wed, 28 Jun 2023 02:36:26 +0000 (19:36 -0700)]
[test] Replace aarch64-arm-none-eabi with aarch64

Similar to 02e9441d6ca73314afa1973a234dce1e390da1da, but for llvm/test and one
lld/test/ELF test.

12 months ago[test] Replace -triple aarch64-arm-none-eabi with -triple aarch64
Fangrui Song [Wed, 28 Jun 2023 02:21:41 +0000 (19:21 -0700)]
[test] Replace -triple aarch64-arm-none-eabi with -triple aarch64

Using "eabi" for aarch64 targets is a common mistake and warned by driver
(D153430). We want to avoid them for -cc1 tests as well.

12 months ago[lldb] Fix search & replace mistake in IRForTarget comment (NFC)
Dave Lee [Wed, 28 Jun 2023 01:36:23 +0000 (18:36 -0700)]
[lldb] Fix search & replace mistake in IRForTarget comment (NFC)

See 1b95a6ff95a279de27d5f63de8d67a731f280b44

12 months ago[lldb] Improve log message (NFC)
Dave Lee [Wed, 28 Jun 2023 01:31:23 +0000 (18:31 -0700)]
[lldb] Improve log message (NFC)

Remove the unmatched closing paren )

12 months ago[lldb] Assert index is valid in DWARFDeclContext
Jonas Devlieghere [Wed, 28 Jun 2023 00:01:53 +0000 (17:01 -0700)]
[lldb] Assert index is valid in DWARFDeclContext

Replace the comment with an assert to enforce the correct index is used.

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

12 months ago[AIX][tests] Disable test for missing DWARF section
Jake Egan [Wed, 28 Jun 2023 00:53:38 +0000 (20:53 -0400)]
[AIX][tests] Disable test for missing DWARF section

This new test is failing on AIX due to an unsupported DWARF section, so disable it (same rationale as patch D111336).

12 months ago[RFC][flang] Experimental device build of Flang runtime.
Slava Zakharin [Mon, 22 May 2023 21:05:18 +0000 (14:05 -0700)]
[RFC][flang] Experimental device build of Flang runtime.

These are initial changes to experiment with building the Fortran runtime
as a CUDA or OpenMP target offload library.

The initial patch defines a set of macros that have to be used consistently
in Flang runtime source code so that it can be built for different
offload devices using different programming models (CUDA, HIP, OpenMP target
offload). Currently supported modes are:
* CUDA: Flang runtime may be built as a fatlib for the host and a set
  of CUDA architectures specified during the build. The packaging
  of the device code is done by the CUDA toolchain and may differ
  from toolchan to toolchain.
* OpenMP offload:
  - host_device mode: Flang runtime may be built as a fatlib for the host
    and a set of OpenMP offload architectures. The packaging
    of the device code is done by the OpenMP offload compiler and may differ
    from compiler to compiler.

OpenMP offload 'nohost' mode is a TODO to match the build setup
of libomptarget/DeviceRTL. Flang runtime will be built as LLVM Bitcode
library using Clang/LLVM toolchain. The host part of the library
will be "empty", so there will be two distributable object: the host
Flang runtime and dummy host library with device Flang runtime pieces
packaged using clang-offload-packager and clang.

In all supported modes, enabling parts of Flang runtime for the device
compilation can be done iteratively to make the patches observable.
Note that at any point in time the resulting library may have unresolved
references to not yet enabled parts of Flang runtime.

Example cmake/make commands for building with Clang for NVPTX target:
cmake \
-DFLANG_EXPERIMENTAL_CUDA_RUNTIME=ON \
-DCMAKE_CUDA_ARCHITECTURES=80 \
-DCMAKE_C_COMPILER=/clang_nvptx/bin/clang \
-DCMAKE_CXX_COMPILER=/clang_nvptx/bin/clang++ \
-DCMAKE_CUDA_COMPILER=/clang_nvptx/bin/clang \
/llvm-project/flang/runtime/
make -j FortranRuntime

Example cmake/make commands for building with Clang OpenMP offload:
cmake \
-DFLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD="host_device" \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DFLANG_OMP_DEVICE_ARCHITECTURES="sm_80" \
../flang/runtime/
make -j FortranRuntime

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

12 months ago[LoongArch] Add back SDNPSideEffect properties to CSR and IOCSR read ops
WANG Xuerui [Wed, 28 Jun 2023 00:25:28 +0000 (08:25 +0800)]
[LoongArch] Add back SDNPSideEffect properties to CSR and IOCSR read ops

In general, CSR and IOCSR reads should be treated as volatile because:

* there may well be intervening writes between seemingly common
  expressions;
* the stateful entity behind a given (IO)CSR may well be volatile.

Confirmed to fix broken Clang Linux/LoongArch builds (dying when a
userspace process tries to use FPU, panicking when that process happens
to be PID 1) with this patch.

Fixes: https://github.com/llvm/llvm-project/issues/63549
Fixes: 2efdacf74c54 ("[LoongArch] Add missing chains and remove unnecessary `SDNPSideEffect` property for some intrinsic nodes")

Reviewed By: SixWeining, hev

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

12 months ago[llvm] Add include guards to LLVMOption TableGen
Brian Gesiak [Tue, 27 Jun 2023 20:25:39 +0000 (16:25 -0400)]
[llvm] Add include guards to LLVMOption TableGen

Add include guards that allow multiple includes of `OptParser.td`. This
is helpful when defining multiple sets of options in multiple files.
For example, a user could define a `HelpOptions.td` file that defines
only `-h` and `--help`:

```
// HelpOptions.td
include "llvm/Option/OptParser.td"

def HelpOptionGroup : OptionGroup<"Help Options">;
def help : Flag<["--", "-"], "help">, Group<HelpOptionGroup>,
           Flags<[]>;
def : Flag<["-"], "h">, Group<HelpOptionGroup>, Flags<[]>, Alias<help>;
```

This file could then be included into any TableGen file that wishes to
define these options:

```
// MyOptions.td
include "llvm/Option/OptParser.td"

def MyOptionGroup : OptionGroup<"My Options">;
// ...define my options.

// And also define `-h` and `--help`:
include "HelpOptions.td"
```

This currently isn't possible, because this would result in
`OptParser.td` being included twice. Alternatively, the include of
`OptParser.td` in the `HelpOptions.td` example above could be removed,
but then `llvm-tblgen --gen-opt-parser-defs HelpOptions.td` would fail
(because the `OptionGroup` and `Option` records are defined in
`OptParser.td`).

Reviewed By: rriddle

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

12 months ago[CSSPGO][Preinliner] Always inline zero-sized functions.
Hongtao Yu [Tue, 27 Jun 2023 23:31:50 +0000 (16:31 -0700)]
[CSSPGO][Preinliner] Always inline zero-sized functions.

Zero-sized functions should be cost-free in term of size budget, so they should be considered during inlining even if we run out of size budget.

This appears to give 0.5% win for one of our internal services.

Reviewed By: wenlei

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

12 months ago[SCEV] Optimize FoldID
Vitaly Buka [Fri, 17 Feb 2023 07:07:52 +0000 (23:07 -0800)]
[SCEV] Optimize FoldID

Improve compile time

https://llvm-compile-time-tracker.com/compare.php?from=773e5dfbc6bf4d4c5be568a039661e9baad80d15&to=7ba15f3a4b59181110e73dc397a9fe56165a2b73&stat=instructions:u

Reviewed By: MaskRay

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

12 months ago[Fuchsia] Enable libcxx filesystem on Windows build.
Haowei Wu [Tue, 27 Jun 2023 23:52:57 +0000 (16:52 -0700)]
[Fuchsia] Enable libcxx filesystem on Windows build.

This patch enables the libcxx filesystem when building runtimes for
Windows.

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

12 months ago[builtins] Avoid using floating point q suffix. NFCI
Alex Richardson [Tue, 27 Jun 2023 23:16:16 +0000 (16:16 -0700)]
[builtins] Avoid using floating point q suffix. NFCI

The q floating point suffix is not supported by all compilers
configurations (e.g. GCC only supports it for some targets), so use a
macro (much like UINT64_C) instead. As this touches almost all lines in
the two tests also run them through clang-format.

12 months agoAllow setting LLVM_EXPERIMENTAL_TARGETS_TO_BUILD to "all"
Alex Richardson [Tue, 27 Jun 2023 23:28:08 +0000 (16:28 -0700)]
Allow setting LLVM_EXPERIMENTAL_TARGETS_TO_BUILD to "all"

When set to "all" we will now build all experimental targets. This matches
the behaviour for LLVM_TARGETS_TO_BUILD.

Reviewed By: beanz

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

12 months ago[test] Regenerate some tests
Arthur Eubanks [Tue, 27 Jun 2023 23:53:11 +0000 (16:53 -0700)]
[test] Regenerate some tests

12 months ago[libc++][hardening] Add an ABI macro `_LIBCPP_ABI_BOUNDED_ITERATORS`.
varconst [Tue, 27 Jun 2023 23:41:02 +0000 (16:41 -0700)]
[libc++][hardening] Add an ABI macro `_LIBCPP_ABI_BOUNDED_ITERATORS`.

Use the new macro instead of `_LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING`.

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

12 months agoHave GetKernelsAndKextsInDirectoryHelper request follow symlinks
Jason Molenda [Tue, 27 Jun 2023 23:15:34 +0000 (16:15 -0700)]
Have GetKernelsAndKextsInDirectoryHelper request follow symlinks

While working on the broken-symlinks issue, I noticed this one place
where I was setting `find_other` to false unintentionally in the
darwin kernel platform kext/kernel scan.  Small fix while I'm here.

12 months ago[clang-format] Fix bugs in annotating r_paren as C-style cast
Owen Pan [Mon, 26 Jun 2023 05:18:12 +0000 (22:18 -0700)]
[clang-format] Fix bugs in annotating r_paren as C-style cast

Don't annotate r_paren as TT_CastRParen if it's followed by an amp/star and
either the line is in a macro definition or a numeric_constant follows the
amp/star.

Fixes #59634.

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

12 months ago[libc++] Add _LIBCPP_NO_CFI to __make_uninitialized_buffer
Nikolas Klauser [Tue, 27 Jun 2023 22:47:09 +0000 (15:47 -0700)]
[libc++] Add _LIBCPP_NO_CFI to __make_uninitialized_buffer

CFI doen't allow casting uninitialized memory to a type, resulting in a
crash in `__make_uninitialized_buffer`.

12 months ago[lldb] Duplicate Target::Launch resuming logic into CommandObjectPlatformProcessLaunch
Dave Lee [Tue, 27 Jun 2023 21:12:45 +0000 (14:12 -0700)]
[lldb] Duplicate Target::Launch resuming logic into CommandObjectPlatformProcessLaunch

Fix `platform process launch` on macOS where it fails for lack of auto-resuming support.

This change reproduces the resuming logic found in `Target::Launch`.

This issue was identified by @DavidSpickett in D153636. This change relies on the tests
added in that PR. Thanks David.

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

12 months ago[lldb][NFC] Prevent slicing when converting DataExtractors
Felipe de Azevedo Piovezan [Tue, 27 Jun 2023 20:10:05 +0000 (16:10 -0400)]
[lldb][NFC] Prevent slicing when converting DataExtractors

LLDB's implementation of DWARFDataExtractor has a method that returns a
llvm::DWARFDataExtractor. In some cases, like DebugNamesDWARFIndex::Create, we
were passing an LLVM::DWARFDataExtractor to a function that expects a
LLVM:DataExtractor by value. This is causing slicing of the derived class.

While slicing is not inherently bad, it can be dangerous if the constructor of
the derived class mutates the base class in a way that leaves it in an invalid
state after slicing.

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

12 months ago[SLP]Fix PR63141: compareCmp is not strict weak ordering.
Alexey Bataev [Tue, 27 Jun 2023 19:48:08 +0000 (12:48 -0700)]
[SLP]Fix PR63141: compareCmp is not strict weak ordering.

Added some extra checks for comapreCMP function if IsCompatibility is
false to make it meat the strict weak ordering requirements to be
correctly used in sort functions.

12 months ago[Propeller] Match debug info filenames from profiles to distinguish internal linkage...
Rahman Lavaee [Tue, 27 Jun 2023 20:11:45 +0000 (20:11 +0000)]
[Propeller] Match debug info filenames from profiles to distinguish internal linkage functions with the same names.

Basic block sections profiles are ingested based on the function name. However, conflicts may occur when internal linkage functions with the same symbol name are linked into the binary (for instance static functions defined in different modules). Currently, these functions cannot be optimized unless we use `-funique-internal-linkage-names` (D89617) to enforce unique symbol names.

However, we have found that `-funique-internal-linkage-names` does not play well with inline assembly code which refers to the symbol via its symbol name. For example, the Linux kernel does not build with this option.

This patch implements a new feature which allows differentiating profiles based on the debug info filenames associated with each function. When specified, the given path is compared against the debug info filename of the matching function and profile is ingested only when the debug info filenames match. Backward-compatibility is guaranteed as omitting the specifiers from the profile would allow them to be matched by function name only. Also specifiers can be included for a subset of functions only.

Reviewed By: shenhan

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

12 months ago[lldb] Avoid FileSystem::Resolve for cached files in the SourceManager
Jonas Devlieghere [Mon, 26 Jun 2023 17:45:23 +0000 (10:45 -0700)]
[lldb] Avoid FileSystem::Resolve for cached files in the SourceManager

Currently, source files are cached by their resolved path. This means
that before we can query the cache, we potentially have to resolve the
path, which can be slow. This patch avoids the call to FileSystem::Resolve
by caching both the resolved and unresolved path. We now only resolve
the path once when we create and cache a new file.

rdar://110787562

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

12 months ago[flang][hlfir] Do not dereference unallocated entities in structure constructor.
Slava Zakharin [Mon, 26 Jun 2023 21:32:41 +0000 (14:32 -0700)]
[flang][hlfir] Do not dereference unallocated entities in structure constructor.

Component-by-component assignment must be able to handle unallocated
allocatable values in structure constructor. F2018 7.5.10 p. 7 states
that the component must have unallocated status as a result of such
construction. The structure constructor temporary is initialized
such that all the allocatable components are unallocated, so we just
need to make sure not to do the component assignment if RHS is deallocated.

Depends on D152482  (the same LIT test is affected)

Reviewed By: jeanPerier, tblah

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

12 months ago[SLP][NFC]Add a test for vectorization of cmps with alternate
Alexey Bataev [Tue, 27 Jun 2023 20:47:28 +0000 (13:47 -0700)]
[SLP][NFC]Add a test for vectorization of cmps with alternate
predicates, NFC.

12 months ago[AArch64][SelectionDAG] fix infinite loop caused by legalizing & combining CONCAT_VECTORS
FLZ101 [Tue, 27 Jun 2023 20:57:41 +0000 (13:57 -0700)]
[AArch64][SelectionDAG] fix infinite loop caused by legalizing & combining CONCAT_VECTORS

Legalizing in `AArch64TargetLowering::LowerCONCAT_VECTORS()` and combining in `DAGCombiner::visitCONCAT_VECTORS()` could cause an infinite loop.
This commit fixes that issue by conditionally skipping the combining.

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

Reviewed By: RKSimon, MaskRay

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

12 months ago[Flang][OpenMP] Correct location information 1/n
Kiran Chandramohan [Tue, 27 Jun 2023 20:33:50 +0000 (20:33 +0000)]
[Flang][OpenMP] Correct location information 1/n

This patch fixes location information of a few OpenMP constructs
and clauses. More fixes will come in follow-up patches.

This patch follows the same fixes for OpenACC (D131659).

Addresses some of the issues in https://github.com/llvm/llvm-project/issues/57215

Reviewed By: clementval

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

12 months ago[libcxx] Add new line after assert message
Vitaly Buka [Fri, 20 Jan 2023 07:32:12 +0000 (23:32 -0800)]
[libcxx] Add new line after assert message

Abort signal handler may print aswell. Without new line it goes into the
same.

Reviewed By: #libc, philnik, Mordante

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

12 months ago[flang] Handle empty array references in DATA statements
Peter Klausler [Mon, 26 Jun 2023 18:51:38 +0000 (11:51 -0700)]
[flang] Handle empty array references in DATA statements

When an array reference in a DATA statement is empty due to an
empty vector subscript or a section lower bound being higher than
its upper bound with a positive stride (or lower with negative),
ensure that isEmpty() is correct afterwards so that such an empty
array reference doesn't terminate processing of that DATA statement
block.

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

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

12 months ago[lit] Add a method to lit.TestFormat to get the list of tests associated to a path
Louis Dionne [Mon, 29 May 2023 20:49:33 +0000 (13:49 -0700)]
[lit] Add a method to lit.TestFormat to get the list of tests associated to a path

Lit TestFormat classes already needed to implement the getTestsInDirectory
method. However, some test formats may want to expand a single test path
to multiple Lit tests, for example in the case of a test that actually
generates other Lit tests.

To accommodate that, this commit adds the getTestsForPath method to
TestFormat. This method can be used to turn a single path in a Lit
test suite into a list of tests associated to that path.

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

12 months ago[clang][Sema] Add CodeCompletionContext::CCC_ObjCClassForwardDecl
David Goldman [Tue, 27 Jun 2023 18:16:13 +0000 (14:16 -0400)]
[clang][Sema] Add CodeCompletionContext::CCC_ObjCClassForwardDecl

- Use this new context in Sema to limit completions to seen ObjC class
  names

- Use this new context in clangd to disable include insertions when
  completing ObjC forward decls

Reviewed By: kadircet

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

12 months ago[flang] Avoid crash in error recovery
Peter Klausler [Mon, 26 Jun 2023 17:50:31 +0000 (10:50 -0700)]
[flang] Avoid crash in error recovery

When a PASS() clause names a nonexistent dummy argument, don't crash
later in expression semantics.
Fixes https://github.com/llvm/llvm-project/issues/63487.

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

12 months ago[flang] Catch error: COMMON block and implicit interface external subprogram with...
Peter Klausler [Mon, 26 Jun 2023 17:00:10 +0000 (10:00 -0700)]
[flang] Catch error: COMMON block and implicit interface external subprogram with same name

Declaration checking catches the error of a COMMON block and a subprogram
definition having the same name, but misses the case of a COMMON block
and an a reference to an external subprogram with an implicit interface.
Fix.  Fixes bug https://github.com/llvm/llvm-project/issues/63247.

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

12 months ago[RISCV] Fix a typo in a comment
Philip Reames [Tue, 27 Jun 2023 20:02:54 +0000 (13:02 -0700)]
[RISCV] Fix a typo in a comment

12 months ago[llvm-exegesis] Use correct pid_t definition in SubprocessMemory.h
Aiden Grossman [Tue, 27 Jun 2023 20:01:20 +0000 (20:01 +0000)]
[llvm-exegesis] Use correct pid_t definition in SubprocessMemory.h

Due to failures in MinGW builds I adjusted the preprocessor directives
to be more specific about when to include but kept the old definition in
files that were committed more recently on accident. This patch changes
those definitions to match the fixed ones.

Also fix a typo leftover from the original change in PerfHelper.h.

12 months ago[RISCV] Simplify pseudo classes used by v(f)merge [nfc]
Philip Reames [Tue, 27 Jun 2023 19:27:46 +0000 (12:27 -0700)]
[RISCV] Simplify pseudo classes used by v(f)merge [nfc]

This is mostly hand inlining multiclass definitions, and simplifying for the fact that non-default template values were never actually used.

12 months agoRevert "[clang-tidy] Fix modernize-use-std-print check when return value used"
Piotr Zegar [Tue, 27 Jun 2023 19:25:52 +0000 (19:25 +0000)]
Revert "[clang-tidy] Fix modernize-use-std-print check when return value used"

This reverts commit 3e12b2e207cfa802937488a2c0b90d482eaf00a9.

12 months agoReland "[dataflow] avoid more accidental copies of Environment"
Sam McCall [Mon, 26 Jun 2023 18:01:04 +0000 (20:01 +0200)]
Reland "[dataflow] avoid more accidental copies of Environment"

This reverts commit fb13d027eae405a7be96fd7da0d72422e48a0719.

12 months ago[mlir][VectorType] Allow arbitrary dimensions to be scalable
Andrzej Warzynski [Mon, 19 Jun 2023 12:01:11 +0000 (13:01 +0100)]
[mlir][VectorType] Allow arbitrary dimensions to be scalable

At the moment, only the trailing dimensions in the vector type can be
scalable, i.e. this is supported:

    vector<2x[4]xf32>

and this is not allowed:

    vector<[2]x4xf32>

This patch extends the vector type so that arbitrary dimensions can be
scalable. To this end, an array of bool values is added to every vector
type to denote whether the corresponding dimensions are scalable or not.
For example, for this vector:

  vector<[2]x[3]x4xf32>

the following array would be created:

  {true, true, false}.

Additionally, the current syntax:

  vector<[2x3]x4xf32>

is replaced with:

  vector<[2]x[3]x4xf32>

This is primarily to simplify parsing (this way, the parser can easily
process one dimension at a time rather than e.g. tracking whether
"scalable block" has been entered/left).

NOTE: The `isScalableDim` parameter of `VectorType` (introduced in this
patch) makes `numScalableDims` redundant. For the time being,
`numScalableDims` is preserved to facilitate the transition between the
two parameters. `numScalableDims` will be removed in one of the
subsequent patches.

This change is a part of a larger effort to enable scalable
vectorisation in Linalg. See this RFC for more context:
  * https://discourse.llvm.org/t/rfc-scalable-vectorisation-in-linalg/

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

12 months ago[flang][openacc] Update num_gangs parser
Valentin Clement [Tue, 27 Jun 2023 18:09:59 +0000 (11:09 -0700)]
[flang][openacc] Update num_gangs parser

Update num_gangs definition in ACC.td and its lowering
to support up to 3 arguments.

Depends on D153796
Depends on D153801

Reviewed By: razvanlupusoru

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

12 months ago[tblgen][directive] Fix clause parser generation for list value
Valentin Clement [Tue, 27 Jun 2023 18:09:04 +0000 (11:09 -0700)]
[tblgen][directive] Fix clause parser generation for list value

The clause parser generation was not taking into account the
`isValueList` flag. This patch updates the emitter to generate
the correct code.

Reviewed By: razvanlupusoru

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

12 months agoTemporary switch off labeler on closed issues
Anton Korobeynikov [Tue, 27 Jun 2023 18:08:39 +0000 (11:08 -0700)]
Temporary switch off labeler on closed issues

12 months ago[mlir][openacc] Switch numGangs to a variadic operand
Valentin Clement [Tue, 27 Jun 2023 18:08:22 +0000 (11:08 -0700)]
[mlir][openacc] Switch numGangs to a variadic operand

In the latest spec, the `num_gangs` clause accepts up to three
arguments. Update the dialect to swicth `numGangs` operands from
optional single operand to a variadic operand. The verifier limits
the number of operands to three as specified in the spec.

Reviewed By: razvanlupusoru

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

12 months ago[libc++] __iterator/readable_traits.h isn't standalone
Ian Anderson [Mon, 26 Jun 2023 21:07:50 +0000 (14:07 -0700)]
[libc++] __iterator/readable_traits.h isn't standalone

`__iterator/readable_traits.h` can't be used by itself, intantiating `iter_value_t` requires `__iterator/iterator_traits.h`. `readable_traits.h` can't include `iterator_traits.h` though because `iterator_traits.h` requires `readable_traits.h`.

Move `iter_value_t` to `__iterator/iterator_traits.h` so that both headers can work standalone.

Reviewed By: Mordante, #libc

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

12 months ago[lldb][NFCI] Apply LLDB_DEPRECATED to things that have deprecated comments
Alex Langford [Tue, 27 Jun 2023 00:27:00 +0000 (17:27 -0700)]
[lldb][NFCI] Apply LLDB_DEPRECATED to things that have deprecated comments

Now that we have a proper way to deprecate things in the SB API, we
should apply it where we have manually done so with comments.

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

12 months ago[lldb][NFCI] Remove use of ConstString from PluginManager
Alex Langford [Mon, 26 Jun 2023 21:12:22 +0000 (14:12 -0700)]
[lldb][NFCI] Remove use of ConstString from PluginManager

The underlying structures no longer use ConstString so we can remove it
wholesale from PluginManager now.

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

12 months ago[X86] LowerABD - improve pre-SSE41 handling for v16i8/v4i32 nodes
Simon Pilgrim [Tue, 27 Jun 2023 17:23:06 +0000 (18:23 +0100)]
[X86] LowerABD - improve pre-SSE41 handling for v16i8/v4i32 nodes

The generic expansion still causes a problem for SSE targets without BLENDV/select node, but we can create a custom lowering until that can be addressed.

12 months ago[test][sanitizer] Disable D153500 test on solaris
Vitaly Buka [Tue, 27 Jun 2023 17:32:51 +0000 (10:32 -0700)]
[test][sanitizer] Disable D153500 test on solaris

The test causes unexpectedly high RSS usage there.

12 months ago[DebugInfo] Add error handling to DWARFDebugAbbrev::getAbbreviationDeclarationSet
Alex Langford [Wed, 21 Jun 2023 01:45:03 +0000 (18:45 -0700)]
[DebugInfo] Add error handling to DWARFDebugAbbrev::getAbbreviationDeclarationSet

This gives us more meaningful information when
`getAbbreviationDeclarationSet` fails. Right now only
`verifyAbbrevSection` actually uses the error that it returns, but the
other call sites could be rewritten to take advantage of the returned error.

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

12 months ago[clang-tidy] Fix modernize-use-std-print check when return value used
Mike Crowe [Tue, 27 Jun 2023 16:35:22 +0000 (16:35 +0000)]
[clang-tidy] Fix modernize-use-std-print check when return value used

The initial implementation of the modernize-use-std-print check was
capable of converting calls to printf (etc.) which used the return value
to calls to std::print which has no return value, thus breaking the
code.

Use code inspired by the implementation of bugprone-unused-return-value
check to ignore cases where the return value is used. Add appropriate
lit test cases and documentation.

Reviewed By: PiotrZSL

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

12 months ago[X86] Add getBitSelect helper function to create OR(AND(LHS,MASK),AND(RHS,~MASK)...
Simon Pilgrim [Tue, 27 Jun 2023 17:06:29 +0000 (18:06 +0100)]
[X86] Add getBitSelect helper function to create OR(AND(LHS,MASK),AND(RHS,~MASK)) bit select patterns. NFC.

12 months ago[X86] Fold ANDNP(x, -1) -> NOT(x) -> XOR(x, -1)
Simon Pilgrim [Tue, 27 Jun 2023 13:57:58 +0000 (14:57 +0100)]
[X86] Fold ANDNP(x, -1) -> NOT(x) -> XOR(x, -1)

Prefer XOR to ANDNP as its commutative

12 months ago[gn build] Port f4cf51c99c74
LLVM GN Syncbot [Tue, 27 Jun 2023 17:08:11 +0000 (17:08 +0000)]
[gn build] Port f4cf51c99c74

12 months ago[clang][CFG] Add support for partitioning CFG into intervals.
Yitzhak Mandelbaum [Mon, 5 Jun 2023 20:49:07 +0000 (20:49 +0000)]
[clang][CFG] Add support for partitioning CFG into intervals.

Adds support for the classic dataflow algorithm that partitions a flow graph
into distinct intervals. C.f. Dragon book, pp. 664-666.

A version of this algorithm exists in LLVM (see llvm/Analysis/Interval.h and
related files), but it is specific to LLVM, is a recursive (vs iterative)
algorithm, and uses many layers of abstraction that seem unnecessary for CFG
purposes.

This patch is part 1 of 2. The next patch will generalize the code to work on
intervals, to support computation of the limit flow graph.

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

12 months ago[llvm-exegesis][NFC] Fix unused function 'IsMovRegToReg' warning
Jake Egan [Tue, 27 Jun 2023 17:00:46 +0000 (13:00 -0400)]
[llvm-exegesis][NFC] Fix unused function 'IsMovRegToReg' warning

/scratch/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp:88:17: error: unused function 'IsMovRegToReg' [-Werror,-Wunused-function]
Matcher<MCInst> IsMovRegToReg(unsigned Opcode, int64_t Reg1, int64_t Reg2) {
1 error generated.

12 months ago[RISCV] Split double out of compress-float.ll. Add Zcf and Zcd RUN lines.
Craig Topper [Tue, 27 Jun 2023 16:39:05 +0000 (09:39 -0700)]
[RISCV] Split double out of compress-float.ll. Add Zcf and Zcd RUN lines.

Make Zcf/Zcd depend on Zca.

Reviewed By: asb

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

12 months ago[RISCV] Fix encoding for Zcb instruction c.sh.
Craig Topper [Tue, 27 Jun 2023 16:38:43 +0000 (09:38 -0700)]
[RISCV] Fix encoding for Zcb instruction c.sh.

Bit 6 should be 0.

Reviewed By: asb

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

12 months agoAdd myself as Loop Vectorizer code owner.
Florian Hahn [Tue, 27 Jun 2023 16:43:51 +0000 (17:43 +0100)]
Add myself as Loop Vectorizer code owner.

For more details about the nomination, please see
https://discourse.llvm.org/t/rfc-proposing-changes-to-the-code-owner-for-the-llvm-vectorizers/70267/9

12 months ago[libc++][doc] Fixes header formatting.
Mark de Wever [Tue, 27 Jun 2023 16:39:59 +0000 (18:39 +0200)]
[libc++][doc] Fixes header formatting.

This was broken in D145628; it caused the new header not to be displayed
as a header at all and show part of the markup as text.

12 months ago[RISCV] Replace uses of TAIL_UNDISTURBED_MASK_UNDISTURBED with TU_MU. NFC
Craig Topper [Tue, 27 Jun 2023 16:37:28 +0000 (09:37 -0700)]
[RISCV] Replace uses of TAIL_UNDISTURBED_MASK_UNDISTURBED with TU_MU. NFC

12 months ago[PowerPC][TLS] Add additional TLS X-Form loads/store instructions
Amy Kwan [Tue, 27 Jun 2023 03:26:31 +0000 (22:26 -0500)]
[PowerPC][TLS] Add additional TLS X-Form loads/store instructions

This patch is a follow up to D43315, and adds the following new load/store
TLS specific instructions for integer and floating point scalar types:
```
LHAXTLS
LWAXTLS
LHAXTLS_32
LWAXTLS_32
LFSXTLS
LFDXTLS
STFSXTLS
STFDXTLS
```
These instructions can be used to optimized TLS sequences when D-Form
loads/stores follow an ADD_TLS instruction.

Duplicate versions of these instructions are also added within an isAsmParserOnly=1
block (similar to D47382) to allow llvm-mc to assemble these instructions.

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

12 months agoReland [InstCombine] Infer inbounds for more GEPs of dereferenceable pointers
Arthur Eubanks [Mon, 26 Jun 2023 20:52:18 +0000 (13:52 -0700)]
Reland [InstCombine] Infer inbounds for more GEPs of dereferenceable pointers

Use Value::getPointerDereferenceableBytes() instead of hardcoding dereferenceable only for allocas. Allows us to infer inbounds GEPs for other Values like CallInsts and Arguments.

Fixed clang test broken in initial land.

Reviewed By: nikic

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

12 months ago[ConstraintElim] Track and simplify conditions at use.
Florian Hahn [Tue, 27 Jun 2023 16:27:48 +0000 (17:27 +0100)]
[ConstraintElim] Track and simplify conditions at use.

This patch updates ConstraintElimination to track uses of conditions in
the worklist. This allows simplifying conditions using the context that
holds directly at the condition, instead of where the condition is
defined.

This allows us to catch more cases in practice: there are multiple
code-size changes for CTMark while compile-time remains unchanged:
https://llvm-compile-time-tracker.com/compare.php?from=4b020cca9363bebab4643f89cfa92ab2fcc7976c&to=7a6e84b8f029713c137814cd46eec775d24a54a1&stat=instructions:u

This should help to simplify D151799.

Reviewed By: nikic

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

12 months agoRevert "[InstCombine] Infer inbounds for more GEPs of dereferenceable pointers"
Arthur Eubanks [Tue, 27 Jun 2023 16:26:26 +0000 (09:26 -0700)]
Revert "[InstCombine] Infer inbounds for more GEPs of dereferenceable pointers"

This reverts commit cd43b19c0127d80f3543803359db0f03e363e893.

Breaks clang/test/CodeGenOpenCL/builtins-amdgcn.cl.

12 months ago[builtins] Fix __floattitf and __floatuntitf on x86
Alex Richardson [Tue, 27 Jun 2023 16:13:39 +0000 (09:13 -0700)]
[builtins] Fix __floattitf and __floatuntitf on x86

These conversion functions were using LDBL_MANT_DIG (which is the 80-bit
extended float on x86) instead of the appropriate macro for the 128-bit
floating point type expected by the *tf* softfloat library calls.
This was discovered while testing D98261 (which allows building the *tf*
functions on x86).

This also changes the constants used in the two tests to use 128-bit
floating-point literals instead of long double ones to ensure that the
comparison succeeds on platforms with smaller long double (e.g. x86_64)

Reviewed By: scanon

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

12 months agoRevert "[DebugInfo][InstrRef] Instrument x86 CMOV conversion to preserve variable...
Stephen Tozer [Tue, 27 Jun 2023 16:15:29 +0000 (17:15 +0100)]
Revert "[DebugInfo][InstrRef] Instrument x86 CMOV conversion to preserve variable values"

This reverts commit 2325e0112ae7ef47244277da81920ba90ffadd89.

Reverted due to buildbot failure: llvm-clang-x86_64-expensive-checks-debian

12 months ago[InstCombine] Infer inbounds for more GEPs of dereferenceable pointers
Arthur Eubanks [Mon, 26 Jun 2023 20:52:18 +0000 (13:52 -0700)]
[InstCombine] Infer inbounds for more GEPs of dereferenceable pointers

Use Value::getPointerDereferenceableBytes() instead of hardcoding dereferenceable only for allocas. Allows us to infer inbounds GEPs for other Values like CallInsts and Arguments.

Reviewed By: nikic

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

12 months ago[test] Precommit test for D153815
Arthur Eubanks [Mon, 26 Jun 2023 20:45:18 +0000 (13:45 -0700)]
[test] Precommit test for D153815

12 months ago[RISCV] Remove legacy TA/TU pseudo distinction for VID
Philip Reames [Tue, 27 Jun 2023 16:05:03 +0000 (09:05 -0700)]
[RISCV] Remove legacy TA/TU pseudo distinction for VID

This is a follow on to D152740. The focus of this patch is on actually removing the old TA (unsuffixed) version. I realized we already had plumbing for combined TA/TU pseudos - used by some of the ternary instructions. As such, we can go ahead and fully remove the old TA, and rename the _TU variant to be unsuffixed. (The rename must happen in this patch for the table structure to work out as expected.)

The scheduling difference comes from an omission in D152740. If we selected a _MASK variant - either from manual ISEL or instrincs - we were going through doPeepholeMaskedRVV and still getting the TA variant. The use of the IsCombined flag in the MaskedPseudo table causes us to use the TU (now unsuffixed) variant instead.

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

12 months ago[gn build] Port 58056ae29963
LLVM GN Syncbot [Tue, 27 Jun 2023 15:43:09 +0000 (15:43 +0000)]
[gn build] Port 58056ae29963

12 months agoReland: [ELFAttributeParser] Skip unknown vendor subsections.
Simon Tatham [Tue, 20 Jun 2023 12:44:38 +0000 (13:44 +0100)]
Reland: [ELFAttributeParser] Skip unknown vendor subsections.

An .ARM.attributes section is divided into subsections, each labelled
with a vendor name. There is one standardised vendor name, which must
be used for all attributes that affect compatibility. Subsections
labelled with other vendor names can be used for optimisation
purposes, but it has to be safe for an object file consumer to ignore
them if it doesn't recognise the vendor name.

LLD currently terminates parsing of the whole attributes section as
soon as it encounters a subsection with a vendor name it doesn't
recognise (which is anything other than the standard one). This can
prevent it from detecting compatibility issues, if a standard
subsection followed the vendor-specific one.

This patch modifies the attribute parser so that unrecognised vendor
subsections are silently skipped, and the subsections beyond them are
still processed.

(Relanded with no change from the original commit 8f208edd44d0832. I
reverted it in 949bb7e4de62cd0 due to widespread buildbot breakage,
failing to notice that 975f71faa72aaaa had already fixed the failing
unit test. Also, the *revert* caused at least one buildbot to fail,
because I switched the affected lld test to making %t a directory, and
then the reverted version tried to treat it as a file without cleaning
the output directory first.)

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

12 months ago[clang][ExprConstant] Fix display of syntactically-invalid note for member function...
Takuya Shimizu [Tue, 27 Jun 2023 15:19:46 +0000 (00:19 +0900)]
[clang][ExprConstant] Fix display of syntactically-invalid note for member function calls

This patch makes the display of member function calls more true to the user-written code by making use of the syntactical structure of the function calls.
This patch also changes the display of conventional value-based printing from arrow operator to dot operator.
This avoids the syntactical invalidness in notes previously caused by the display of & operator
(lack of parentheses and reference of rvalue)

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

Reviewed By: cjdb
Differential Revision: https://reviews.llvm.org/D151720

12 months agoFix the ComplexDeinterleaving bug when handling mixed reductions.
Igor Kirillov [Tue, 27 Jun 2023 12:33:49 +0000 (12:33 +0000)]
Fix the ComplexDeinterleaving bug when handling mixed reductions.

Add a missing check that ensures that ComplexDeinterleaving for reduction
is only analyzed for Real and Imaginary Instructions of the same type.

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

12 months ago[clang] Replace uses of CGBuilderTy::CreateElementBitCast (NFC)
Youngsuk Kim [Tue, 27 Jun 2023 14:17:29 +0000 (10:17 -0400)]
[clang] Replace uses of CGBuilderTy::CreateElementBitCast (NFC)

Partial progress towards replacing `CreateElementBitCast`, as it no
longer does what its name suggests. Either replace its uses with
`Address::withElementType()`, or remove them if no longer needed.

Reviewed By: barannikov88, nikic

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

12 months ago[DebugInfo][InstrRef] Instrument x86 CMOV conversion to preserve variable values
Jeremy Morse [Tue, 27 Jun 2023 13:17:19 +0000 (14:17 +0100)]
[DebugInfo][InstrRef] Instrument x86 CMOV conversion to preserve variable values

X86's CMOV conversion transforms CMOV instructions into control flow between
blocks, meaning the value is computed by a PHI rather than a "real" machine
instruction. In instruction-referencing mode, we need to transfer the
instruction label between the old CMOV and the new PHI instruction to mark
where the variable value is computed.

There's an extra complication in that memory operands can be unfolded from the
CMOV and sunk into the new blocks -- the test checks both scenarios where the
instruction number has to hop between instructions.

This omission exposed by Dexter testing.

Reviewed By: Orlando

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

12 months ago[llvm] Move AttributeMask to a separate header
Elliot Goodrich [Sun, 25 Jun 2023 17:04:47 +0000 (18:04 +0100)]
[llvm] Move AttributeMask to a separate header

Move `AttributeMask` out of `llvm/IR/Attributes.h` to a new file
`llvm/IR/AttributeMask.h`.  After doing this we can remove the
`#include <bitset>` and `#include <set>` directives from `Attributes.h`.
Since there are many headers including `Attributes.h`, but not needing
the definition of `AttributeMask`, this causes unnecessary bloating of
the translation units and slows down compilation.

This commit adds in the include directive for `llvm/IR/AttributeMask.h`
to the handful of source files that need to see the definition.

This reduces the total number of preprocessing tokens across the LLVM
source files in lib from (roughly) 1,917,509,187 to 1,902,982,273 - a
reduction of ~0.76%. This should result in a small improvement in
compilation time.

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

12 months ago[OpenMP] Always apply target declarations to canonical definitions
Joseph Huber [Tue, 20 Jun 2023 17:03:48 +0000 (12:03 -0500)]
[OpenMP] Always apply target declarations to canonical definitions

This patch changes the handling of OpenMP to add the device attributes
to the canonical definitions when we encounter a non-canonical
definition. Previously, the following code would not work because it
would find the non-canonical definition first which would then not be
used anywhere else.

```
int x;
extern int x;
```

This patch now adds the attribute to both of them. This allows us to
perform the following operation if, for example, there were an
implementation of `stderr` on the device.

```
#include <stdio.h>

// List of libc symbols supported on the device.
extern FILE *stderr;
```

Unfortunately I cannot think of an equivalent solution to HIP / CUDA
device declarations as those are done with simple attributes. Attributes
themselves cannot be used to affect a definition once its canonical
definition has already been seen. Some help on that front would be
appreciated.

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

Reviewed By: ABataev

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

12 months agoRevert "[LLDB] Fix the use of "platform process launch" with no extra arguments"
David Spickett [Tue, 27 Jun 2023 14:04:41 +0000 (14:04 +0000)]
Revert "[LLDB] Fix the use of "platform process launch" with no extra arguments"

This reverts commit cc0fc358540517a3d205243c27bd543afeae2b02 due to a failure
reported on MacOS.

12 months ago[ARM] in ExpandTMOV32BitImm, CPSR register ops should be `Define`d
Ties Stuij [Tue, 27 Jun 2023 13:28:53 +0000 (14:28 +0100)]
[ARM] in ExpandTMOV32BitImm, CPSR register ops should be `Define`d

The CPSR registers ops of the instructions constructed in ExpandTMOV32BitImm
were marked as kill, instead of define. Best to use the pre-existing
t1CondCodeOp fn to construct CPSRs.

Reviewed By: simonwallis2

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

12 months ago[libc++][NFC] Add missing includes to perfect_forward.h
Louis Dionne [Mon, 26 Jun 2023 19:08:26 +0000 (15:08 -0400)]
[libc++][NFC] Add missing includes to perfect_forward.h

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

12 months ago[X86] SimplifyDemandedBitsForTargetNode - add X86ISD::ANDNP handling
Simon Pilgrim [Tue, 27 Jun 2023 13:22:50 +0000 (14:22 +0100)]
[X86] SimplifyDemandedBitsForTargetNode - add X86ISD::ANDNP handling

Add X86ISD::ANDNP handling to targetShrinkDemandedConstant as well, which allows us to replace a lot of truncated masks with (rematerializable) allones values

12 months agoRevert "[ELFAttributeParser] Skip unknown vendor subsections."
Simon Tatham [Tue, 27 Jun 2023 13:21:16 +0000 (14:21 +0100)]
Revert "[ELFAttributeParser] Skip unknown vendor subsections."

This reverts commit 8f208edd44d0832ac2580e0ec4238be4ecfd5737.

I completely missed the compiled unit test for ELFAttributeParser,
which also needs updating. I'll reland this change once I make further
fixes.

12 months ago[InstSimplify] Make sure offsets have same size in computePointerICmp()
Nikita Popov [Tue, 27 Jun 2023 12:53:40 +0000 (14:53 +0200)]
[InstSimplify] Make sure offsets have same size in computePointerICmp()

The way this is currently implemented the accumulated offsets can
end up having a different size, which causes unnecessary
complication for further extension of the code.

Don't strip pointer casts at the start and rely on
stripAndAccumulate to do any necessary stripping. It gracefully
handles different index sizes and will always retain the width of
the original pointer index type.

This is not NFC, but unlikely to make any practical difference.

12 months agoRevert "[llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed...
Haojian Wu [Tue, 27 Jun 2023 13:15:02 +0000 (15:15 +0200)]
Revert "[llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed using MD5 as key to Sample Profile map"

This reverts commit 12e9c7aaa66b7624b5d7666ce2794d912bf9e4b7.

The commit has broken the buildbot, see comment https://reviews.llvm.org/D147740#4451540