platform/upstream/llvm.git
2 years ago[clang-tidy] Confusable identifiers detection
serge-sans-paille [Fri, 15 Oct 2021 13:20:22 +0000 (15:20 +0200)]
[clang-tidy] Confusable identifiers detection

Detect identifiers that are confusable using a variant of Unicode definition

        http://www.unicode.org/reports/tr39/#Confusable_Detection

and have conflicting scopes.

This a recommit (with portability and feature fixes) of b94db7ed7eaf4a3b21f600653a09c55cab77b79f

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

2 years ago[lldb] Add setting to override PE/COFF ABI by module name
Alvin Wong [Wed, 22 Jun 2022 13:16:04 +0000 (16:16 +0300)]
[lldb] Add setting to override PE/COFF ABI by module name

The setting `plugin.object-file.pe-coff.module-abi` is a string-to-enum
map that allows specifying an ABI to a module name. For example:

    ucrtbase.dll=msvc
    libstdc++-6.dll=gnu

This allows for debugging a process which mixes both modules built using
the MSVC ABI and modules built using the MinGW ABI.

Depends on D127048

Reviewed By: DavidSpickett

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

2 years ago[lldb][windows] Fix crash on getting nested exception
Alvin Wong [Wed, 22 Jun 2022 13:15:34 +0000 (16:15 +0300)]
[lldb][windows] Fix crash on getting nested exception

LLDB tries to follow `EXCEPTION_RECORD::ExceptionRecord` to follow the
nested exception chain. In practice this code just causes Access
Violation whenever there is a nested exception. Since there does not
appear to be any code in LLDB that is actually using the nested
exceptions, this change just removes the crashing code and adds a
comment for future reference.

Fixes https://github.com/mstorsjo/llvm-mingw/issues/292

Reviewed By: DavidSpickett

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

2 years ago[lldb] Resolve exe location for `target create`
Alvin Wong [Wed, 22 Jun 2022 13:13:57 +0000 (16:13 +0300)]
[lldb] Resolve exe location for `target create`

This fixes an issue that, when you start lldb or use `target create`
with a program name which is on $PATH, or not specify the .exe suffix of
a program in the working directory on Windows, you get a confusing
error, for example:

    (lldb) target create notepad
    error: 'C:\WINDOWS\SYSTEM32\notepad.exe' doesn't contain any 'host'
    platform architectures: i686, x86_64, i386, i386

Fixes https://github.com/mstorsjo/llvm-mingw/issues/265

Reviewed By: DavidSpickett

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

2 years ago[lldb] Fix reading i686-windows executables with GNU environment
Martin Storsjö [Tue, 21 Jun 2022 12:31:32 +0000 (15:31 +0300)]
[lldb] Fix reading i686-windows executables with GNU environment

25c8a061c5739677d2fc0af29a8cc9520207b923 / D127048 added an option
for setting the ABI to GNU.

When an object file is loaded, there's only minimal verification
done for the architecture spec set for it, if the object file only
provides one.

However, for i386 object files, the PECOFF object file plugin
provides two architectures, i386-pc-windows and i686-pc-windows.
This picks a totally different codepath in
TargetList::CreateTargetInternal, where it's treated as a fat
binary. This goes through more verifications to see if the
architectures provided by the object file matches what the
platform plugin supports.

The PlatformWindows() constructor explicitly adds the
"i386-pc-windows" and "i686-pc-windows" architectures (even when
running on other architectures), which allows this "fat binary
verification" to succeed for the i386 object files that provide
two architectures.

However, after that commit, if the object file is advertised with
the different environment (either when lldb is built in a mingw
environment, or if that setting is set), the fat binary validation
won't accept the file any longer.

Update ArchSpec::IsEqualTo with more logic for the Windows use
cases; mismatching vendors is not an issue (they don't have any
practical effect on Windows), and GNU and MSVC environments are
compatible to the point that PlatformWindows can handle object
files for both environments/ABIs.

As a separate path forward, one could also consider to stop returning
two architecture specs from ObjectFilePECOFF::GetModuleSpecifications
for i386 files.

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

2 years agoClang AttributeReference: emit entries for "Undocumented" attributes.
James Y Knight [Wed, 22 Jun 2022 13:41:59 +0000 (09:41 -0400)]
Clang AttributeReference: emit entries for "Undocumented" attributes.

Almost all attributes currently marked `Undocumented` are user-facing
attributes which _ought_ to be documented, but nobody has written it
yet. This change ensures that we at least acknowledge that these
attributes exist in the documentation, even if we have no description
of their semantics.

A new category, `InternalOnly` has been added for those few attributes
which are not user-facing, and should remain omitted from the docs.

2 years ago[Alignment] Use Align for MaxKernArgAlign
Guillaume Chatelet [Sat, 18 Jun 2022 11:36:02 +0000 (11:36 +0000)]
[Alignment] Use Align for MaxKernArgAlign

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

2 years ago[LinkerWrapper] Fix calls to deleted Error constructor on older compilers
Joseph Huber [Wed, 22 Jun 2022 13:37:54 +0000 (09:37 -0400)]
[LinkerWrapper] Fix calls to deleted Error constructor on older compilers

Summary:
A recent patch added some new code paths to the linker wrapper. Older
compilers seem to have problems with returning errors wrapped in
an Excepted type without explicitly moving them. This caused failures in
some of the buildbots. This patch fixes that.

2 years ago[X86] Migrate more tests to opaque pointers (NFC)
Nikita Popov [Wed, 22 Jun 2022 12:51:00 +0000 (14:51 +0200)]
[X86] Migrate more tests to opaque pointers (NFC)

Migrate some more tests that required manual fixups (e.g. due to
phi nodes), but have no codegen changes.

Also tweak some more tests that had leftover no-op constant
expressions.

2 years ago[flang] Add FIR tests missing from fir-dev
Valentin Clement [Wed, 22 Jun 2022 13:34:29 +0000 (15:34 +0200)]
[flang] Add FIR tests missing from fir-dev

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier, PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2 years ago[NFC] Remove dead code
Guillaume Chatelet [Wed, 22 Jun 2022 13:33:40 +0000 (13:33 +0000)]
[NFC] Remove dead code

2 years ago[ConstraintElimination] Transfer info from SGE to unsigned system.
Florian Hahn [Wed, 22 Jun 2022 13:27:59 +0000 (15:27 +0200)]
[ConstraintElimination] Transfer info from SGE to unsigned system.

This patch adds a new transferToOtherSystem helper that tries to
transfer information from signed predicates to the unsigned system and
vice versa.

The initial version adds A >=u B for A >=s B && B >=s 0

