platform/upstream/llvm.git
2 years ago[openmp] Fix enumeration build issue for openmp library
Ron Lieberman [Tue, 9 Aug 2022 10:07:28 +0000 (10:07 +0000)]
[openmp] Fix enumeration build issue for openmp library

integer value 40962 is outside the valid range of values [0, 31] for this enumeration type [-Wenum-constexpr-conversion]` (Issue #57022)

turn on -Wno-enum-constexpr-conversion to buy some time to fix the more egregious issue in hsa_agent_into_t and hsa_amd_agent_info_t interfaces.

relates to https://reviews.llvm.org/D131307/new/

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

2 years ago[AMDGPU][MC][GFX11][NFC] Split large tests
Dmitry Preobrazhensky [Tue, 9 Aug 2022 10:12:59 +0000 (13:12 +0300)]
[AMDGPU][MC][GFX11][NFC] Split large tests

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

2 years ago[Sema] Merge variable template specializations
Ilya Biryukov [Tue, 9 Aug 2022 09:50:18 +0000 (11:50 +0200)]
[Sema] Merge variable template specializations

Clang used to produce redefinition errors, see tests for examples.

Reviewed By: ChuanqiXu

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

2 years ago[ARM] Use getSymbolPreferLocal() in GetARMGVSymbol
Alex Richardson [Tue, 9 Aug 2022 09:36:29 +0000 (09:36 +0000)]
[ARM] Use getSymbolPreferLocal() in GetARMGVSymbol

This allows relaxing some relocations to STT_SECTION symbol+offset
instead of emitting a relocation against a symbol.

Reviewed By: MaskRay

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

2 years ago[Thumb] Baseline test for incorrect relocation with -ffunction-sections
Alex Richardson [Tue, 9 Aug 2022 09:52:41 +0000 (09:52 +0000)]
[Thumb] Baseline test for incorrect relocation with -ffunction-sections

When calling a dso_local function, we end up creating a call against the
.Lfoo$local label. This might be converted to a relocation against a
section if there is such a matching one (which is a lot more likely with
-ffunction-sections) and then the LSB (Thumb flag) will be lost.

I originally noticed this with Morello LLVM (which uses the LSB to indicate
a C64 encoding mode function). The missing LSB meant that ld.lld would
insert a thunk that switches encoding mode which then resulted in errors
at runtime since functions were being entered with the wrong encoding mode.
Since the Morello backend is not upstream, I looked if any in-tree
backends could also be affected by the missing STT_FUNC flag and noticed
that Thumb is also affected (although the bug is rather difficult to
trigger - it currently requires inline assembly).

Reviewed By: MaskRay

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

2 years ago[ARM] Emit local aliases (.Lfoo$local) for functions
Alex Richardson [Tue, 9 Aug 2022 09:06:48 +0000 (09:06 +0000)]
[ARM] Emit local aliases (.Lfoo$local) for functions

ARMAsmPrinter::emitFunctionEntryLabel() was not calling the base class
function so the $local alias was not being emitted. This should not have
any function effect right now since ARM does not generate different code
for the $local symbols, but it could be improved in the future.

Reviewed By: MaskRay

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

2 years ago[ARM] Add a baseline test for D131392
Alex Richardson [Tue, 9 Aug 2022 09:17:28 +0000 (09:17 +0000)]
[ARM] Add a baseline test for D131392

We should be emitting .Lfoo$local aliases for dso_local functions.

2 years ago[ARM] Add a baseline elf-preemption test
Alex Richardson [Tue, 9 Aug 2022 09:04:47 +0000 (09:04 +0000)]
[ARM] Add a baseline elf-preemption test

This is based on the RISC-V elf-preemption.ll (converted to opaque
pointers) and is useful for test coverage for the patch series starting
with D131392.

2 years ago[Support] TaskQueue.h - replace std::result_of_t with std::invoke_result_t
Simon Pilgrim [Tue, 9 Aug 2022 09:52:39 +0000 (10:52 +0100)]
[Support] TaskQueue.h - replace std::result_of_t with std::invoke_result_t

std::result_of_t is deprecated in C++17

Fixes #57023

2 years ago[clang-pseudo] Forest.h - don't inherit from std::iterator
Simon Pilgrim [Tue, 9 Aug 2022 09:18:40 +0000 (10:18 +0100)]
[clang-pseudo] Forest.h - don't inherit from std::iterator

Now that we've updated to C++17 MSVC gives very verbose warnings about not creating classes that inherit from std::iterator - use llvm::iterator_facade_base instead

Fixes #57005

2 years ago[cmake] Fix ms-compat version in WinMsvc.cmake
Tobias Hieta [Tue, 9 Aug 2022 09:13:49 +0000 (11:13 +0200)]
[cmake] Fix ms-compat version in WinMsvc.cmake

As pointed out by @glandium here https://reviews.llvm.org/D130689#3709088
we updated the requirement of MSVC compatibility but not the flag passed when
using WinMsvc.cmake as a toolchain.

2 years ago[DAG] canCreateUndefOrPoison - add freeze(ctpop(x)) -> ctpop(freeze(x)) and freeze...
Simon Pilgrim [Tue, 9 Aug 2022 09:10:29 +0000 (10:10 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(ctpop(x)) -> ctpop(freeze(x)) and freeze(parity(x)) -> parity(freeze(x)) support

Both are guaranteed not to create undef/poison

2 years agoFix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Tue, 9 Aug 2022 08:55:35 +0000 (09:55 +0100)]
Fix MSVC "not all control paths return a value" warning. NFC.

2 years ago[mlir][OpenMP] omp.parallel side effects
Shraiysh Vaishay [Mon, 8 Aug 2022 15:18:55 +0000 (15:18 +0000)]
[mlir][OpenMP] omp.parallel side effects

Add `NoSideEffects` trait to omp.parallel operation.

Reviewed By: ftynse

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

2 years ago[RelLookupTableConverter] Bail on invalid pointer size (x32)
Nikita Popov [Mon, 8 Aug 2022 14:13:09 +0000 (16:13 +0200)]
[RelLookupTableConverter] Bail on invalid pointer size (x32)

The RelLookupTableConverter pass currently only supports 64-bit
pointers.  This is currently enforced using an isArch64Bit() check
on the target triple. However, we consider x32 to be a 64-bit target,
even though the pointers are 32-bit. (And independently of that
specific example, there may be address spaces with different pointer
sizes.)

As such, add an additional guard for the size of the pointers that
are actually part of the lookup table.

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

2 years ago[clang][ASTImporter] Improve import of functions with auto return type.
Balázs Kéri [Tue, 9 Aug 2022 06:40:09 +0000 (08:40 +0200)]
[clang][ASTImporter] Improve import of functions with auto return type.

ASTImporter used to crash in some cases when a function is imported with
`auto` return type and the return type has references into the function.
The handling of such cases is improved and crash should not occur any more
but it is not fully verified, there are very many different types of
cases to care for.

Reviewed By: martong

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

2 years agoLLVM_NODISCARD => [[nodiscard]]. NFC
Fangrui Song [Tue, 9 Aug 2022 07:16:34 +0000 (07:16 +0000)]
LLVM_NODISCARD => [[nodiscard]]. NFC

2 years ago[clang][clang-tools-extra] LLVM_NODISCARD => [[nodiscard]]. NFC
Fangrui Song [Tue, 9 Aug 2022 07:11:18 +0000 (07:11 +0000)]
[clang][clang-tools-extra] LLVM_NODISCARD => [[nodiscard]]. NFC

2 years ago[LoongArch] Add codegen support for not
gonglingqin [Tue, 9 Aug 2022 06:04:53 +0000 (14:04 +0800)]
[LoongArch] Add codegen support for not

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

2 years ago[LoongArch] Implement branch analysis
wanglei [Tue, 9 Aug 2022 05:53:34 +0000 (13:53 +0800)]
[LoongArch] Implement branch analysis

This allows a number of optimisation passes to work.
E.g. BranchFolding and MachineBlockPlacement.

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

2 years ago[LoongArch] Add codegen support for bswap
WANG Xuerui [Tue, 9 Aug 2022 05:41:03 +0000 (13:41 +0800)]
[LoongArch] Add codegen support for bswap

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

2 years ago[llvm] Don't rely on C++17 deduction guide for array creation
Jonas Devlieghere [Tue, 9 Aug 2022 05:11:23 +0000 (22:11 -0700)]
[llvm] Don't rely on C++17 deduction guide for array creation

Seems like at least one bot (clang-ppc64-aix) is having trouble with the
C++17 deduction guide for array creation. Specify the template arguments
explicitly.

2 years ago[globalisel] Select register bank for DBG_VALUE
Luo, Yuanke [Sat, 2 Jul 2022 08:18:43 +0000 (16:18 +0800)]
[globalisel] Select register bank for DBG_VALUE

The register operand of DBG_VALUE is not selected to a proper register
bank in both AArch64 and X86. This would cause getRegClass crash after
global ISel. After discussion, we think the MIR should assume all
vritual register should be set proper register class after global ISel,
so this patch is to fix the gap of DBG_VALUE for AArch64 and X86.

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

2 years ago[asan] Faster version of QuickCheckForUnpoisonedRegion
Vitaly Buka [Tue, 9 Aug 2022 04:38:55 +0000 (21:38 -0700)]
[asan] Faster version of QuickCheckForUnpoisonedRegion

Slightly helps with performance regression after D128146.

2 years ago[llvm] Alternative attempt at fixing the modules build with C++17
Jonas Devlieghere [Tue, 9 Aug 2022 04:56:16 +0000 (21:56 -0700)]
[llvm] Alternative attempt at fixing the modules build with C++17

My initial attempt in db008af50153 resulted in "error: no viable
constructor or deduction guide for deduction of template arguments of
'array'". Let's see if we can work around that by using an ArrayRef with
an explicit template argument.

2 years ago[Basic] Deprecate MapEntryOptionalStorage::{hasValue,getValue}
Kazu Hirata [Tue, 9 Aug 2022 04:33:09 +0000 (21:33 -0700)]
[Basic] Deprecate MapEntryOptionalStorage::{hasValue,getValue}

MapEntryOptionalStorage is an underlying storage class for
OptionalStorage<clang::DirectoryEntryRef>.

This patch deprecates:

  OptionalStorage<clang::DirectoryEntryRef>::hasValue
  OptionalStorage<clang::DirectoryEntryRef>::getValue

as there is no known users of these two methods.

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

2 years ago[NFC] fix warning
Chen Zheng [Tue, 9 Aug 2022 04:18:09 +0000 (00:18 -0400)]
[NFC] fix warning

2 years ago[MachinePipeliner] Fix Phi generation failure for large stages
Yuta Mukai [Tue, 9 Aug 2022 04:11:24 +0000 (13:11 +0900)]
[MachinePipeliner] Fix Phi generation failure for large stages

The previous code overwrites VRMap for prologue stages during Phi
generation if a register spans many stages.
As a result, the wrong register is used as the one coming from
the prologue in Phis at later stages. (A process exists to correct
this, but it does not work in all cases.)
In addition, VRMap for prologue must be preserved until addBranches().

This patch fixes them by separating the map for Phis into a different
variable (VRMapPhi).

Reviewed By: bcahoon

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

2 years agoLLVM_FALLTHROUGH => [[fallthrough]]. NFC
Fangrui Song [Tue, 9 Aug 2022 04:06:52 +0000 (04:06 +0000)]
LLVM_FALLTHROUGH => [[fallthrough]]. NFC

2 years ago[mlir] LLVM_FALLTHROUGH => [[fallthrough]]. NFC
Fangrui Song [Tue, 9 Aug 2022 03:56:05 +0000 (20:56 -0700)]
[mlir] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

2 years ago[lldb] Refactor Symbols::DownloadObjectAndSymbolFile
Jonas Devlieghere [Tue, 9 Aug 2022 03:12:57 +0000 (20:12 -0700)]
[lldb] Refactor Symbols::DownloadObjectAndSymbolFile

 - Reduce indentation
 - Extract caching of the DbgShellCommand and the dsymForUUID executable
   (or equivalent)
 - Check the DBGShellCommands before falling back to
   /usr/local/bin/dsymForUUID
 - Don't check ~rc/bin/dsymForUUID
 - Improve error reporting
 - Don't cache the value of LLDB_APPLE_DSYMFORUUID_EXECUTABLE

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

2 years ago[LLDB] Remove undefined behavior in TestConstStaticIntegralMember.py
Shafik Yaghmour [Tue, 9 Aug 2022 02:23:53 +0000 (19:23 -0700)]
[LLDB] Remove undefined behavior in TestConstStaticIntegralMember.py

Setting an enum without a fixed underlying type to a value which is outside the
value range is undefined behavior.

The initializer needs to be a constant expression and therefore this was always
ill-formed we just were not diagnosing it before.

See D130058 and D131307 for more details.

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

2 years ago[asan] Avoid few branches on memcpy hot path
Vitaly Buka [Tue, 9 Aug 2022 01:34:01 +0000 (18:34 -0700)]
[asan] Avoid few branches on memcpy hot path

2 years ago[NFC][asan] Fix Condition annotation after 30bbb73bb448
Vitaly Buka [Tue, 9 Aug 2022 01:33:43 +0000 (18:33 -0700)]
[NFC][asan] Fix Condition annotation after 30bbb73bb448

2 years ago[Driver] Add -Xclang= as an alias for -Xclang
Fangrui Song [Tue, 9 Aug 2022 02:05:24 +0000 (19:05 -0700)]
[Driver] Add -Xclang= as an alias for -Xclang

Driver options taking a value typically use `=` as the separator, instead of a
space. Unfortunately many older driver options do not stick with the rule, but I
find -Xclang used a lot and will be convenient if -Xclang= exists.

For build systems using a string array instead of a string to indicate compiler options,
`["-Xclang=-foo"]` is more convenient than `["-Xclang", "-foo"]`.
If a tool wants to filter out -Xclang=-foo, it is trivial for the `=` form, but
complex for the space separated form.

Reviewed By: jhuber6

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

2 years ago[AArch64] Fix and add A64FX scheduling resource/latency info
Yuta Mukai [Mon, 8 Aug 2022 11:45:54 +0000 (20:45 +0900)]
[AArch64] Fix and add A64FX scheduling resource/latency info

1. Missing instruction information (FTSSEL, FMSB, PFIRST and RDFFR)
   is added and CompleteModel is set to one.

2. Information for pseudo SVE instructions is added. Those
   instructions are present at the time of scheduling.

3. Resource and latency information for SVE instructions is modified
   to be more accurate.
   For example, the description for CMPEQ, which consumes one cycle
   each of unit FLA and PPR, is as follows.
```
Previous:
  def A64FXGI01 : ProcResGroup<[A64FXIPFLA, A64FXIPPR]>;
  def A64FXWrite_4Cyc_GI01 : SchedWriteRes<[A64FXGI01]> {...
Modified:
  def A64FXGI0 : ProcResGroup<[A64FXIPFLA]>;
  def A64FXGI1 : ProcResGroup<[A64FXIPPR]>;
  def A64FXWrite_CMP : SchedWriteRes<[A64FXGI0, A64FXGI1]> {...
```

Reference: A64FX Microarchitecture Manual (Table 16-3)
https://github.com/fujitsu/A64FX/blob/master/doc/A64FX_Microarchitecture_Manual_en_1.7.pdf

Reviewed By: dmgreen, kawashima-fj

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

2 years ago[PowerPC] mapping hardward loop intrinsics to powerpc pseudo
Chen Zheng [Fri, 8 Apr 2022 07:24:46 +0000 (03:24 -0400)]
[PowerPC] mapping hardward loop intrinsics to powerpc pseudo

Map hardware loop intrinsics loop_decrement and set_loop_iteration
to the new PowerPC pseudo instructions, so that the hardware loop
intrinsics will be expanded to normal cmp+branch form or ctrloop
form based on the CTR register usage on MIR level.

Reviewed By: lkail

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

2 years ago[mlir][tosa] Use arith::maxf/arith::minf in lowering from tosa
Thomas Raoux [Tue, 9 Aug 2022 01:10:08 +0000 (01:10 +0000)]
[mlir][tosa] Use arith::maxf/arith::minf in lowering from tosa

now that `arith` dialect has maxf/minf use it instead of cmp/select.
Also refactor clamp helpers to make them simlper.

Reviewed By: rsuderman

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

2 years ago[CMake] Build lib/gwp_asan/tests with -std=c++17
Fangrui Song [Tue, 9 Aug 2022 00:51:17 +0000 (17:51 -0700)]
[CMake] Build lib/gwp_asan/tests with -std=c++17

With the recent llvm-project C++17 switch (D130689), gwp_asan/tests may fail to
link with some versions of GCC (https://github.com/llvm/llvm-project/issues/56994):

> backtrace.cpp:(.text+0xca6): undefined reference to `gwp_asan::AllocationMetadata::kMaxTraceLengthToCollect'

I cannot reproduce this issue by myself, but notice that currently
lib/gwp_asan/*.cpp get -std=c++17 while lib/gwp_asan/tests/*.cpp don't
(therefore may use -std=g++14 default from Clang and older GCC). Using -std=c++17
for lib/gwp_asan/tests will ensure that backtrace.cpp uses inline variable and will assuredly avoid the
possible GCC issue.

In the long-term, we should add -std=c++17 to a central place like generate_compiler_rt_tests.

Reviewed By: dyung

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

2 years ago[NFC][asan] Add LIKELY/UNLIKELY on hot memcpy paths
Vitaly Buka [Mon, 8 Aug 2022 22:52:28 +0000 (15:52 -0700)]
[NFC][asan] Add LIKELY/UNLIKELY on hot memcpy paths

2 years ago[Clang] Allow downgrading to a warning the diagnostic for setting a non fixed enum...
Shafik Yaghmour [Mon, 8 Aug 2022 22:17:34 +0000 (15:17 -0700)]
[Clang] Allow downgrading to a warning the diagnostic for setting a non fixed enum to a value outside the range of the enumeration values

In D130058 we diagnose the undefined behavior of setting the value outside the
range of the enumerations values for an enum without a fixed underlying type.

Based on feedback we will provide users to the ability to downgrade this
diagnostic to a waring to allow for a transition period. We expect to turn this
diagnostic to an error in the next release.

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

2 years ago[NFC][asan] Clang-format a file
Vitaly Buka [Mon, 8 Aug 2022 22:32:14 +0000 (15:32 -0700)]
[NFC][asan] Clang-format a file

2 years ago[X86] Add 64bits test cases for D131358
Amaury Séchet [Mon, 8 Aug 2022 23:11:44 +0000 (23:11 +0000)]
[X86] Add 64bits test cases for D131358

2 years ago[mlir][tosa] Updates tosa.equal to use the InferTensorType interface
not-jenni [Mon, 8 Aug 2022 22:19:51 +0000 (15:19 -0700)]
[mlir][tosa] Updates tosa.equal to use the InferTensorType interface

Reviewed By: jpienaar

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

2 years ago[flang] Don't compute pointer component procedure characteristics when not needed
Peter Klausler [Wed, 3 Aug 2022 19:21:17 +0000 (12:21 -0700)]
[flang] Don't compute pointer component procedure characteristics when not needed

When a procedure pointer component has an interface that is a forward
reference to a procedure, syntax errors can be emitted if there is
a structure constructor that tries to initialize that component,
since its characteristics are not yet known; however, when the
initializer is a bare NULL(with no mold), those characteristics
don't matter.  Make the characterization of the procedure pointer
component take place only when needed.

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

2 years ago[llvm-profgen] Fix perf script parsing issues
wlei [Mon, 8 Aug 2022 22:24:14 +0000 (15:24 -0700)]
[llvm-profgen] Fix perf script parsing issues

Fix two perf script parsing issues:

1) Redirect the error message to a new file. (the error message mixed in the perfscript could screw up the MMAP event line and cause a parsing failure)

2) Changed the MMap parsing error message to warning since the perfscript can still be parsed using the preferred address as base address.

Reviewed By: hoy, wenlei

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

2 years agoPartially revert "[llvm] Repair the modules build with C++17"
Jonas Devlieghere [Mon, 8 Aug 2022 22:24:26 +0000 (15:24 -0700)]
Partially revert "[llvm] Repair the modules build with C++17"

This reverts commit db008af501534d4590542253ae3acf783986f5f7 because
this now breaks the non-module build...

2 years agoImplement better path matching in FileSpecList::FindCompatibleIndex(...).
Greg Clayton [Fri, 22 Jul 2022 22:12:50 +0000 (15:12 -0700)]
Implement better path matching in FileSpecList::FindCompatibleIndex(...).

Currently a FileSpecList::FindFileIndex(...) will only match the specified FileSpec if:
- it has filename and directory and both match exactly
- if has a filename only and any filename in the list matches

Because of this, we modify our breakpoint resolving so it can handle relative paths by doing some extra code that removes the directory from the FileSpec when searching if the path is relative.

This patch is intended to fix breakpoints so they work as users expect them to by adding the following features:
- allow matches to relative paths in the file list to match as long as the relative path is at the end of the specified path at valid directory delimiters
- allow matches to paths to match if the specified path is relative and shorter than the file paths in the list

This allows us to remove the extra logic from BreakpointResolverFileLine.cpp that added support for setting breakpoints with relative paths.

This means we can still set breakpoints with relative paths when the debug info contains full paths. We add the ability to set breakpoints with full paths when the debug info contains relative paths.

Debug info contains "./a/b/c/main.cpp", the following will set breakpoints successfully:
- /build/a/b/c/main.cpp
- a/b/c/main.cpp
- b/c/main.cpp
- c/main.cpp
- main.cpp
- ./c/main.cpp
- ./a/b/c/main.cpp
- ./b/c/main.cpp
- ./main.cpp

This also ensures that we won't match partial directory names, if a relative path is in the list or is used for the match, things must match at the directory level.

The breakpoint resolving code will now use the new FileSpecList::FindCompatibleIndex(...) function to allow this fuzzy matching to work for breakpoints.

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

2 years ago[llvm] Repair the modules build with C++17
Jonas Devlieghere [Mon, 8 Aug 2022 21:38:09 +0000 (14:38 -0700)]
[llvm] Repair the modules build with C++17

I'm honestly not sure if this is a legitimate issue or not, but after
switching from C++14 to C++17, the modules build started confusing
arrays and initializer lists. Work around the issue by being explicit.

2 years ago[flang][test] Don't require .exe suffix.
Michael Kruse [Mon, 8 Aug 2022 16:32:04 +0000 (11:32 -0500)]
[flang][test] Don't require .exe suffix.

The suffix is only added then the path the (lld-)link.exe is fully
resolved. Otherwise it may stay "link" or "lld-link".

On non-Windows platforms, lld-link also exists as a symbolic link to
lld, such that the full the path to lld-link might also be resolved
without .exe suffix in this case.

Note that CLANG_DEFAULT_LINKER could be set to other linkers such as
mold, in which case the test may still fail. This also applies to the
non-Windows tests that require "ld" in the linker name.

Fixes issue #56955

2 years ago[RISCV] Add {{$}} to some CHECK lines in MC tests.
Craig Topper [Mon, 8 Aug 2022 20:38:05 +0000 (13:38 -0700)]
[RISCV] Add {{$}} to some CHECK lines in MC tests.

This adds {{$}} to most of the CHECK lines for errors about what
extension an instruction requires. This ensures we check all the
extensions when there is a list.

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

2 years ago[ELF] Support --package-metadata
Alex Brachet [Mon, 8 Aug 2022 21:31:58 +0000 (21:31 +0000)]
[ELF] Support --package-metadata

This was recently introduced in GNU linkers and it makes sense for
ld.lld to have the same support. This implementation omits checking if
the input string is valid json to reduce size bloat.

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

2 years ago[libunwind][AIX] Save/restore errno before/after system calls dlopen/dlsym/dlclose
Xing Xue [Mon, 8 Aug 2022 21:21:30 +0000 (17:21 -0400)]
[libunwind][AIX] Save/restore errno before/after system calls dlopen/dlsym/dlclose

Summary:
libunwind on AIX calls dlopen()/dlsym()/dlclose() to dynamically load libc++abi and get the personality for state table EH when it is running against the legacy xlcang++ compiler genereated applications. dlopen() sets errno to 0 when it is successful, which clobbers the value in errno from the user code. This seems to be an AIX bug that it should not set errno to 0 according to POSIX. We will open a bug report to AIX but in the mean time there won't be time line when AIX will have a fix and even AIX does fix it, it won't help earlier AIX releases in the field. This patch saves and restores errno before and after these calls so that user code can work as expected.

Reviewed by: compnerd, libunwind

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

2 years ago[mlir][vector] Fix warp distribution test
Thomas Raoux [Mon, 8 Aug 2022 20:57:10 +0000 (20:57 +0000)]
[mlir][vector] Fix warp distribution test

The test was using a missing prefix. Add the prefix and fix the naming.

Found by @csigg

Reviewed By: csigg

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

2 years ago[DAGCombiner] Add some BE store forwarding tests; NFC
Roland Froese [Mon, 8 Aug 2022 20:29:15 +0000 (16:29 -0400)]
[DAGCombiner] Add some BE store forwarding tests; NFC

Add tests before D130115. NFC.

2 years ago[mlir][sparse] improve sparse attribute documentation
Aart Bik [Mon, 8 Aug 2022 17:23:40 +0000 (10:23 -0700)]
[mlir][sparse] improve sparse attribute documentation

Moved some parts from comments (not user facing) to the actual description
(user facing). Rephrased a bit as well.

Reviewed By: Peiming

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

2 years ago[MC] [Win64EH] Fix the calculation of the end of epilogs
Martin Storsjö [Mon, 8 Aug 2022 09:34:29 +0000 (12:34 +0300)]
[MC] [Win64EH] Fix the calculation of the end of epilogs

Exclude the terminating end opcode from the epilog - it doesn't
correspond to an actual instruction that is included in the epilog
itself (within the .seh_startepilogue/.seh_endepilogue range).

In most (all?) cases, an epilog is followed by a matching terminating
instruction though (a ret or a branch to a tail call), but it's not
strictly within the .seh_startepilogue/.seh_endepilogue range.

This fixes a number of failed asserts in cases where the codegen
has incorrectly reoredered SEH opcodes so they don't match up
exactly with their instructions.

However this still just avoids failing the assertion; the root cause
of generating unexpected epilogs is still present (and fixing that is
a less obvious issue).

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

2 years agoAdd -misc-const-correctness to .clang-tidy
Arthur Eubanks [Mon, 8 Aug 2022 17:16:20 +0000 (10:16 -0700)]
Add -misc-const-correctness to .clang-tidy

I keep getting suggestions from clangd to add 'const' to a bunch of local variables, which is not LLVM's style. This suppresses those.

Reviewed By: kadircet, aaron.ballman

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

2 years ago[lldb] Prevent race condition when fetching /proc/cpuinfo
Walter Erquinigo [Wed, 3 Aug 2022 16:57:57 +0000 (09:57 -0700)]
[lldb] Prevent race condition when fetching /proc/cpuinfo

@clayborg found a potential race condition when setting a static
variable. The fix seems simply to use call_once.

All relevant tests pass.

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

2 years ago[clang][deps] Stop sharing FileManager across module builds in scanner
Ben Langmuir [Mon, 8 Aug 2022 16:52:35 +0000 (09:52 -0700)]
[clang][deps] Stop sharing FileManager across module builds in scanner

Sharing the FileManager across implicit module builds currently leaks
paths looked up in an importer into the built module itself. This can
cause non-deterministic results across scans. It is especially bad for
modules since the path can be saved into the pcm file itself, leading to
stateful behaviour if the cache is shared.

This should not impact the number of real filesystem accesses in the
scanner, since it is already caching in the
DependencyScanningWorkerFilesystem.

Note: this change does not affect whether or not the FileManager is
shared across TUs in the scanner, which is a separate issue.

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

2 years ago[LinkerWrapper] Use C++17 structured bindings
Joseph Huber [Mon, 8 Aug 2022 17:32:48 +0000 (13:32 -0400)]
[LinkerWrapper] Use C++17 structured bindings

Summary:
This patch updates the linker wrapper to use C++17 structured bindings
now that they are availible.

2 years ago[compiler-rt] Use -std=c++17 for standalone build
Fangrui Song [Mon, 8 Aug 2022 19:04:41 +0000 (12:04 -0700)]
[compiler-rt] Use -std=c++17 for standalone build

Follow-up to D130689.

Reviewed By: thieta

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

2 years ago[lldb] Remove include/lldb/lldb-private.h
Fangrui Song [Mon, 8 Aug 2022 19:03:53 +0000 (12:03 -0700)]
[lldb] Remove include/lldb/lldb-private.h

The header from 62e0681afb478a4005efb6ba3598c24dc24866ee does something with
LLVM_FALLTHROUGH. Now that llvm-project has switched to C++17 and
LLVM_FALLTHROUGH uses have been migrated to [[fallthrough]], the header is
unneeded.

Reviewed By: JDevlieghere

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

2 years ago[Symbolizer] Fix symbolizer-filter-markup-pc.test on Windows
Daniel Thornburgh [Mon, 8 Aug 2022 18:39:44 +0000 (11:39 -0700)]
[Symbolizer] Fix symbolizer-filter-markup-pc.test on Windows

2 years ago[libc] Website fixes (sidebar and mobile)
Jeff Bailey [Sat, 6 Aug 2022 05:30:08 +0000 (05:30 +0000)]
[libc] Website fixes (sidebar and mobile)

Add "using" and "status" sections to the sidebar to make getting these
easier.

Fixed mobile formatting not overflow left and right.

Tested:
Chrome on Desktop, using mobile restrictions in devtools.

Reviewed By: sivachandra

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

2 years ago[lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC
Fangrui Song [Mon, 8 Aug 2022 18:31:49 +0000 (11:31 -0700)]
[lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

2 years ago[mlir][spirv] Unify mixed scalar/vector primitive type resources
Lei Zhang [Mon, 8 Aug 2022 18:23:22 +0000 (14:23 -0400)]
[mlir][spirv] Unify mixed scalar/vector primitive type resources

This further relaxes the requirement to allow aliased resources
to have different primitive types and some are scalars while the
other are vectors.

Reviewed By: ThomasRaoux

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

2 years ago[llvm] LLVM_FALLTHROUGH => [[fallthrough]]. NFC
Fangrui Song [Mon, 8 Aug 2022 18:24:15 +0000 (11:24 -0700)]
[llvm] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

With C++17 there is no Clang pedantic warning or MSVC C5051.

2 years ago[lld/mac] Remove unusual "Fallthrough" comments
Nico Weber [Mon, 8 Aug 2022 18:18:39 +0000 (14:18 -0400)]
[lld/mac] Remove unusual "Fallthrough" comments

Normally we'd use LLVM_FALLTHROUGH, or now, [[fallthrough]].
But for case labels followed directly by other case labels, we
use neither.

No behavior change.

2 years ago[gn build] port 59bb9e37c6
Nico Weber [Mon, 8 Aug 2022 18:16:21 +0000 (14:16 -0400)]
[gn build] port 59bb9e37c6

2 years ago[SimpleLoopUnswitch] Skip non-trivial unswitching of cold loops
Ruobing Han [Mon, 1 Aug 2022 17:22:45 +0000 (17:22 +0000)]
[SimpleLoopUnswitch] Skip non-trivial unswitching of cold loops

With profile data, non-trivial LoopUnswitch will only apply on non-cold loops, as unswitching cold loops may not gain much benefit but significantly increase the code size.

Reviewed By: aeubanks, asbirlea

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

2 years ago[X86][ARM] Add tests for bitwise logic trees of shifts; NFC
Filipp Zhinkin [Mon, 8 Aug 2022 17:54:49 +0000 (20:54 +0300)]
[X86][ARM] Add tests for bitwise logic trees of shifts; NFC

Baseline tests for D131189.

2 years ago[Symbolizer] Implement pc element in symbolizing filter.
Daniel Thornburgh [Mon, 1 Aug 2022 21:35:25 +0000 (14:35 -0700)]
[Symbolizer] Implement pc element in symbolizing filter.

Implements the pc element for the symbolizing filter, including it's
"ra" and "pc" modes. Return addresses ("ra") are adjusted by
decrementing one. By default, {{{pc}}} elements are assumed to point to
precise code ("pc") locations. Backtrace elements will adopt the
opposite convention.

Along the way, some minor refactors of value printing and colorization.

Reviewed By: peter.smith

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

2 years ago[SROA] Try harder to find a vector promotion viable type when rewriting
Vang Thao [Fri, 10 Jun 2022 19:06:15 +0000 (12:06 -0700)]
[SROA] Try harder to find a vector promotion viable type when rewriting

We are seeing significant performance loss when an alloca fails to get promoted
to register. I have observed that this is due to the common type found when
attempting to rewrite partition users being unviable for promotion. While if we
would have continue looking for a type, we would have found a subtype in the
original allocated type that would have enabled promotion. Thus first check if
the initial common type found is promotion viable and if not then continue
looking instead of stopping with the initial common type found.

Reviewed By: arsenm

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

2 years ago[lldb] Pass TestExternCSymbols.py on Windows
Alex Langford [Mon, 8 Aug 2022 18:01:13 +0000 (11:01 -0700)]
[lldb] Pass TestExternCSymbols.py on Windows

This test previously was expected to fail on windows. As of my previous
patch (1d2a62afaf7561e331e2f3daf3937d14225b21bf) this test now passes on
windows consistently. This patch adjusts the expectations of the test
accordingly.

2 years ago[flang] Replace more pgmath with libm.
Slava Zakharin [Thu, 4 Aug 2022 16:24:33 +0000 (09:24 -0700)]
[flang] Replace more pgmath with libm.

With this change all supported pgmath functions for non-complex
data types are replaced with either libm calls or MLIR operations,
except for MOD and some flavors of POW, which are going to be addressed
by other commits.

At the current stage a few math intrinsics are lowered into libm calls
always. When appropriate MLIR operation are available, the table can be
updated to generate them.

2 years ago[X86] Add test coverage for ctpop/parity with freeze
Simon Pilgrim [Mon, 8 Aug 2022 17:24:40 +0000 (18:24 +0100)]
[X86] Add test coverage for ctpop/parity with freeze

These are safe to fold from freeze(unaryop(x)) -> unaryop(freeze(x))

2 years ago[mlir][sparse] Add new concatente operator to sparse tensor
Peiming Liu [Wed, 3 Aug 2022 19:23:42 +0000 (19:23 +0000)]
[mlir][sparse] Add new concatente operator to sparse tensor

See https://www.tensorflow.org/xla/operation_semantics#concatenate for the operator semantics

Reviewed By: aartbik

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

2 years ago[llvm-ranlib] Support more than one input file
Fangrui Song [Mon, 8 Aug 2022 17:15:39 +0000 (10:15 -0700)]
[llvm-ranlib] Support more than one input file

BSD and GNU ranlib support more than one input file. Implement this.

While here, update OVERVIEW (Ranlib => ranlib) since "ranlib" is more common.
Remove "speed access" since the index has nothing to do with performance: it is
mandatory for GNU ld and gold but ignored for ld.lld (D119074).

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

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

2 years ago[mlir][math] Fix pythong bindings after 00f7096d31cc7896ffd490e65104d264923f0df5
Benjamin Kramer [Mon, 8 Aug 2022 17:14:44 +0000 (19:14 +0200)]
[mlir][math] Fix pythong bindings after 00f7096d31cc7896ffd490e65104d264923f0df5

2 years ago[libc++] Implement `operator==` for `filesystem::space_info`
Adrian Vogelsgesang [Sun, 31 Jul 2022 23:12:42 +0000 (16:12 -0700)]
[libc++] Implement `operator==` for `filesystem::space_info`

Implements part of P1614R2 "The Mothership has Landed"

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

2 years ago[mlir][doc] Cross link the dependent dialect section to the tablegen field definition
Mehdi Amini [Mon, 8 Aug 2022 16:57:33 +0000 (16:57 +0000)]
[mlir][doc] Cross link the dependent dialect section to the tablegen field definition

2 years ago[llvm-tblgen] Fix copy+paste typo in CodeGenSchedModels::collectLoadStoreQueueInfo
Simon Pilgrim [Mon, 8 Aug 2022 16:51:33 +0000 (17:51 +0100)]
[llvm-tblgen] Fix copy+paste typo in CodeGenSchedModels::collectLoadStoreQueueInfo

Confirmed with @andreadb - repeated PM.LoadQueue->getLoc() should have been PM.StoreQueue->getLoc()

Found by coverity

2 years ago[mlir][sparse][nfc] Use tensor.generate in sparse integration tests
Rajas Vanjape [Mon, 8 Aug 2022 15:23:36 +0000 (15:23 +0000)]
[mlir][sparse][nfc] Use tensor.generate in sparse integration tests

Currently, dense tensors are initialized in Sparse Integration tests using
"buffer.tensor_alloc and scf.for" . This makes code harder to read and maintain.
This diff uses tensor.generate instead to initialize dense tensors.

Testing: Ran integration tests after building with -DLLVM_USE_SANITIZER=Address flag.

Reviewed By: springerm

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

2 years ago[flang] Add an explicit condition for the BITS=0 case in the MASKL and MASKR intrinsics.
Tarun Prabhu [Mon, 8 Aug 2022 14:56:29 +0000 (08:56 -0600)]
[flang] Add an explicit condition for the BITS=0 case in the MASKL and MASKR intrinsics.

This fixes issue #56706.

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

2 years ago[RISCV] Add ReadFStoreData as a SchedRead.
Craig Topper [Mon, 8 Aug 2022 16:06:28 +0000 (09:06 -0700)]
[RISCV] Add ReadFStoreData as a SchedRead.

The floating point stores use a different register class, it
probably makes sense to have a different SchedRead.

Reviewed By: monkchiang

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

2 years ago[DAG] canCreateUndefOrPoison - add freeze(bswap(x)) -> bswap(freeze(x)) and freeze...
Simon Pilgrim [Mon, 8 Aug 2022 16:27:05 +0000 (17:27 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(bswap(x)) -> bswap(freeze(x)) and freeze(bitreverse(x)) -> bitreverse(freeze(x)) support

Both are guaranteed not to create undef/poison

2 years ago[MLIR][Linalg] Remove `TiledLoops` from tiling options
lorenzo chelini [Mon, 8 Aug 2022 08:35:55 +0000 (10:35 +0200)]
[MLIR][Linalg] Remove `TiledLoops` from tiling options

TiledLoopOp has been removed in: https://github.com/llvm/llvm-project/commit/1a829d2d06958abf09bb6aff81120959206887f6

Reviewed By: ftynse

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

2 years ago[ADT] Retire llvm::apply_tuple in favor of C++17 std::apply
Benjamin Kramer [Mon, 8 Aug 2022 16:23:10 +0000 (18:23 +0200)]
[ADT] Retire llvm::apply_tuple in favor of C++17 std::apply

2 years ago[mlir][spirv] Refresh base definitions to latest spec (v1.6)
Lei Zhang [Mon, 8 Aug 2022 16:07:40 +0000 (12:07 -0400)]
[mlir][spirv] Refresh base definitions to latest spec (v1.6)

This commit updates all SPIR-V enum definitions to match the latest
specification (v1.6 revision 2). Along the way, fixed some issues
in `gen_spirv_dialect.py` and added a new script for refreshing
all op definitions for such cases.

Reviewed By: kuhar

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

2 years ago[clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFC
Fangrui Song [Mon, 8 Aug 2022 16:12:46 +0000 (09:12 -0700)]
[clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

With C++17 there is no Clang pedantic warning or MSVC C5051.

Reviewed By: aaron.ballman

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

2 years agoRename OPENMP_HAVE_STD_CPP14_FLAG to match c++17
Jon Chesterfield [Mon, 8 Aug 2022 16:07:45 +0000 (17:07 +0100)]
Rename OPENMP_HAVE_STD_CPP14_FLAG to match c++17

2 years agoMove openmp from -std=c++14 to -std=c++17
Ron Lieberman [Mon, 8 Aug 2022 16:04:52 +0000 (16:04 +0000)]
Move openmp from -std=c++14 to -std=c++17

2 years ago[LLDB][NFC] Fix suspicious bitwise expression in PrintBTEntry()
Slava Gurevich [Sat, 6 Aug 2022 04:27:28 +0000 (21:27 -0700)]
[LLDB][NFC] Fix suspicious bitwise expression in PrintBTEntry()

Current application of bitwise-OR to a binary mask always results in True, which seems
inconsistent with the intent of the statement, a likely typo.

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

2 years ago[lld/win] Use C++17 structured bindings
Nico Weber [Mon, 8 Aug 2022 15:20:24 +0000 (11:20 -0400)]
[lld/win] Use C++17 structured bindings

No behavior change.

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

2 years ago[lld/win] Use C++17 nested namespace syntax in most places
Nico Weber [Mon, 8 Aug 2022 15:32:26 +0000 (11:32 -0400)]
[lld/win] Use C++17 nested namespace syntax in most places

Like D131354, but for COFF.

No behavior change.

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

2 years ago[DAG] canCreateUndefOrPoison - add freeze(sext(x)) -> sext(freeze(x)) and freeze...
Simon Pilgrim [Mon, 8 Aug 2022 15:43:30 +0000 (16:43 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(sext(x)) -> sext(freeze(x)) and freeze(zext(x)) -> zext(freeze(x)) support

Both are guaranteed not to create undef/poison

2 years ago[lldb] Make Process and subclass constructors protected
Michał Górny [Fri, 5 Aug 2022 17:39:42 +0000 (19:39 +0200)]
[lldb] Make Process and subclass constructors protected

Make constructors of the Process and its subclasses class protected,
to prevent accidentally constructing Process on stack when it could be
afterwards accessed via a shared_ptr (since it uses
std::enable_shared_from_this<>).

The only place where a stack allocation was used were unittests,
and fixing them via declaring an explicit public constructor
in the respective mock classes is trivial.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D131275

2 years agoUpdate the C status page from the latest working draft
Aaron Ballman [Mon, 8 Aug 2022 15:29:34 +0000 (11:29 -0400)]
Update the C status page from the latest working draft

WG14 N3047 is the last C working draft before the document goes out
for committee ballot, so this should be the last of the C2x compiler
features to be added.

2 years ago[nfc][openmp] clang-format system.cpp prior to D131401
Jon Chesterfield [Mon, 8 Aug 2022 15:24:34 +0000 (16:24 +0100)]
[nfc][openmp] clang-format system.cpp prior to D131401