https://alive2.llvm.org/ce/z/8b6F9i

2 years ago[Clang] Allow multiple comma separated arguments to `--offload-arch=`
Joseph Huber [Mon, 20 Jun 2022 14:17:40 +0000 (10:17 -0400)]
[Clang] Allow multiple comma separated arguments to `--offload-arch=`

This patch updates the `--[no-]offload-arch` command line arguments to
allow the user to pass in many architectures in a single argument rather
than specifying it multiple times. This means that the following command
line,
```
clang foo.cu --offload-arch=sm_70 --offload-arch=sm_80
```
can become:
```
clang foo.cu --offload-arch=sm_70,sm_80
```

Reviewed By: ye-luo

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

2 years ago[LinkerWrapper] Rework the linker wrapper and use owning binaries
Joseph Huber [Mon, 6 Jun 2022 15:36:45 +0000 (11:36 -0400)]
[LinkerWrapper] Rework the linker wrapper and use owning binaries

The linker wrapper currently eagerly extracts all identified offloading
binaries to a file. This isn't ideal because we will soon open these
files again to examine their symbols for LTO and other things.
Additionally, we may not use every extracted file in the case of static
libraries. This would be very noisy in the case of static libraries that
may contain code for several targets not participating in the current
link.

Recent changes allow us to treat an Offloading binary as a standard
binary class. So that allows us to use an OwningBinary to model the
file. Now we keep it in memory and only write it once we know which
files will be participating in the final link job. This also reworks a
lot of the structure around how we handle this by removing the old
DeviceFile class.

The main benefit from this is that the following doesn't output 32+ files and
instead will only output a single temp file for the linked module.
```
$ clang input.c -fopenmp --offload-arch=sm_70 -foffload-lto -save-temps
```

Reviewed By: JonChesterfield

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

2 years ago[X86] Name instructions in test (NFC)
Nikita Popov [Wed, 22 Jun 2022 13:16:37 +0000 (15:16 +0200)]
[X86] Name instructions in test (NFC)

Run the test through -instnamer, which makes it simpler to modify
it.

2 years ago[NFC] Remove dead code
Guillaume Chatelet [Wed, 22 Jun 2022 13:11:30 +0000 (13:11 +0000)]
[NFC] Remove dead code

2 years ago[lldb] Remove an outdated comment. NFC.
Martin Storsjö [Mon, 20 Jun 2022 21:21:00 +0000 (00:21 +0300)]
[lldb] Remove an outdated comment. NFC.

This comment became outdated in 053eb35651906e693906fad6c695fce11415ade7
(but was moved along); that commit moved the code and the comment
to a separate function, with a separate local variable
`num_of_bytes_read`. On error, the possibly garbage value is never
copied back to the caller's reference, thus the comment is no longer
relevant (and slightly confusing as is).

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

2 years agoDon't treat invalid parameters as being unused
Aaron Ballman [Wed, 22 Jun 2022 12:06:08 +0000 (08:06 -0400)]
Don't treat invalid parameters as being unused

The misc-unused-parameters check would trigger false positive warnings
about the parameter being unused when the parameter declaration was
invalid. No longer issue the warning in that case on the assumption
that most parameters are used in practice, so the extra diagnostic is
most likely a false positive.

Fixes #56152

2 years ago[NVPTX] Keep metadata attached to module-scope variables
Igor Kudrin [Wed, 22 Jun 2022 12:51:29 +0000 (05:51 -0700)]
[NVPTX] Keep metadata attached to module-scope variables

This helps to preserve the debug information of global variables.

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

2 years ago[DAG] SelectionDAG::GetDemandedBits - don't recurse back into GetDemandedBits
Simon Pilgrim [Wed, 22 Jun 2022 11:07:27 +0000 (12:07 +0100)]
[DAG] SelectionDAG::GetDemandedBits - don't recurse back into GetDemandedBits

Another minor cleanup as we work toward removing GetDemandedBits entirely - call SimplifyMultipleUseDemandedBits directly.

2 years ago[X86] Migrate tests to use opaque pointers (NFC)
Nikita Popov [Wed, 22 Jun 2022 12:33:12 +0000 (14:33 +0200)]
[X86] Migrate tests to use opaque pointers (NFC)

Test updates were performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

These are only the test updates where the test passed without
further modification (which is almost all of them, as the backend
is largely pointer-type agnostic).

2 years agoRe-land [libc] Apply no-builtin everywhere, remove unnecessary flags
Guillaume Chatelet [Wed, 22 Jun 2022 12:21:25 +0000 (12:21 +0000)]
Re-land [libc] Apply no-builtin everywhere, remove unnecessary flags

This is a reland of D126773 / b2a9ea4420127d10b18ae648b16757665f8bbd7c.

The removal of `-mllvm -combiner-global-alias-analysis` has landed separately
in D128051 / 7b73f53790f3db9ee589dc26a05a481a5e9e6915.

And the removal of `-mllvm --tail-merge-threshold=0` is scheduled for
removal in a subsequent patch.

2 years ago[Tests] Remove unnecessary bitcasts from opaque pointer tests (NFC)
Nikita Popov [Wed, 22 Jun 2022 12:06:12 +0000 (14:06 +0200)]
[Tests] Remove unnecessary bitcasts from opaque pointer tests (NFC)

Previously left these behind due to the required instruction
renumbering, drop them now. This more accurately represents
opaque pointer input IR.

Also drop duplicate opaque pointer check lines in one SROA test.

2 years ago[AlignmentFromAssumptions] Migrate tests to opaque pointers (NFC)
Nikita Popov [Wed, 22 Jun 2022 11:02:18 +0000 (13:02 +0200)]
[AlignmentFromAssumptions] Migrate tests to opaque pointers (NFC)

Tests were updated with (without manual fixup):
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

2 years ago[libc][mem*] Introduce Sized/Backends for new mem framework
Guillaume Chatelet [Tue, 14 Jun 2022 11:34:13 +0000 (11:34 +0000)]
[libc][mem*] Introduce Sized/Backends for new mem framework

This patch is a subpart of D125768 intented to make the review easier.

The `SizedOp` struct represents operations to be performed on a certain number of bytes.
It is responsible for breaking them down into platform types and forwarded to the `Backend`.

The `Backend` struct represents a lower level abstraction that works only on types (`uint8_t`, `__m128i`, ...).
It is similar to instruction selection.

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

2 years ago[AddDiscriminators] Migrate tests to opaque pointers (NFC)
Nikita Popov [Wed, 22 Jun 2022 10:47:12 +0000 (12:47 +0200)]
[AddDiscriminators] Migrate tests to opaque pointers (NFC)

Update performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

memcpy-discriminator.ll was fixed up to use named instructions
and drop the no longer needed bitcasts.

2 years ago[AggressiveInstCombine] Update tests to use opaque pointers (NFC)
Nikita Popov [Wed, 22 Jun 2022 10:27:21 +0000 (12:27 +0200)]
[AggressiveInstCombine] Update tests to use opaque pointers (NFC)

Update performed using (without manual fixup):
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

2 years ago[ADCE] Update tests to use opaque pointers (NFC)
Nikita Popov [Wed, 22 Jun 2022 10:24:43 +0000 (12:24 +0200)]
[ADCE] Update tests to use opaque pointers (NFC)

Update performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

This time without any manual fixup.

2 years ago[XCOFF] write the real source file name in C_FILE symbol.
esmeyi [Wed, 22 Jun 2022 10:23:36 +0000 (06:23 -0400)]
[XCOFF] write the real source file name in C_FILE symbol.

The symbol table starts with all the C_FILE symbols.

Reviewed By: shchenz

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

2 years ago[ARM] Fix MVE gather/scatter merged gep offsets
David Green [Wed, 22 Jun 2022 10:04:22 +0000 (11:04 +0100)]
[ARM] Fix MVE gather/scatter merged gep offsets

This fixes the combining of constant vector GEP operands in the
optimization of MVE gather/scatter addresses, when opaque pointers are
enabled. As opaque pointers reduce the number of bitcasts between geps,
more can be folded than before. This can cause problems if the index
types are now different between the two geps.

This fixes that by making sure each constant is scaled appropriately,
which has the effect of transforming the geps to have a scale of 1,
changing [r0, q0, uxtw #1] gathers to [r0, q0] with a larger q0. This
helps use a simpler instruction that doesn't need the extra uxtw.

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

2 years ago[X86] Don't run O2 pipeline in codegen test (NFC)
Nikita Popov [Wed, 22 Jun 2022 09:36:38 +0000 (11:36 +0200)]
[X86] Don't run O2 pipeline in codegen test (NFC)

Regenerate the test with current O2 result and only run CGP.

2 years ago[AArch64][SME] Add some SME PSTATE setting/query intrinsics
David Sherwood [Thu, 16 Jun 2022 10:46:15 +0000 (11:46 +0100)]
[AArch64][SME] Add some SME PSTATE setting/query intrinsics

This patch adds support for:

* Querying the PSTATE.SM state with @llvm.aarch64.sme.get.pstatesm
* Reading/writing the TPIDR2 register with new
@llvm.aarch64.sme.get.tpidr2 and @llvm.aarch64.sme.set.tpidr2
intrinsics.

Tests added here:

  CodeGen/AArch64/sme-get-pstatesm.ll
  CodeGen/AArch64/sme-read-write-tpidr2.ll

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

2 years ago[libc++] fix views::all hard error on lvalue move only views instead of SFINAE
Hui Xie [Wed, 22 Jun 2022 08:24:09 +0000 (09:24 +0100)]
[libc++] fix views::all hard error on lvalue move only views instead of SFINAE

For an lvalue reference to a move only view x, views::all(x) gives hard error because the expression inside noexcept is not well formed and it is not SFINAE friendly.

Given a move only view type `V`, and a concept

```
template <class R>
concept can_all = requires {
    std::views::all(std::declval<R>());
};
```

The expression `can_all<V&>` returns
libstdc++: false
msvc stl : false
libc++   : error: static_cast from 'V' to 'typename decay<decltype((std::forward<V &>(__t)))>::type' (aka 'V') uses deleted function
      noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))))

The standard spec has its own problem, the spec says it is expression equivalent to `decay-copy(E)` but the spec of `decay-copy` does not have any constraint, which means the expression `decay-copy(declval<V&>())` is well-formed and the concept `can_all<V&>` should return true and should error when instantiating the function body of decay-copy. This is clearly wrong behaviour in the spec and we will probably create an LWG issue. But the libc++'s behaviour is clearly not correct. The `noexcept` is an "extension" in libc++ which is not in the spec, but the expression inside `noexpect` triggers hard error, which is not right.

Reviewed By: #libc, ldionne, var-const

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

2 years ago[SCCP] Don't mark edges feasible when resolving undefs
Nikita Popov [Fri, 3 Jun 2022 09:42:07 +0000 (11:42 +0200)]
[SCCP] Don't mark edges feasible when resolving undefs

As branch on undef is immediate undefined behavior, there is no need
to mark one of the edges as feasible. We can leave all the edges
non-feasible. In IPSCCP, we can replace the branch with an unreachable
terminator.

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

2 years ago[mlir][Transform] NFC - Pass TransformState as an argument to applyToOne methods
Nicolas Vasilache [Wed, 22 Jun 2022 07:47:56 +0000 (00:47 -0700)]
[mlir][Transform] NFC - Pass TransformState as an argument to applyToOne methods

This will allow implementing state-dependent behavior in the future.

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

2 years agoFix interaction of pragma FENV_ACCESS with other pragmas
Serge Pavlov [Wed, 20 Apr 2022 03:57:34 +0000 (10:57 +0700)]
Fix interaction of pragma FENV_ACCESS with other pragmas

Previously `#pragma STDC FENV_ACCESS ON` always set dynamic rounding
mode and strict exception handling. It is not correct in the presence
of other pragmas that also modify rounding mode and exception handling.
For example, the effect of previous pragma FENV_ROUND could be
cancelled, which is not conformant with the C standard. Also
`#pragma STDC FENV_ACCESS OFF` turned off only FEnvAccess flag, leaving
rounding mode and exception handling unchanged, which is incorrect in
general case.

Concrete rounding and exception mode depend on a combination of several
factors like various pragmas and command-line options. During the review
of this patch an idea was proposed that the semantic actions associated
with such pragmas should only set appropriate flags. Actual rounding
mode and exception handling should be calculated taking into account the
state of all relevant options. In such implementation the pragma
FENV_ACCESS should not override properties set by other pragmas but
should set them if such setting is absent.

To implement this approach the following main changes are made:

- Field `FPRoundingMode` is removed from `LangOptions`. Actually there
  are no options that set it to arbitrary rounding mode, the choice was
  only `dynamic` or `tonearest`. Instead, a new boolean flag
  `RoundingMath` is added, with the same meaning as the corresponding
  command-line option.

- Type `FPExceptionModeKind` now has possible value `FPE_Default`. It
  does not represent any particular exception mode but indicates that
  such mode was not set and default value should be used. It allows to
  distinguish the case:

    {
        #pragma STDC FENV_ACCESS ON
...
    }

  where the pragma must set FPE_Strict, from the case:

    {
        #pragma clang fp exceptions(ignore)
        #pragma STDC FENV_ACCESS ON
        ...
    }

  where exception mode should remain `FPE_Ignore`.

  - Class `FPOptions` has now methods `getRoundingMode` and
  `getExceptionMode`, which calculates the respective properties from
  other specified FP properties.

  - Class `LangOptions` has now methods `getDefaultRoundingMode` and
  `getDefaultExceptionMode`, which calculates default modes from the
  specified options and should be used instead of `getRoundingMode` and
  `getFPExceptionMode` of the same class.

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

2 years ago[libc++] Complete the implementation of N4190
Nikolas Klauser [Wed, 22 Jun 2022 08:11:14 +0000 (10:11 +0200)]
[libc++] Complete the implementation of N4190

Fixes #37402

Reviewed By: ldionne

Spies: EricWF, avogelsgesang, libcxx-commits, arphaman

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

2 years ago[libc++] Remove std::function in C++03
Nikolas Klauser [Mon, 20 Jun 2022 14:48:31 +0000 (16:48 +0200)]
[libc++] Remove std::function in C++03

`std::function` has been deprecated for a few releases now. Remove it with an option to opt-back-in with a note that this option will be removed in LLVM 16.

Reviewed By: ldionne, #libc

Spies: #libc_vendors, EricWF, jloser, libcxx-commits

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

2 years ago[flang] Cleanup code and add test from fir-dev
Valentin Clement [Wed, 22 Jun 2022 07:38:32 +0000 (09:38 +0200)]
[flang] Cleanup code and add test from fir-dev

This patch clean up some code for upstreaming and add couple of
missing tests that were left in fir-dev.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier, PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[ConstraintElimination] Update addFact to take Predicate and ops (NFC).
Florian Hahn [Wed, 22 Jun 2022 06:36:40 +0000 (08:36 +0200)]
[ConstraintElimination] Update addFact to take Predicate and ops (NFC).

This allows adding facts without necessarily having a corresponding
CmpInst.

2 years ago[CMake] Don't pass CMAKE_C(XX)_COMPILER to the nested NATIVE build when cross compiling
Martin Storsjö [Tue, 24 May 2022 12:18:36 +0000 (15:18 +0300)]
[CMake] Don't pass CMAKE_C(XX)_COMPILER to the nested NATIVE build when cross compiling

Originally, the nested build was set up with the CMake command
`execute_process` which implicitly passes CC/CXX variables for
the configured compiler, which then was picked up by the nested
CMake. (This CMake behaviour, to implicitly pass such variables
is up for discussion and might change in the future; see
https://gitlab.kitware.com/cmake/cmake/-/issues/21378.)

How the nested cmake build is set up was changed in
aa7d6db5c8fc449b2908c6d629d6d9a067f49896 / D40229 - the old behaviour
was brought along by manually passing
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} to the nested cmake
configuration. This was then later made optional in
f5f0fffea5ace079cc208fafa65150d23935a4d9 / D40947. But still,
the default if the user doesn't pass
CROSS_TOOLCHAIN_FLAGS_${target_name} (e.g. CROSS_TOOLCHAIN_FLAGS_NATIVE)
is to pass in the surrounding build's compiler - which usually
doesn't work, and is quite non-obvious to figure out.

Just drop the default passing of the outer compiler, when cross
compiling. This should avoid surprising cases of using the cross
compiler for the native build for essentially all new users trying
to cross compile, until they've discovered CROSS_TOOLCHAIN_FLAGS_NATIVE.

Keep passing these when not cross compiling, e.g. if building with
optimized tablegen.

This was already suggested at the end in D40229, but apparently never
acted upon.

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

2 years ago[DeadArgElim] Reformat the pass in accordance with the code style
Pavel Samolysov [Fri, 17 Jun 2022 16:25:18 +0000 (19:25 +0300)]
[DeadArgElim] Reformat the pass in accordance with the code style

The code has been reformatted in accordance with the code style. Some
function comments were extended to the Doxygen ones and reworded a bit
to eliminate the duplication of the function's/class' name in the
comment.

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

2 years ago[gn build] Port 77ad77c0710f
LLVM GN Syncbot [Wed, 22 Jun 2022 05:44:50 +0000 (05:44 +0000)]
[gn build] Port 77ad77c0710f

2 years ago[libc] Fix bug in UInt comparison operators.
Siva Chandra Reddy [Tue, 21 Jun 2022 20:46:59 +0000 (20:46 +0000)]
[libc] Fix bug in UInt comparison operators.

Reviewed By: lntue

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

2 years ago[libc++][format] Improve string formatters
Mark de Wever [Tue, 28 Dec 2021 17:48:04 +0000 (18:48 +0100)]
[libc++][format] Improve string formatters

This changes the implementation of the formatter. Instead of inheriting
from a specialized parser all formatters will use the same generic
parser. This reduces the binary size.

The new parser contains some additional fields only used in the chrono
formatting. Since this doesn't change the size of the parser the fields
are in the generic parser. The parser is designed to fit in 128-bit,
making it cheap to pass by value.

The new format function is a const member function. This isn't required
by the Standard yet, but it will be after LWG-3636 is accepted.
Additionally P2286 adds a formattable concept which requires the member
function to be const qualified in C++23. This paper is likely to be
accepted in the 2022 July plenary.

Depends on D121530

NOTE parts of the code now contains duplicates for the current and new parser.
The intention is to remove the duplication in followup patches. A general
overview of the final code is available in D124620. That review however lacks a
bit of polish.

Most of the new code is based on the same algorithms used in the current code.

The final version of this code reduces the binary size by 17 KB for this example
code
```

int main() {
  {
    std::string_view sv{"hello world"};
    std::format("{}{}|{}{}{}{}{}{}|{}{}{}{}{}{}|{}{}{}|{}{}|{}", true, '*',
                (signed char)(42), (short)(42), (int)(42), (long)(42), (long long)(42), (__int128_t)(42),
                (unsigned char)(42), (unsigned short)(42), (unsigned int)(42), (unsigned long)(42),
                (unsigned long long)(42), (__uint128_t)(42),
                (float)(42), (double)(42), (long double)(42),
                "hello world", sv,
                nullptr);
  }
  {
    std::wstring_view sv{L"hello world"};
    std::format(L"{}{}|{}{}{}{}{}{}|{}{}{}{}{}{}|{}{}{}|{}{}|{}", true, L'*',
                (signed char)(42), (short)(42), (int)(42), (long)(42), (long long)(42), (__int128_t)(42),
                (unsigned char)(42), (unsigned short)(42), (unsigned int)(42), (unsigned long)(42),
                (unsigned long long)(42), (__uint128_t)(42),
                (float)(42), (double)(42), (long double)(42),
                L"hello world", sv,
                nullptr);
  }
}

```

Reviewed By: #libc, ldionne

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

2 years agoHowToReleaseLLVM: Add description of the bug triage process
Tom Stellard [Wed, 22 Jun 2022 05:16:02 +0000 (22:16 -0700)]
HowToReleaseLLVM: Add description of the bug triage process

Reviewed By: andreil99

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

2 years agoAMDGPU: Skip unexpected CFG in SIOptimizeVGPRLiveRange
Ruiling Song [Fri, 17 Jun 2022 13:55:41 +0000 (21:55 +0800)]
AMDGPU: Skip unexpected CFG in SIOptimizeVGPRLiveRange

There are some cases that we use si_if/si_else in unatural way.
Just skip them.

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

Reviewed by: critson

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

2 years ago[NewGVN] add context instruction for SimplifyQuery
chenglin.bi [Wed, 22 Jun 2022 04:24:48 +0000 (12:24 +0800)]
[NewGVN] add context instruction for SimplifyQuery

NewGVN will find operator from other context. ValueTracking currently doesn't have a way to run completely without context instruction.
So it will use operator itself as conext instruction.
If the operator in another branch will never be executed but it has an assume, it may caused value tracking use the assume to do wrong simpilfy.

It would be better to make these simplification queries not use context at all, but that would require some API changes.
For now we just use the orignial instruction as context instruction to fix the issue.

Fix #56039

Reviewed By: nikic

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

2 years ago[LoopVectorize] Uninitialized phi node leads to a crash in SSAUpdater.
Serguei Katkov [Fri, 17 Jun 2022 06:10:57 +0000 (13:10 +0700)]
[LoopVectorize] Uninitialized phi node leads to a crash in SSAUpdater.

createInductionResumeValues creates a phi node placeholder
without filling incoming values. Then it generates the incoming values.

It includes triggering of SCEV expander which may invoke SSAUpdater.
SSAUpdater has an optimization to detect number of predecessors
basing on incoming values if there is phi node.
In case phi node is not filled with incoming values - the number of predecessors
is detected as 0 and this leads to segmentation fault.

In other words SSAUpdater expects that phi is in good shape while
LoopVectorizer breaks this requirement.

The fix is just prepare all incoming values first and then build a phi node.

Reviewed By: fhahn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D128033

2 years ago[lldb] [test] Mark TestNonStop as LLGS-specific
Michał Górny [Wed, 22 Jun 2022 03:36:15 +0000 (05:36 +0200)]
[lldb] [test] Mark TestNonStop as LLGS-specific

Thanks for Med Ismail Bennani for reporting the debugserver failures.

2 years ago[Libomptarget] Remove duplicate data environment exit
Joseph Huber [Wed, 22 Jun 2022 02:30:25 +0000 (22:30 -0400)]
[Libomptarget] Remove duplicate data environment exit

Summary:
This patch removes a duplicated exit from the OpenMP data envrionment.
We already have an RAII method that guards this environment so it is
unnecessary.

2 years ago[Attributor][FIX] Avoid empty bin in AAPointerInfo
Johannes Doerfert [Tue, 21 Jun 2022 19:52:37 +0000 (14:52 -0500)]
[Attributor][FIX] Avoid empty bin in AAPointerInfo

This avoid creating empty bins in AAPointerInfo which can lead to
segfaults. Also ensure we do not try to translate from callee to caller
except if we really take the argument state and move it to the call site
argument state.

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

2 years ago[Attributor] Ensure to use the proper liveness AA
Johannes Doerfert [Thu, 19 May 2022 18:35:58 +0000 (13:35 -0500)]
[Attributor] Ensure to use the proper liveness AA

When determining liveness via Attributor::isAssumedDead(...) we might
end up without a liveness AA or with one pointing into another function.
Neither is helpful and we will avoid both from now on.

Reapplied after fixing the ASAN error which caused the revert:
https://github.com/llvm/llvm-project/commit/db68a25ca90e0da46c9c33b027fa83260073bd28

2 years ago[lld-macho] Work around odr-use of const non-inline static data member to fix -O0...
Fangrui Song [Wed, 22 Jun 2022 02:22:28 +0000 (19:22 -0700)]
[lld-macho] Work around odr-use of const non-inline static data member to fix -O0 build after D128298

```
ld.lld: error: undefined symbol: lld::macho::CodeSignatureSection::blockSize
>>> referenced by SyntheticSections.cpp:1253 (/home/maskray/llvm/lld/MachO/SyntheticSections.cpp:1253)
>>>               tools/lld/MachO/CMakeFiles/lldMachO.dir/SyntheticSections.cpp.o:(lld::macho::CodeSignatureSection::writeHashes(unsigned char*) const::$_7::operator()(unsigned long) const)
```

2 years ago[lldb] Add a setting to specify the preferred dynamic class info extractor o
Jonas Devlieghere [Wed, 22 Jun 2022 00:45:48 +0000 (17:45 -0700)]
[lldb] Add a setting to specify the preferred dynamic class info extractor o

Add a setting to configure how LLDB parses dynamic Objective-C class
metadata. By default LLDB will choose the most appropriate method for
the target OS.

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

2 years ago[lldb] Instantiate lazily named classes on macOS Ventura.
Jonas Devlieghere [Wed, 22 Jun 2022 00:45:30 +0000 (17:45 -0700)]
[lldb] Instantiate lazily named classes on macOS Ventura.

Recent revisions of the Objective-C runtime changed
objc_debug_class_getNameRaw() in a way that no longer triggers lazy
names to be instantiated. This has the unintended side-effect of making
generic bridged Swift classes, such as _SwiftDeferredNSDictionary<U,V>
to become invisible to the Objective-C runtime.

This patch detects this situation and forces the names to be
instantiated by calling class_getName() and discarding the result before
calling objc_debug_class_getNameRaw() again.

Many thanks to Mike Ash for outlining the solution and Adrian for
authoring the downstream patch.

rdar://95245318

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

2 years agoRecommit "[SLP][X86] Improve reordering to consider alternate instruction bundles"
Vasileios Porpodas [Wed, 22 Jun 2022 00:10:23 +0000 (17:10 -0700)]
Recommit "[SLP][X86] Improve reordering to consider alternate instruction bundles"

This reverts commit 6d6268dcbf0f48e43f6f9fe46b3a28c29ba63c7d.

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

2 years ago[mlir][math] Support vector type by erf and round libm lowering
lewuathe [Tue, 21 Jun 2022 23:58:20 +0000 (08:58 +0900)]
[mlir][math] Support vector type by erf and round libm lowering

erf and round op are able to lowered to libm supporting vector type as other math operations.

Reviewed By: ftynse

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

2 years ago[lld/mac] Parallelize code signature computation
Nico Weber [Tue, 21 Jun 2022 19:21:46 +0000 (15:21 -0400)]
[lld/mac] Parallelize code signature computation

According to ministat, this is a small but measurable speedup
(using the repro in PR56121):

    N           Min           Max        Median           Avg        Stddev
x  10     3.7439518     3.7783802     3.7730219     3.7655502   0.012375226
+  10     3.6149218      3.692198     3.6519327     3.6502951   0.025905601
Difference at 95.0% confidence
-0.115255 +/- 0.0190746
-3.06078% +/- 0.506554%
(Student's t, pooled s = 0.0203008)

(Without 858e8b17f7365, this change here to use parallelFor is an 18% speedup,
and doing 858e8b17f7365 on top of this change is just a 2.55% +/- 0.58% win.
Doing both results in a total speedup of 20.85% +/- 0.44%.)

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

2 years agoRevert "[SLP][X86] Improve reordering to consider alternate instruction bundles"
Vasileios Porpodas [Wed, 22 Jun 2022 00:07:21 +0000 (17:07 -0700)]
Revert "[SLP][X86] Improve reordering to consider alternate instruction bundles"

This reverts commit 6f88acf410b48f3e6c1526df2dc32ed86f249685.

2 years ago[SLP][X86] Improve reordering to consider alternate instruction bundles
Vasileios Porpodas [Fri, 13 May 2022 15:52:17 +0000 (08:52 -0700)]
[SLP][X86] Improve reordering to consider alternate instruction bundles

During the reordering transformation we should try to avoid reordering bundles
like fadd,fsub because this may block them being matched into a single vector
instruction in x86.
We do this by checking if a TreeEntry is such a pattern and adding it to the
list of TreeEntries with orders that need to be considered.

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

2 years ago[SVE] Add isel patterns that match "FpImm - A" to the immediate form of FSUBR.
Paul Walker [Sat, 18 Jun 2022 13:34:37 +0000 (14:34 +0100)]
[SVE] Add isel patterns that match "FpImm - A" to the immediate form of FSUBR.

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

2 years ago[NFC][SVE] Simplify SUBR_ZI isel patterns.
Paul Walker [Sat, 18 Jun 2022 13:55:31 +0000 (14:55 +0100)]
[NFC][SVE] Simplify SUBR_ZI isel patterns.

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

2 years ago[SVE] Lower "unpredicated" sabd/uabd intrinsics to ISD::ABDS/U.
Paul Walker [Sat, 18 Jun 2022 12:36:22 +0000 (13:36 +0100)]
[SVE] Lower "unpredicated" sabd/uabd intrinsics to ISD::ABDS/U.

This enables an existing transformation that when combined with an
add will emit saba/uaba instructions.

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

2 years agoReland "[lld-macho] Show source information for undefined references"
Daniel Bertalan [Tue, 21 Jun 2022 20:40:27 +0000 (16:40 -0400)]
Reland "[lld-macho] Show source information for undefined references"

The error used to look like this:

  ld64.lld: error: undefined symbol: _foo
  >>> referenced by /path/to/bar.o:(symbol _baz+0x4)

If DWARF line information is available, we now show where in the source
the references are coming from:

  ld64.lld: error: unreferenced symbol: _foo
  >>> referenced by: bar.cpp:42 (/path/to/bar.cpp:42)
  >>>                /path/to/bar.o:(symbol _baz+0x4)

The reland is identical to the first time this landed. The fix was in D128294.
This reverts commit 0cc7ad417585b3185c32e395cc5e6cf082a347af.

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

2 years ago[mlir][sparse] refine bufferization allocation lowering
Aart Bik [Tue, 21 Jun 2022 21:13:14 +0000 (14:13 -0700)]
[mlir][sparse] refine bufferization allocation lowering

Marking bufferization allocation operation as invalid
during sparse lowering is too strict, since dense and
sparse allocation can co-exist. This revision refines
the lowering with a dynamic type check.

Reviewed By: bixia

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

2 years ago[gn build] Port 79fbee3cc562
LLVM GN Syncbot [Tue, 21 Jun 2022 21:53:32 +0000 (21:53 +0000)]
[gn build] Port 79fbee3cc562

2 years agoRe-apply "[JITLink][Orc] Add MemoryMapper interface with InProcess implementation"
Anubhab Ghosh [Tue, 21 Jun 2022 21:31:40 +0000 (23:31 +0200)]
Re-apply "[JITLink][Orc] Add MemoryMapper interface with InProcess implementation"

[JITLink][Orc] Add MemoryMapper interface with InProcess implementation

MemoryMapper class takes care of cross-process and in-process address space
reservation, mapping, transferring content and applying protections.

Implementations of this class can support different ways to do this such
as using shared memory, transferring memory contents over EPC or just
mapping memory in the same process (InProcessMemoryMapper).

The original patch landed with commit 6ede65205073d3cf6b1ed4d101e66eae3e0fc8e6
It was reverted temporarily in commit 6a4056ab2ada0046ff97a55a5fb34c2c59504fd1

Reviewed By: sgraenitz, lhames

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

2 years ago[RISCV] Add cost model test coverage for loads and stores (both fixed and scalable)
Philip Reames [Tue, 21 Jun 2022 21:42:50 +0000 (14:42 -0700)]
[RISCV] Add cost model test coverage for loads and stores (both fixed and scalable)

2 years ago[SLP][NFC] Precommit test for a followup patch that improves reordering for addsubs
Vasileios Porpodas [Thu, 12 May 2022 23:25:34 +0000 (16:25 -0700)]
[SLP][NFC] Precommit test for a followup patch that improves reordering for addsubs

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

2 years ago[ConstraintElimination] Add tests for transferring info between systems.
Florian Hahn [Tue, 21 Jun 2022 21:34:03 +0000 (23:34 +0200)]
[ConstraintElimination] Add tests for transferring info between systems.

2 years ago[Clang] Fix compile time regression caused by D126061.
Martin Boehme [Fri, 17 Jun 2022 20:41:53 +0000 (22:41 +0200)]
[Clang] Fix compile time regression caused by D126061.

As noted by @nikic, D126061 causes a compile time regression of about
0.5% on -O0 builds:

http://llvm-compile-time-tracker.com/compare.php?from=7acc88be0312c721bc082ed9934e381d297f4707&to=8c7b64b5ae2a09027c38db969a04fc9ddd0cd6bb&stat=instructions

This happens because, in a number of places, D126061 creates an
additional local variable of type `ParsedAttributes`. In the large
majority of cases, no attributes are added to this `ParsedAttributes`,
but it turns out that creating an empty `ParsedAttributes`, then
destroying it is a relatively expensive operation.

The reason for this is because `AttributePool` uses a `TinyPtrVector` as
its underlying vector class, and the technique that `TinyPtrVector`
employs to achieve its extreme memory frugality makes the `begin()` and
`end()` member functions relatively slow. The `ParsedAttributes`
destructor iterates over the attributes in its `AttributePool`, and this
is a relatively expensive operation because `TinyPtrVector`'s `begin()` and
`end()` are relatively slow.

The fix for this is to replace `TinyPtrVector` in `ParsedAttributes` and
`AttributePool` with `SmallVector`. `ParsedAttributes` and
`AttributePool` objects are only ever allocated on the stack (they're
not part of the AST), and only a small number of these objects are live
at any given time, so they don't need the extreme memory frugality of
`TinyPtrVector`.

I've confirmed with valgrind that this patch does not increase heap
memory usage, and it actually makes compiles slightly faster than they
were before D126061.

Here are instruction count measurements (obtained with callgrind)
running `clang -c MultiSource/Applications/JM/lencod/parsetcommon.c`
(a file from llvm-test-suite that exhibited a particularly large
compile-time regression):

7acc88be0312c721bc082ed9934e381d297f4707
(baseline one commit before D126061 landed)
102,280,068 instructions

8c7b64b5ae2a09027c38db969a04fc9ddd0cd6bb
(the patch that landed D126061)
103,289,454 instructions
(+0.99% relative to baseline)

This patch applied onto
8c7b64b5ae2a09027c38db969a04fc9ddd0cd6bb
101,117,584 instructions
(-1.14% relative to baseline)

Reviewed By: aaron.ballman

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

2 years ago[DAG] visitTRUNCATE - move TRUNCATE(ADDE/ADDCARRY) folds to switch statement handling...
Simon Pilgrim [Tue, 21 Jun 2022 21:07:28 +0000 (22:07 +0100)]
[DAG] visitTRUNCATE - move TRUNCATE(ADDE/ADDCARRY) folds to switch statement handling the other binops. NFC.

2 years ago[RISCV] Move the passthru operand for RISCVISD::VRGATHER*_VL nodes. NFC
Craig Topper [Tue, 21 Jun 2022 20:48:12 +0000 (13:48 -0700)]
[RISCV] Move the passthru operand for RISCVISD::VRGATHER*_VL nodes. NFC

Put it before the VL instead of as the first operand. I want to add
passthru to more operands, but the commutable ones like VADD_VL
require the commutable operands to be operand 0 and 1. So we can't
have the passthru as operand 0 for those.

2 years agoLoopVect, tests] Add some basic coverage for scalable costing of scatter/gather patte...
Philip Reames [Tue, 21 Jun 2022 20:54:53 +0000 (13:54 -0700)]
LoopVect, tests] Add some basic coverage for scalable costing of scatter/gather patterns on RISCV

This just adds some very basic vectorizer testing with both fixed and scalable vectorization enabled.

2 years ago[LoopVect, tests] Add some basic coverage for scalable costing on RISCV
Philip Reames [Tue, 21 Jun 2022 20:22:13 +0000 (13:22 -0700)]
[LoopVect, tests] Add some basic coverage for scalable costing on RISCV

This just adds some very basic vectorizer testing with both fixed and scalable vectorization enabled.  For context, I just yesterday fixed a crash in costing of the splat_ptr example - see bbf3fd.

2 years ago[polly] #include <algorithm>
Arthur Eubanks [Tue, 21 Jun 2022 20:26:40 +0000 (13:26 -0700)]
[polly] #include <algorithm>

For the usage of std::max in the header.

Speculative fix for
https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-windows-x64/b8810806780048763729/overview
reported in https://reviews.llvm.org/D125263.

2 years ago[DAG] Remove SelectionDAG::GetDemandedBits DemandedElts variant. NFC.
Simon Pilgrim [Tue, 21 Jun 2022 20:23:04 +0000 (21:23 +0100)]
[DAG] Remove SelectionDAG::GetDemandedBits DemandedElts variant. NFC.

We're slowly removing SelectionDAG::GetDemandedBits and replacing it with SimplifyMultipleUseDemandedBits, we no longer have any uses for the vector demanded elt variant.

2 years ago[libc++abi][AIX] Use _LIBCXXABI_FUNC_VIS for exported routines
Xing Xue [Tue, 21 Jun 2022 20:18:17 +0000 (16:18 -0400)]
[libc++abi][AIX] Use _LIBCXXABI_FUNC_VIS for exported routines

Summary:
This patch adds _LIBCXXABI_FUNC_VIS to the definitions of the personality and helper routines for the state table based EH, now that the support of the visibility attribute is being added to AIX Clang. Currently an export list is generated in the absence of the visibility attribute support downstream.

Reviewed by: MaskRay, daltenty

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

2 years agoRevert "Revert "[CMake] Enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR by default on Linux""
Fangrui Song [Tue, 21 Jun 2022 20:13:31 +0000 (13:13 -0700)]
Revert "Revert "[CMake] Enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR by default on Linux""

This reverts commit 90c9d41c8acc34fb68958f373eb23f53c1b1c840.

Keeping arm* LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on is sufficient to work around
LLVM_ENABLE_RUNTIMES not working well with arm. It is more important for
LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES to match in the file hierarchy.

2 years agoRoll back Michał's changes to debugserver, not meant for there
Jason Molenda [Tue, 21 Jun 2022 19:57:42 +0000 (12:57 -0700)]
Roll back Michał's changes to debugserver, not meant for there

Michał's change in https://reviews.llvm.org/D127193 did a search &
replace for a pattern that also appears in debugserver, but it
shouldn't be done there.

2 years ago[LV] Add new block to place recurrence splice, if needed.
Florian Hahn [Tue, 21 Jun 2022 19:54:37 +0000 (21:54 +0200)]
[LV] Add new block to place recurrence splice, if needed.

In some cases, a recurrence splice instructions needs to be inserted
between to regions, for example if the regions get re-arranged during
sinking.

Fixes #56146.

2 years ago[ADT] [lld-macho] Check for end iterator deref in filter_iterator_base
Daniel Bertalan [Tue, 21 Jun 2022 19:47:45 +0000 (15:47 -0400)]
[ADT] [lld-macho] Check for end iterator deref in filter_iterator_base

If ld64.lld was supplied an object file that had a `__debug_abbrev` or
`__debug_str` section, but didn't have any compile unit DIEs in
`__debug_info`, it would dereference an iterator pointing to the empty
array of DIEs. This underlying issue started causing segmentation faults
when parsing for `__debug_info` was addded in D128184. That commit was
reverted, and this one fixes the invalid dereference to allow relanding
it.

This commit adds an assertion to `filter_iterator_base`'s dereference
operators to catch bugs like this one.

Ran check-llvm, check-clang and check-lld.

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

2 years ago[lld/mac] Replace while loop with for loop
Nico Weber [Tue, 21 Jun 2022 19:12:02 +0000 (15:12 -0400)]
[lld/mac] Replace while loop with for loop

No behavior change. In preparation for using a parallelFor() here.

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

2 years agoAMDGPU: Regenerate test checks
Matt Arsenault [Wed, 15 Jun 2022 17:56:15 +0000 (13:56 -0400)]
AMDGPU: Regenerate test checks

2 years agoAMDGPU: Don't use branches to entry block in test
Matt Arsenault [Sat, 11 Jun 2022 15:12:36 +0000 (11:12 -0400)]
AMDGPU: Don't use branches to entry block in test

This created a weird loop making the tested registers live out of the
block, which I don't think is relevant to the purpose of the
tests. This caused regressions when the validity queries are changed
to use tests based whether the use instruction was a kill. If the
register was live out for the loop, it was still live.

I guess we could still do this in a narrow case where the value loops
back, but that's most a pointlessly complex case to handle.

2 years ago[AMDGPU] gfx11 Remove SDWA from shuffle_vector ISel
Joe Nash [Mon, 20 Jun 2022 13:50:17 +0000 (09:50 -0400)]
[AMDGPU] gfx11 Remove SDWA from shuffle_vector ISel

gfx11 does not have SDWA

Reviewed By: #amdgpu, rampitec

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

2 years ago[RISCV] Remove true_mask patterns for VRGATHERE16..
Craig Topper [Tue, 21 Jun 2022 18:54:56 +0000 (11:54 -0700)]
[RISCV] Remove true_mask patterns for VRGATHERE16..

After adding it to the table so the post-isel peephole can handle it.

2 years ago[RISCV] Remove true_mask patterns for VRGATHER.
Craig Topper [Tue, 21 Jun 2022 18:40:53 +0000 (11:40 -0700)]
[RISCV] Remove true_mask patterns for VRGATHER.

These can be handled by the post-isel peephole.

2 years ago[lld/mac] On Apple systems, call CC_SHA256 from libSystem
Nico Weber [Tue, 21 Jun 2022 17:49:26 +0000 (13:49 -0400)]
[lld/mac] On Apple systems, call CC_SHA256 from libSystem

It's in libSystem, so it doesn't bring in any new deps, and it's
currently much faster than LLVM's current SHA256 implementation.

Makes linking (arm64) Chromium Framework with ld64.lld 17% faster.
See also PR56121.

No behavior change.

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

2 years ago[DSE] Don't remove nounwind invokes
Heejin Ahn [Mon, 20 Jun 2022 05:48:48 +0000 (22:48 -0700)]
[DSE] Don't remove nounwind invokes

For non-mem-intrinsic and non-lifetime `CallBase`s, the current
`isRemovable` function only checks if the `CallBase` 1. has no uses 2.
will return 3. does not throw:
https://github.com/llvm/llvm-project/blob/80fb7823367c1d105fcbc8f21b69205a0d68c859/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp#L1017

But we should also exclude invokes even in case they don't throw,
because they are terminators and thus cannot be removed. While it
doesn't seem to make much sense for `invoke`s to have an `nounwind`
target, this kind of code can be generated and is also valid bitcode.

Reviewed By: nikic

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

2 years agoFix an unused-variable warning in release build, NFC.
Haojian Wu [Tue, 21 Jun 2022 18:52:07 +0000 (20:52 +0200)]
Fix an unused-variable warning in release build, NFC.

2 years ago[flang] Add more diagnostics to fir.coordinate_of
Valentin Clement [Tue, 21 Jun 2022 18:42:43 +0000 (20:42 +0200)]
[flang] Add more diagnostics to fir.coordinate_of

Add more diagnostics to fir.coordinate_of to provide better checking
that the IR is sane.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[libc++] Pass -fno-modules to clang-tidy instead of disabling it for the modules...
Nikolas Klauser [Tue, 21 Jun 2022 18:26:43 +0000 (20:26 +0200)]
[libc++] Pass -fno-modules to clang-tidy instead of disabling it for the modules build

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[libc++][clang-tidy] Enable bugprone-use-after-move and explicitly list all used...
Nikolas Klauser [Wed, 15 Jun 2022 08:21:19 +0000 (10:21 +0200)]
[libc++][clang-tidy] Enable bugprone-use-after-move and explicitly list all used checks

Reviewed By: #libc, ldionne

Spies: aheejin, libcxx-commits, xazax.hun

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

2 years ago[lldb] [llgs] Attempt to fix LLGS tests on Windows
Michał Górny [Tue, 21 Jun 2022 18:08:06 +0000 (20:08 +0200)]
[lldb] [llgs] Attempt to fix LLGS tests on Windows

Sponsored by: The FreeBSD Foundation

2 years ago[lld/mac] Extract a sha256() function
Nico Weber [Tue, 21 Jun 2022 17:46:40 +0000 (13:46 -0400)]
[lld/mac] Extract a sha256() function

No behavior change.

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

2 years ago[InstCombine] handle subobjects of constant aggregates
Martin Sebor [Tue, 21 Jun 2022 17:31:58 +0000 (11:31 -0600)]
[InstCombine] handle subobjects of constant aggregates

Remove the known limitation of the library function call folders to only
work with top-level arrays of characters (as per the TODO comment in
the code) and allows them to also fold calls involving subobjects of
constant aggregates such as member arrays.

2 years ago[lldb] [llgs] Add a test for detach-all packet
Michał Górny [Wed, 8 Jun 2022 11:09:08 +0000 (13:09 +0200)]
[lldb] [llgs] Add a test for detach-all packet

Add a test verifying that plain 'D' packet correctly detaches all
processes.

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

2 years ago[lldb] [llgs] Refactor fork/vfork tests, verify state
Michał Górny [Wed, 8 Jun 2022 10:52:52 +0000 (12:52 +0200)]
[lldb] [llgs] Refactor fork/vfork tests, verify state

Refactor the fork and vfork tests to reuse the code better, avoid
unnecessary regexps and avoid unnecessary conversions between
hex-strings and integers.

Verify the server state after detaching.  In particular, verify that
the detached process' PID/TID pair is no longer valid,
and that the correct process remains running.

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