platform/upstream/llvm.git
21 months agoRevert "[lld/mac] Port typo correction for undefined symbols from ELF port"
Hans Wennborg [Fri, 7 Oct 2022 11:37:28 +0000 (13:37 +0200)]
Revert "[lld/mac] Port typo correction for undefined symbols from ELF port"

This caused crashes/assert failures for some Chromium developers, see comment
on the code review.

> Ports:
> - core feature: https://reviews.llvm.org/D67039
> - case mismatch: https://reviews.llvm.org/D70506
> - extern "C" suggestions: https://reviews.llvm.org/D69592,
>   https://reviews.llvm.org/D69650
>
> Does not port https://reviews.llvm.org/D71735 since I believe that that doesn't
> apply to lld/Mach-O.
>
> Differential Revision: https://reviews.llvm.org/D135038

This reverts commit 8c45e80298f4e3eb6d9cfbafcb099bc087e4668e.

21 months ago[AArch64] Lower multiplication by a constant int to madd
zhongyunde [Fri, 7 Oct 2022 11:31:48 +0000 (19:31 +0800)]
[AArch64] Lower multiplication by a constant int to madd

Lower a = b * C -1 into madd
  a) instcombine change b * C -1 --> b * C + (-1)
  b) machine-combine change b * C + (-1) --> madd

Assembler will transform the neg immedate of sub to add, see https://gcc.godbolt.org/z/cTcxePPf4
Fixes AArch64 part of https://github.com/llvm/llvm-project/issues/57255.

Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D134336

21 months ago[mlir][llvmir] Import intrinsics with attributes from LLVMIR.
Tobias Gysi [Fri, 7 Oct 2022 11:13:24 +0000 (14:13 +0300)]
[mlir][llvmir] Import intrinsics with attributes from LLVMIR.

The revision adds support to specify custom import functions for
LLVM IR intrinsics with immediate arguments that translate to MLIR
attributes. It takes an approach similar to the MLIR to LLVM translation
that uses a tablegen defined build method. The default implementation
of this newly introduced "mlirBuilder" assumes all intrinsic arguments
translate to operands. Specific intrinsics, such as
llvm.lifetime.start/stop then define a custom builder that converts
their immediate arguments to MLIR attributes.

Depends on D135349

Reviewed By: ftynse

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

21 months ago[ConstraintElimination] Convert to unsigned Pred if possible.
Florian Hahn [Fri, 7 Oct 2022 11:27:35 +0000 (12:27 +0100)]
[ConstraintElimination] Convert to unsigned Pred if possible.

Convert SLE/SLT predicates to unsigned equivalents if both operands are
known to be signed-positive.

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

21 months ago[mlir][bufferize][NFC] Address review comments of D135420
Matthias Springer [Fri, 7 Oct 2022 10:47:29 +0000 (19:47 +0900)]
[mlir][bufferize][NFC] Address review comments of D135420

These changes should have been landed as part of D135420.

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

21 months ago[MLIR][Affine] Fix crash in normalizeMemRefType
Uday Bondhugula [Fri, 7 Oct 2022 08:21:57 +0000 (13:51 +0530)]
[MLIR][Affine] Fix crash in normalizeMemRefType

Fix crash in normalizeMemRefType. Correctly handle scenario and replace
assertion with a failure.

Reviewed By: dcaballe

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

21 months ago[LoopPeeling] Support peeling loops with non-latch exits
Nikita Popov [Tue, 27 Sep 2022 16:30:32 +0000 (18:30 +0200)]
[LoopPeeling] Support peeling loops with non-latch exits

Loop peeling currently requires that a) the latch is exiting
b) a branch and c) other exits are unreachable/deopt. This patch
removes all of these limitations, and adds the necessary branch
weight updating support. It essentially works the same way as
before with latch -> exiting terminator and
loop trip count -> per exit trip count.

It's worth noting that there are still other limitations in
profitability heuristics: This patch enables peeling of loops to
make conditions invariant (which is pretty much always highly
profitable if possible), while peeling to make loads dereferenceable
still checks that non-latch exits are unreachable and PGO-based
peeling has even more conditions. Those checks could be relaxed
later if we consider those cases profitable.

The motivation for this change is that loops using iterator adaptors
in Rust often optimize very badly, and end up with a loop phi of the
form phi(true, false) in the final result. Peeling eliminates that
phi and conditions based on it, which enables a lot of follow-on
simplification.

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

21 months agoKeep inherited dllimport/export attrs for explicit specialization of class template...
Hans Wennborg [Sun, 18 Sep 2022 23:05:56 +0000 (01:05 +0200)]
Keep inherited dllimport/export attrs for explicit specialization of class template member functions

Previously we were stripping these normally inherited attributes during
explicit specialization. However for class template member functions
(but not function templates), MSVC keeps the attribute.

This makes Clang match that behavior, and fixes GitHub issue #54717

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

21 months ago[clangd][Tweak] Make sure enclosing function doesnt have invalid children
Kadir Cetinkaya [Wed, 5 Oct 2022 11:27:53 +0000 (13:27 +0200)]
[clangd][Tweak] Make sure enclosing function doesnt have invalid children

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

21 months ago[ValueTracking] Remove unused Offset argument in getConstantStringInfo() (NFC)
Nikita Popov [Fri, 7 Oct 2022 09:32:58 +0000 (11:32 +0200)]
[ValueTracking] Remove unused Offset argument in getConstantStringInfo() (NFC)

21 months ago[LLDB] Add "frame select" as equivalent of GDB's "frame" command
David Spickett [Thu, 29 Sep 2022 13:03:43 +0000 (13:03 +0000)]
[LLDB] Add "frame select" as equivalent of GDB's "frame" command

This is useful for answering the question "where am I?" and is surprisingly
difficult to figure out without just doing another step command.

Reviewed By: awarzynski

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

21 months ago[LangRef] Fix too short title underline
eopXD [Fri, 7 Oct 2022 09:24:56 +0000 (02:24 -0700)]
[LangRef] Fix too short title underline

21 months ago[VP][RISCV] Add vp.roundtozero and its RISC-V support
eopXD [Wed, 5 Oct 2022 01:10:14 +0000 (18:10 -0700)]
[VP][RISCV] Add vp.roundtozero and its RISC-V support

The scalar instruction of this is `llvm.trunc`. However the naming of
ISD::VP_TRUNC is already taken by `trunc` of the LLVM IR. Naming this as
`vp.ftrunc` would likely cause confusion with `vp.fptrunc`. So adding
`vp.roundtozero` that will look similar to `vp.roundeven`.

Reviewed By: frasercrmck

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

21 months ago[LLDB] Fix crash when printing a struct with a static signed char member
David Spickett [Wed, 5 Oct 2022 11:30:05 +0000 (11:30 +0000)]
[LLDB] Fix crash when printing a struct with a static signed char member

As with static bool for whatever reason printing them on their own
worked fine but wasn't handled when you printed the whole type.

I don't see a good way to test this from clang's side so our existing
tests will have to do.

We can now print all of the struct "A", so there's no need for a separate
one for static bool testing. I've not checked the output, just that it
succeeds. This saves us having to handle different min/max between systems.

Depends on D135169

Reviewed By: aeubanks, shafik

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

21 months ago[LoopPredication] Insert assumes of conditions of predicated guards
Dmitry Makogon [Thu, 6 Oct 2022 09:30:48 +0000 (16:30 +0700)]
[LoopPredication] Insert assumes of conditions of predicated guards

As LoopPredication performs non-equivalent transforms removing some
checks from loops, other passes may not be able to perform transforms
they'd be able to do if the checks were left in loops.

This patch makes LoopPredication insert assumes of the replaced
conditions either after a guard call or in the true block of
widenable condition branch.

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

21 months ago[llvm-reduce] Fix unused variable warning (NFC)
Nikita Popov [Fri, 7 Oct 2022 09:07:17 +0000 (11:07 +0200)]
[llvm-reduce] Fix unused variable warning (NFC)

21 months ago[OpenMP] [OMPD] Build gdb-plugin code only when python3 development files are available.
Vignesh Balasubramanian [Tue, 20 Sep 2022 12:12:26 +0000 (17:42 +0530)]
[OpenMP] [OMPD] Build gdb-plugin code only when python3 development files are available.

gdb-plugin code is a interface between gdb, libompd, gdb and libomp.
Python3 development files are required to build this utility.
This patch will disable the plugin code build when python3 dev files
are not available.

Reviewed By: @mgorny, @aaronpuchert
Differential Revision: https://reviews.llvm.org/D134275

21 months agoReapply [InstCombine] Switch foldOpIntoPhi() to use InstSimplify
Nikita Popov [Fri, 30 Sep 2022 10:13:40 +0000 (12:13 +0200)]
Reapply [InstCombine] Switch foldOpIntoPhi() to use InstSimplify

Relative to the previous attempt, this adjusts simplification to
use the correct context instruction: We need to use the terminator
of the incoming block, not the original instruction.

-----

foldOpIntoPhi() currently only folds operations into the phi if all
but one operands constant-fold. The two exceptions to this are freeze
and select, where we allow more general simplification.

This patch makes foldOpIntoPhi() generally simplification based and
removes all the instruction-specific logic. We just try to simplify
the instruction for each operand, and for the (potentially) one
non-simplified operand, we move it into the new block with adjusted
operands.

This fixes https://github.com/llvm/llvm-project/issues/57448, which
was my original motivation for the change.

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

21 months ago[LLDB] Fix printing a static bool struct member when using "image lookup -t"
David Spickett [Tue, 4 Oct 2022 14:56:12 +0000 (14:56 +0000)]
[LLDB] Fix printing a static bool struct member when using "image lookup -t"

Fixes #58135

Somehow lldb was able to print the member on its own but when we try
to print the whole type found by "image lookup -t" lldb would crash.

This is because we'd encoded the initial value of the member as an integer.
Which isn't the end of the world because bool is integral for C++.
However, clang has a special AST node to handle literal bool and it
expected us to use that instead.

This adds a new codepath to handle static bool which uses cxxBoolLiteralExpr
and we get the member printed as you'd expect.

For testing I added a struct with just the bool because trying to print
all of "A" crashes as well. Presumably because one of the other member's
types isn't handled properly either.

So for now I just added the bool case, we can merge it with A later.

Reviewed By: aeubanks

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

21 months ago[InstCombine] Add test for foldOpIntoPhi() context instr (NFC)
Nikita Popov [Fri, 7 Oct 2022 08:59:22 +0000 (10:59 +0200)]
[InstCombine] Add test for foldOpIntoPhi() context instr (NFC)

Reduced test case for the miscompile reported at
https://reviews.llvm.org/D134954#3840475.

21 months ago[GISel] Add Trunc/Lshr/BuildVector Folding
Pierre van Houtryve [Wed, 5 Oct 2022 07:27:24 +0000 (07:27 +0000)]
[GISel] Add Trunc/Lshr/BuildVector Folding

Similar to the current "Trunc/BuildVector" folding - which folds low element extracts of BuildVectors, folds hi element extracts done using bitshifts.

For D134354

Reviewed By: arsenm

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

21 months ago[LLDB] Add missing space in help for frame-format-unique setting
David Spickett [Fri, 7 Oct 2022 08:42:01 +0000 (08:42 +0000)]
[LLDB] Add missing space in help for frame-format-unique setting

21 months agoUpdate RELEASE_TESTERS.TXT
Diana Picus [Fri, 7 Oct 2022 08:35:11 +0000 (10:35 +0200)]
Update RELEASE_TESTERS.TXT

armv7 and AArch64 releases are handled by Linaro.

21 months ago[GISel] Handle G_TRUNC in `matchExtractVecEltBuildVec`
Pierre van Houtryve [Tue, 4 Oct 2022 11:06:15 +0000 (11:06 +0000)]
[GISel] Handle G_TRUNC in `matchExtractVecEltBuildVec`

Spotted some cases in D134354 where this was an issue.

Reviewed By: arsenm

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

21 months ago[ConstraintElimination] Add test that crash in earlier var handling.
Florian Hahn [Fri, 7 Oct 2022 08:31:45 +0000 (09:31 +0100)]
[ConstraintElimination] Add test that crash in earlier var handling.

Add a test that caused a crash in the new variable handling code in
earlier versions.

21 months agoNFC. Remove unnecessary builder argument in Affine Utils helper
Uday Bondhugula [Fri, 7 Oct 2022 08:16:13 +0000 (13:46 +0530)]
NFC. Remove unnecessary builder argument in Affine Utils helper

NFC. Remove unnecessary builder argument in an Affine Utils helper
function: normalizeMemRefType. A builder was never needed. While on
this, fix a clang-tidy warning from the same file.

Reviewed By: dcaballe

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

21 months ago[mlir] fix memory effects of transform::PDLMatchOp
Alex Zinenko [Fri, 7 Oct 2022 08:14:30 +0000 (08:14 +0000)]
[mlir] fix memory effects of transform::PDLMatchOp

The op was declaring the effects associated with payload IR as attached
to its operand since ODS doesn't allow otherwise. Implement the memory
effects query method in C++ instead to make the effect not attached to
the operand.

21 months ago[CodeGenCXX] Convert more tests to opaque pointers (NFC)
Nikita Popov [Thu, 6 Oct 2022 10:38:56 +0000 (12:38 +0200)]
[CodeGenCXX] Convert more tests to opaque pointers (NFC)

Conversion was performed using
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
plus manual (but uninteresting) fixups.

21 months ago[mlir][tblgen] Fix crash in `-gen-enum-(decls|defs)` when `EnumAttrInfo` is not defined
Markus Böck [Fri, 7 Oct 2022 07:30:45 +0000 (09:30 +0200)]
[mlir][tblgen] Fix crash in `-gen-enum-(decls|defs)` when `EnumAttrInfo` is not defined

This should instead simply produce an empty file instead of crashing and causing a build to fail. This allows one to be more lazy in cmake code and just always generate the files for enum attributes, even if none are ever defined in the dialect.

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

21 months ago[mlir][bufferize] Fix repetitive region conflict detection
Matthias Springer [Fri, 7 Oct 2022 07:33:33 +0000 (16:33 +0900)]
[mlir][bufferize] Fix repetitive region conflict detection

This fixes a bug where a required buffer copy was not inserted.

Not only written aliases, but also read aliases should be taken into account when computing common enclosing repetitive regions. Furthermore, for writing ops, it does not matter where the destination tensor is defined, but where the op itself is located.

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

21 months ago[SourceManager] Improve getFileIDLocal.
Haojian Wu [Sun, 2 Oct 2022 09:54:05 +0000 (11:54 +0200)]
[SourceManager] Improve getFileIDLocal.

Prune the search space -- If we know offset(LastFileIDLookup) < SearchOffset, we
can prune the initial binary-search range from [0, end) to [LastFileIDlookup, end).

It reduces the binary search scan by ~30%.

SemaExpr.cpp:   1393437 -> 1035426
FindTarget.cpp: 1275930 -> 920087

Linux kernel:
getFileIDLocal: 2.45% -> 2.15%

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

21 months ago[flang][NFC] Update fir.dispatch format in doc
Valentin Clement [Fri, 7 Oct 2022 07:24:50 +0000 (09:24 +0200)]
[flang][NFC] Update fir.dispatch format in doc

21 months ago[Lex] Simplify and cleanup the updateConsecutiveMacroArgTokens implementation.
Haojian Wu [Fri, 30 Sep 2022 08:34:04 +0000 (10:34 +0200)]
[Lex] Simplify and cleanup the updateConsecutiveMacroArgTokens implementation.

The code falls back to the pre-2011 partition-file-id solution (see for
[details](https://reviews.llvm.org/D20401#3823476)).

This patch simplifies/rewrites the code based on the partition-based-on-file-id
idea. The new implementation is optimized by reducing the number of
calling getFileID (~40% drop).

Despite the huge drop of getFileID, this is a marignal improvment on
speed (becase the number of calling non-cached getFileID is roughly
the same). It removes the evaluation-order performance gap between gcc-built-clang
and clang-built-clang.

SemaExpr.cpp:
- before: 315063 SLocEntries, FileID scans: 388230 linear, 1393437 binary. 458893 cache hits, 672299 getFileID calls
- after:  313494 SLocEntries, FileID scans: 397525 linear, 1451890 binary, 176714 cache hits, 397144 getFileID calls

FindTarget.cpp:
- before: 279984 SLocEntries, FileID scans: 361926 linear, 1275930 binary, 436072 cache hits, 632150 getFileID calls
- after:  278426 SLocEntries, FileID scans: 371279 linear, 1333963 binary, 153705 cache hits, 356814 getFileID calls

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

21 months ago[clang] Fix a warning
Kazu Hirata [Fri, 7 Oct 2022 06:59:34 +0000 (23:59 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/Analysis/ThreadSafety.cpp:1788:12: error: unused variable
  'inserted' [-Werror,-Wunused-variable]

21 months ago[CodeView] Avoid NULL deref of Scope
Mike Hommey [Fri, 7 Oct 2022 06:34:05 +0000 (08:34 +0200)]
[CodeView] Avoid NULL deref of Scope

Regression from D131400: cross-language LTO causes a crash in the
compiler on the NULL deref of Scope in `isa` call when Rust IR is
involved. Presumably, this might affect other languages too, and
even Rust itself without cross-language LTO when the Rust compiler
switched to LLVM 16.

Reviewed By: rnk

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

21 months ago[llvm] [lit] Fix use_lld() to respect llvm_shlib_dir
Michał Górny [Thu, 6 Oct 2022 14:41:04 +0000 (16:41 +0200)]
[llvm] [lit] Fix use_lld() to respect llvm_shlib_dir

Fix the use_lld() to use llvm_shlib_dir similarly to how use_clang()
does it.  This fixes use_lld() wrongly prepending llvm_libs_dir,
i.e. the directory with system-installed LLVM libraries before
the build directory of standalone build.  As a result, the shared
libraries from an earlier version of clang end up being used instead of
the newly built version when running the test suite prior to installing.

To reproduce the problem, build and install LLVM with dylibs first,
e.g.:

    cmake ../llvm -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel \
      -DCMAKE_INSTALL_PREFIX="${HOME}"/llvm-test \
      -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON \
      -DLLVM_INSTALL_UTILS=ON
    ninja install

Then build clang against that installation and run tests:

    export LD_LIBRARY_PATH=~/llvm-test/lib
    export PATh=~/llvm-test/bin:"${PATH}"
    cmake ../clang -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel \
      -DCMAKE_INSTALL_PREFIX="${HOME}"/llvm-test \
      -DCLANG_LINK_CLANG_DYLIB=ON -DLLVM_BUILD_TESTS=ON \
      -DLLVM_EXTERNAL_LIT="${PWD}"/bin/llvm-lit
    ninja check-clang

The tests will be run with LD_LIBRARY_PATH of:

    /home/${USER}/llvm-test/lib:/home/${USER}/llvm-project/build-clang/lib

As a result, installed libclang-cpp will take precedence over the one
from build dir.  With the patch, the correct path is used, i.e.:

    /home/${USER}/llvm-project/build-clang/lib:/home/${USER}/llvm-test/lib

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

21 months ago[libc] Resolve NaN/implementation-defined behavior of floating-point tests
Dominic Chen [Thu, 29 Sep 2022 21:57:56 +0000 (14:57 -0700)]
[libc] Resolve NaN/implementation-defined behavior of floating-point tests

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

21 months agogn build: s/target_os/current_os/g
Peter Collingbourne [Fri, 7 Oct 2022 03:55:13 +0000 (20:55 -0700)]
gn build: s/target_os/current_os/g

21 months agogn build: Do not build libunwind.so for Android.
Peter Collingbourne [Fri, 7 Oct 2022 03:52:22 +0000 (20:52 -0700)]
gn build: Do not build libunwind.so for Android.

Android does not use a shared libunwind.so and its presence in the build
directory can be harmful, for example it can end up being dynamically
linked against while not being present on the device.

21 months ago[CMake] Update cache file for Win to ARM Linux cross toolchain builders. NFC.
Vladimir Vereschaka [Fri, 7 Oct 2022 02:18:10 +0000 (19:18 -0700)]
[CMake] Update cache file for Win to ARM Linux cross toolchain builders. NFC.

Do not specify the execution directory in the remote execution script command line
for the compiler-rt builtin library tests. There is a single execution file tests
within the single directory. No need to pack all of them every time, just run one by one.

21 months agoUpdate the remote test launch utility (utils/remote-exec.py).
Vladimir Vereschaka [Fri, 7 Oct 2022 02:07:33 +0000 (19:07 -0700)]
Update the remote test launch utility (utils/remote-exec.py).

Allowed a single file execution without the execution directory.

21 months ago[DirectX backend] Add analysis to collect DXILResources
Xiang Li [Tue, 4 Oct 2022 20:02:49 +0000 (13:02 -0700)]
[DirectX backend] Add analysis to collect DXILResources

Now only DXILTranslateMetadata uses DXILResources, so DXILResourceWrapper is only used by DXILTranslateMetadata.
Once we add lower for createHandle, DXILResourceWrapper will be used in more passes.
Also we can add resource index allocation in DXILResourceWrapper.

Reviewed By: beanz

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

21 months ago[flang] Represent TARGET for globals with 'target' attribute.
Slava Zakharin [Wed, 5 Oct 2022 18:17:09 +0000 (11:17 -0700)]
[flang] Represent TARGET for globals with 'target' attribute.

TARGET dummy arguments have fir.target attribute attached to them,
but globals do not have any sign of TARGET. This patch adds
target attribute for globals, which can be queried via
::fir::GlobalOp::getTarget().

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

21 months ago[mlir][bufferize] Fix enclosing repetitive region computation
Matthias Springer [Fri, 7 Oct 2022 01:36:31 +0000 (10:36 +0900)]
[mlir][bufferize] Fix enclosing repetitive region computation

The wrong function overload was called.

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

21 months ago[Clang] Fix unknown argument test on Windows
Joseph Huber [Fri, 7 Oct 2022 01:14:31 +0000 (20:14 -0500)]
[Clang] Fix unknown argument test on Windows

Summary:
This added a check for no unknown argument warnings. This apparently
occurs in the Windows toolchain as it cannot find a toolchain. This
patch fixes it by just ignoring this warning.

21 months agoApply clang-tidy fixes for performance-move-const-arg in IntegerRelation.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 18:17:40 +0000 (18:17 +0000)]
Apply clang-tidy fixes for performance-move-const-arg in IntegerRelation.cpp (NFC)

21 months ago[mlir] Fix test failure with invalid piping syntax on old bash
Kai Sasaki [Fri, 7 Oct 2022 00:29:36 +0000 (09:29 +0900)]
[mlir] Fix test failure with invalid piping syntax on old bash

Using '|&' syntax for piping both stdout and stderr is not supported by older bash. macOS pre-installs 3.2.57 as of today, and it causes test failure due to unexpected token '&'. We can use '2>&1' instead to make it compatible as much as possible.

```
******************** TEST 'MLIR :: mlir-cpu-runner/invalid.mlir' FAILED ********************
Script:
--
: 'RUN: at line 1';   not mlir-cpu-runner --no-implicit-module llvm-project/mlir/test/mlir-cpu-runner/invalid.mlir |& llvm-project/build/bin/FileCheck llvm-project/mlir/test/mlir-cpu-runner/invalid.mlir
--
Exit Code: 2

Command Output (stderr):
--
mlir-cpu-runner/Output/invalid.mlir.script: line 1: syntax error near unexpected token `&'
/mlir-cpu-runner/Output/invalid.mlir.script: line 1: `set -o pipefail;{ : 'RUN: at line 1';   not mlir-cpu-runner --no-implicit-module llvm-project/mlir/test/mlir-cpu-runner/invalid.mlir |& llvm-project/build/bin/FileCheck llvm-project/mlir/test/mlir-cpu-runner/invalid.mlir; }'
```

Reference: https://stackoverflow.com/questions/35384999/what-does-mean-in-bash

Reviewed By: ftynse

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

21 months ago[clang][LTO] Remove the use of `--` for arange option
Qiongsi Wu [Thu, 6 Oct 2022 23:56:45 +0000 (19:56 -0400)]
[clang][LTO] Remove the use of `--` for arange option

https://reviews.llvm.org/D134668 removed all `--` (double dashes) when using `plugin-opt` to pass linker options and replaced them with `-`. https://reviews.llvm.org/D133092 was committed later but introduced an instance of `--`. This patch replaces the `--` with `-`.

Reviewed By: MaskRay

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

21 months ago[DeviceRTL] Fix a CMake multi-step compilation dependency issue.
Ye Luo [Fri, 7 Oct 2022 00:05:14 +0000 (19:05 -0500)]
[DeviceRTL] Fix a CMake multi-step compilation dependency issue.

caused by 92233159035d1b50face95d886901cf99035bd99

21 months ago[OpenMP][AMDGPU] Add 'uniform-work-group' attribute to OpenMP kernels
Joseph Huber [Thu, 6 Oct 2022 16:17:39 +0000 (11:17 -0500)]
[OpenMP][AMDGPU] Add 'uniform-work-group' attribute to OpenMP kernels

The `cl-uniform-work-group` attribute asserts that the global work-size
be a multiple of the work-group specified work group size. This should
allow optimizations. It is already present by default in the AMD
compiler and for HIP kernels so it should be safe to allow this for
OpenMP kernels by default.

Reviewed By: jdoerfert

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

21 months ago[clang][modules] Fix handling of `ModuleHeaderRole::ExcludedHeader`
Jan Svoboda [Thu, 6 Oct 2022 23:03:48 +0000 (16:03 -0700)]
[clang][modules] Fix handling of `ModuleHeaderRole::ExcludedHeader`

This is a follow-up to D134224. The original patch added new `ExcludedHeader` enumerator to `ModuleMap::ModuleHeaderRole` and started associating headers with the modules they were excluded from. This was necessary to consider their module maps as "affecting" in certain situations and in turn serialize them into the PCM.

The association of the header and module needs to be handled when deserializing the PCM as well, though. This patch fixes a potential assertion failure and a regression. This essentially reverts parts of feb54b6ded123f8118fdc20620d3f657dfeab485.

Reviewed By: Bigcheese

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

21 months ago[Clang] Emit a warning for ambiguous joined '-o' arguments
Joseph Huber [Thu, 6 Oct 2022 19:50:45 +0000 (14:50 -0500)]
[Clang] Emit a warning for ambiguous joined '-o' arguments

The offloading toolchain makes heavy use of options beginning with
`--o`. This is problematic when combined with the joined `-o` flag. In
the following situation, the user will not get the expected output and
will not notice as the expected output will still be written.
```
clang++ -x cuda foo.cu -offload-arch=sm_80 -o foo
```

This patch introduces a warning that checks for joined `-o` arguments
that would also be a valid driver argument if an additional `-` were
added. I believe this situation is uncommon enough to warrant a warning,
and can be trivially fixed by the end user by using the more common
separate form instead.

Reviewed By: tra, MaskRay

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

21 months ago[llvm] Clear the ForwardRefDSOLocalEquivalentIDs map
Leonard Chan [Thu, 6 Oct 2022 23:13:42 +0000 (23:13 +0000)]
[llvm] Clear the ForwardRefDSOLocalEquivalentIDs map

I accidentally cleared ForwardRefDSOLocalEquivalentNames twice instead.

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

21 months ago[RISCV] Use mask agnostic policy for isel patterns where the merge operand is IMPLICI...
Craig Topper [Thu, 6 Oct 2022 22:23:12 +0000 (15:23 -0700)]
[RISCV] Use mask agnostic policy for isel patterns where the merge operand is IMPLICIT_DEF.

I tend to think we should ignore the policy bit in vsetvli insertion
if the tied operand is IMPLICIT_DEF. But that raises questions about
what the policy operand on RVV intrinsics means if you also pass
vundefined().

This change at least fixes some cases. I'll post a separate patch
for vsetvli insertion for discussion.

Reviewed By: reames

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

21 months ago[SmallVector] Reallocate if assigned memory is right after the current vector, create...
Alina Sbirlea [Tue, 23 Aug 2022 22:39:09 +0000 (15:39 -0700)]
[SmallVector] Reallocate if assigned memory is right after the current vector, created with capacity 0

Potential solution for
https://github.com/llvm/llvm-project/issues/57324.

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

21 months ago[libc][obvious] move kill into fullbuild only
Michael Jones [Thu, 6 Oct 2022 22:34:33 +0000 (15:34 -0700)]
[libc][obvious] move kill into fullbuild only

Signal is currently fullbuild only, so all functions inside it should be
as well.

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

21 months ago[libc] add kill
Michael Jones [Thu, 6 Oct 2022 21:59:30 +0000 (14:59 -0700)]
[libc] add kill

Add the kill syscall wrapper and tests.

Reviewed By: sivachandra

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

21 months ago[flang] Correct epistemological edge cases for IS_CONTIGUOUS folding
Peter Klausler [Thu, 6 Oct 2022 00:15:50 +0000 (17:15 -0700)]
[flang] Correct epistemological edge cases for IS_CONTIGUOUS folding

Don't return a hard .FALSE. when folding IS_CONTIGUOUS() unless the
subscript triplets are discontiguous and array section is nonempty,
or if the array section is nonempty and there is a vector subscript.

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

21 months agofix
Peter Klausler [Wed, 5 Oct 2022 22:40:13 +0000 (15:40 -0700)]
fix

21 months ago[flang][runtime] Handle array components in NAMELIST input
Peter Klausler [Tue, 4 Oct 2022 21:14:05 +0000 (14:14 -0700)]
[flang][runtime] Handle array components in NAMELIST input

A namelist input item that is a derived type component reference
needs additional processing when the base item or the component
is an array.  When both have rank > 0, the component reference
must of course be subscripted.

(Fixes https://gitlab-master.nvidia.com/fortran/f18-stage/-/issues/999, NAG test t/tz2.)

21 months ago[llvm-profdata] Add some missing options to docs
Ellis Hoag [Thu, 6 Oct 2022 22:17:30 +0000 (15:17 -0700)]
[llvm-profdata] Add some missing options to docs

I forgot to add documentation for these options when I added them to the `show` command, so add them now.

Reviewed By: phosek

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

21 months ago[libc] fix futex type
Michael Jones [Tue, 27 Sep 2022 22:29:09 +0000 (15:29 -0700)]
[libc] fix futex type

Previously the futex type was defined in terms of unsigned int, now it's
uint32, which is more portable.

Reviewed By: sivachandra

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

21 months ago[RISCV] Use branchless form for selects with -1 in either arm
Philip Reames [Thu, 6 Oct 2022 22:12:37 +0000 (15:12 -0700)]
[RISCV] Use branchless form for selects with -1 in either arm

We can lower these as an or with the negative of the condition value. This appears to result in significantly less branch-y code on multiple common idioms (as seen in tests).

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

21 months ago[RISCV] Verify that policy operands only exist on instructions with tied passthru...
Philip Reames [Thu, 6 Oct 2022 22:11:34 +0000 (15:11 -0700)]
[RISCV] Verify that policy operands only exist on instructions with tied passthru operands

This is a non-trivial property relied upon by D135396. I wrote this to convince myself it was true.

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

21 months ago[gn build] Port 96a509bca28b
LLVM GN Syncbot [Thu, 6 Oct 2022 22:03:16 +0000 (22:03 +0000)]
[gn build] Port 96a509bca28b

21 months ago[HLSL] Remove global ctor/dtor variable for non-lib profile.
Xiang Li [Thu, 6 Oct 2022 21:00:25 +0000 (14:00 -0700)]
[HLSL] Remove global ctor/dtor variable for non-lib profile.

After generated call for ctor/dtor for entry, global variable for ctor/dtor are useless.
Remove them for non-lib profiles.
Lib profile still need these in case export function used the global variable which require ctor/dtor.

Reviewed By: efriedma

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

21 months agoRevert "Remove the dependency between lib/DebugInfoDWARF and MC."
Shubham Sandeep Rastogi [Thu, 6 Oct 2022 21:58:10 +0000 (14:58 -0700)]
Revert "Remove the dependency between lib/DebugInfoDWARF and MC."

This reverts commit d96ade00c3c96bd451c60e34a17e613cdd5fdc38.

21 months agoimplement `std::views::istream`
Hui Xie [Mon, 5 Sep 2022 15:45:47 +0000 (16:45 +0100)]
implement `std::views::istream`

implement `std::ranges::basic_istream_view` and `std::views::istream`. Although the view itself is constexpr,
the constructor argument is a base class std::istream where its ctor/dtor are not constexpr. So no tests are performed in
constexpr

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

21 months ago[flang][runtime] Handle array components in NAMELIST input
Peter Klausler [Tue, 4 Oct 2022 21:14:05 +0000 (14:14 -0700)]
[flang][runtime] Handle array components in NAMELIST input

A namelist input item that is a derived type component reference
needs additional processing when the base item or the component
is an array.  When both have rank > 0, the component reference
must of course be subscripted.

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

21 months agoRemove the dependency between lib/DebugInfoDWARF and MC.
Shubham Sandeep Rastogi [Thu, 6 Oct 2022 19:15:07 +0000 (12:15 -0700)]
Remove the dependency between lib/DebugInfoDWARF and MC.

This patch had to be reverted because on gcc 7.5.0 we see an error converting from std::unique_ptr<MCRegisterInfo> to Expected<std::unique_ptr<MCRegisterInfo>> as the return type for the function createRegInfo. This has now been fixed.

21 months ago[flang] Supply missing source location for a message
Peter Klausler [Tue, 4 Oct 2022 20:45:11 +0000 (13:45 -0700)]
[flang] Supply missing source location for a message

An error message in semantic analysis of SELECT TYPE type guards
doesn't allow for the possibility of failure from FindSourceLocation(),
and that can happen when the type guard is just an intrinsic type
name like "type is (character)".  Deal with it.

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

21 months ago[AMDGPU] Add test coverage to ensure first regallocfast only allocates SGPR
Jeffrey Byrnes [Thu, 6 Oct 2022 21:29:04 +0000 (14:29 -0700)]
[AMDGPU] Add test coverage to ensure first regallocfast only allocates SGPR

Register allocation is split into two passes, and the expected behavior is that the first pass only should only work on virtual SGPRs. Whereas the second pass works on virtual VGPRs. This adds a test case which breaks if the first pass allocates VGPRs.

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

21 months ago[gn build] Port 2c799b7793cc
LLVM GN Syncbot [Thu, 6 Oct 2022 21:24:57 +0000 (21:24 +0000)]
[gn build] Port 2c799b7793cc

21 months ago[llvm-reduce] Add pass that reduces DebugInfo metadata
Matthew Voss [Thu, 6 Oct 2022 21:20:13 +0000 (14:20 -0700)]
[llvm-reduce] Add pass that reduces DebugInfo metadata

This new pass for llvm-reduce attempts to reduce DebugInfo metadata.
The process used is:
  1. Scan every MD node, keeping track of nodes already visited.
  2. Look for DebugInfo nodes, then record any operands that are lists.
  3. Bisect though all the elements of the collected lists.

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

21 months ago[mlir][sparse] remove llvm dependence from sparse bazel
Aart Bik [Thu, 6 Oct 2022 21:10:36 +0000 (14:10 -0700)]
[mlir][sparse] remove llvm dependence from sparse bazel

Reviewed By: wrengr, Peiming

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

21 months ago[ConstraintElimination] Add tests where unsigned system can be queried.
Florian Hahn [Thu, 6 Oct 2022 21:11:51 +0000 (22:11 +0100)]
[ConstraintElimination] Add tests where unsigned system can be queried.

Add tests with a mix of signed and unsigned predicates. In some cases,
the unsigned system can be queried for signed predicates to improve
results.

21 months ago[flang] Improve syntax error messages by fixing withMessage() parser combinator
Peter Klausler [Tue, 4 Oct 2022 20:14:49 +0000 (13:14 -0700)]
[flang] Improve syntax error messages by fixing withMessage() parser combinator

The parser combinator withMessage("error message"_err_en_US, PARSER) is meant
to run the parser PARSER and, if it fails, override its error messages if
it failed silently or it was unable to recognize any tokens at all.  This
gives the parser a way to avoid emitting some confusing or missing error
messages.  Unfortunately, the implementation could sometimes lose track of
whether any tokens had been recognized, leading to problems with outer usage
of withMessage() and also -- more seriously -- with ParseState::CombineFailedParses().
That's a utility that determines which error messages to retain when two
or more parsers have been attempted at the same starting point and none
of them succceed.  Its policy is to retain the state from the parser that
consumed the most input text before failing, so long as it had recognized at
least one token.

So anyway, fix up withMessage(), adjust the tests, and add a test of the
original motivating confusing error situation, in which a syntax error in
a COMMON statement was being diagnosed as a problem with a statement function
definition because withMessage() had lost the fact that the parse of the
COMMON statement had recognized some tokens, and the last attempted parse
later was a failed attempt to parse a statement function.

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

21 months ago[mlir][sparse] minor header ordering cleanup
Aart Bik [Thu, 6 Oct 2022 17:53:33 +0000 (10:53 -0700)]
[mlir][sparse] minor header ordering cleanup

Order of methods was getting a bit out of sync with headers

Reviewed By: Peiming

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

21 months ago[mlir][sparse] Favors synthetic tensor over other undefined tensors
Peiming Liu [Thu, 6 Oct 2022 17:41:48 +0000 (17:41 +0000)]
[mlir][sparse] Favors synthetic tensor over other undefined tensors

Reviewed By: aartbik

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

21 months ago[flang] Add missing source location to a semantic error message
Peter Klausler [Tue, 4 Oct 2022 19:41:48 +0000 (12:41 -0700)]
[flang] Add missing source location to a semantic error message

Ensure that the semantic error "An allocatable or pointer component
reference must be applied to a scalar base" is emitted with a source
code location.

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

21 months agoRevert "[llvm-reduce] Remove debug metadata elements"
Ellis Hoag [Thu, 6 Oct 2022 20:11:35 +0000 (13:11 -0700)]
Revert "[llvm-reduce] Remove debug metadata elements"

This reverts commit 69549de865550e54983ed8d00009920184de47ff.

The change in D135237 can lead to verification failures like `scope must have two or three operands`.
The ongoing work in D132077 does something similar without these failures, so lets wait for that to land and revert this patch.

Reviewed By: aeubanks

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

21 months ago[lldb] Skip check for conflicting filter/synth when adding a new regex.
Jorge Gorbe Moya [Fri, 23 Sep 2022 22:09:08 +0000 (15:09 -0700)]
[lldb] Skip check for conflicting filter/synth when adding a new regex.

When adding a new synthetic child provider, we check for an existing
conflicting filter in the same category (and vice versa). This is done
by trying to match the new type name against registered formatters.

However, the new type name we're registered can also be a regex
(`type synth add -x`), and in this case the conflict check is just
wrong: it will try to match the new regex as if it was a type name,
against previously registered regexes.

See https://github.com/llvm/llvm-project/issues/57947 for a longer
explanation with concrete examples of incorrect behavior.

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

21 months ago[DAG] Extract helper for (neg x) [nfc]
Philip Reames [Thu, 6 Oct 2022 20:10:58 +0000 (13:10 -0700)]
[DAG] Extract helper for (neg x) [nfc]

This is a frequently reoccurring pattern, let's factor it out.

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

21 months ago[OpenMP][DeviceRTL] Fix build issue
Shilei Tian [Thu, 6 Oct 2022 20:21:51 +0000 (16:21 -0400)]
[OpenMP][DeviceRTL] Fix build issue

21 months agoThread safety analysis: Support copy-elided production of scoped capabilities through...
Aaron Puchert [Wed, 13 Jul 2022 23:47:52 +0000 (01:47 +0200)]
Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls

When support for copy elision was initially added in e97654b2f2807, it
was taking attributes from a constructor call, although that constructor
call is actually not involved. It seems more natural to use attributes
on the function returning the scoped capability, which is where it's
actually coming from. This would also support a number of interesting
use cases, like producing different scope kinds without the need for tag
types, or producing scopes from a private mutex.

Changing the behavior was surprisingly difficult: we were not handling
CXXConstructorExpr calls like regular calls but instead handled them
through the DeclStmt they're contained in. This was based on the
assumption that constructors are basically only called in variable
declarations (not true because of temporaries), and that variable
declarations necessitate constructors (not true with C++17 anymore).

Untangling this required separating construction from assigning a
variable name. When a call produces an object, we use a placeholder
til::LiteralPtr for `this`, and we collect the call expression and
placeholder in a map. Later when going through a DeclStmt, we look up
the call expression and set the placeholder to the new VarDecl.

The change has a couple of nice side effects:
* We don't miss constructor calls not contained in DeclStmts anymore,
  allowing patterns like
    MutexLock{&mu}, requiresMutex();
  The scoped lock temporary will be destructed at the end of the full
  statement, so it protects the following call without the need for a
  scope, but with the ability to unlock in case of an exception.
* We support lifetime extension of temporaries. While unusual, one can
  now write
    const MutexLock &scope = MutexLock(&mu);
  and have it behave as expected.
* Destructors used to be handled in a weird way: since there is no
  expression in the AST for implicit destructor calls, we instead
  provided a made-up DeclRefExpr to the variable being destructed, and
  passed that instead of a CallExpr. Then later in translateAttrExpr
  there was special code that knew that destructor expressions worked a
  bit different.
* We were producing dummy DeclRefExprs in a number of places, this has
  been eliminated. We now use til::SExprs instead.

Technically this could break existing code, but the current handling
seems unexpected enough to justify this change.

Reviewed By: aaron.ballman

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

21 months agoThread safety analysis: Handle additional cast in scoped capability construction
Aaron Puchert [Thu, 14 Jul 2022 11:39:04 +0000 (13:39 +0200)]
Thread safety analysis: Handle additional cast in scoped capability construction

We might have a CK_NoOp cast and a further CK_ConstructorConversion.
As an optimization, drop some IgnoreParens calls: inside of the
CK_{Constructor,UserDefined}Conversion should be no more parentheses,
and inside the CXXBindTemporaryExpr should also be none.

Lastly, we factor out the unpacking so that we can reuse it for
MaterializeTemporaryExprs later on.

Reviewed By: aaron.ballman

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

21 months ago[OpenMP][DeviceRTL] Fix an issue that thread array might be corrupted
Shilei Tian [Thu, 6 Oct 2022 20:13:22 +0000 (16:13 -0400)]
[OpenMP][DeviceRTL] Fix an issue that thread array might be corrupted

The shared memory stack in the device runtime assumes no intervined uses.
D135037 breaks the assumption, potentially causing the shared stack corruption.
This patch moves the thread array to heap memory. Since it is already the slow
path, it doesn't matter that much anyway.

Reviewed By: jhuber6

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

21 months agoRevert "Reapply [InstCombine] Switch foldOpIntoPhi() to use InstSimplify"
Alina Sbirlea [Thu, 6 Oct 2022 20:10:41 +0000 (13:10 -0700)]
Revert "Reapply [InstCombine] Switch foldOpIntoPhi() to use InstSimplify"

This reverts commit e94619b955104841cc2a4a6febe4025ee140194e.

21 months ago[flang][NFC] Document Fortran aliasing rules
Peter Klausler [Thu, 29 Sep 2022 20:47:38 +0000 (13:47 -0700)]
[flang][NFC] Document Fortran aliasing rules

Summarize current understanding of Fortran's guarantees to a compiler
(or in other words, restrictions on programs and programmers)
about aliasing.

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

21 months ago[flang] Clarify edge case of host association and generic interfaces
Peter Klausler [Tue, 4 Oct 2022 19:11:20 +0000 (12:11 -0700)]
[flang] Clarify edge case of host association and generic interfaces

Name resolution was mishandling cases of generic interfaces and specific procedures
(sometimes complicatd by use of the same name for each) when the specific procedure
was accessed by means of host association; only the scope of the generic interface
definition was searched for the specific procedure.  Also search enclosing scopes
in the usual way.

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

21 months ago[tosa] Add legalization for conv3d
TatWai Chong [Thu, 6 Oct 2022 19:50:12 +0000 (12:50 -0700)]
[tosa] Add legalization for conv3d

Update the existing implementation to match TOSA spec.

Reviewed By: rsuderman

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

21 months ago[libc] Add POSIX execv and execve functions.
Siva Chandra Reddy [Thu, 6 Oct 2022 05:24:18 +0000 (05:24 +0000)]
[libc] Add POSIX execv and execve functions.

The POSIX global variable environ has also been added.

Reviewed By: michaelrj

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

21 months ago[flang] Use assembly format for fir.dispatch
Valentin Clement [Thu, 6 Oct 2022 19:40:50 +0000 (21:40 +0200)]
[flang] Use assembly format for fir.dispatch

Remove custom parser/printer and make use of the assembly format
for the fir.dispatch operation.

Depends on D135358

Reviewed By: PeteSteinfeld, jeanPerier

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

21 months ago[Sanitizer] Fix compile errors in rtl-old/tsan_rtl.cpp
Julian Lettner [Wed, 21 Sep 2022 21:05:28 +0000 (14:05 -0700)]
[Sanitizer] Fix compile errors in rtl-old/tsan_rtl.cpp

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

21 months ago[PowerPC] Fix types for vcipher builtins.
Stefan Pintilie [Thu, 6 Oct 2022 18:34:09 +0000 (13:34 -0500)]
[PowerPC] Fix types for vcipher builtins.

The documentation specifies that the parameters for the vcipher builtins are
```
vector unsigned char
```
The code used
```
vector unsigned long long
```

This patch fixes the types for the vcipher builtins.

Reviewed By: amyk

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

21 months ago[NFCI] Simplify TypeCategoryImpl for-each callbacks.
Jorge Gorbe Moya [Fri, 16 Sep 2022 22:58:19 +0000 (15:58 -0700)]
[NFCI] Simplify TypeCategoryImpl for-each callbacks.

The callback system to iterate over every formatter of a given kind in
a TypeCategoryImpl is only used in one place (the implementation of
`type {formatter_kind} list`), and it's too convoluted for the sake of
unused flexibility.

This change changes it so that only one callback is passed to `ForEach`
(instead of a callback for exact matches and another one for regex
matches), and moves the iteration logic to `TieredFormatterContainer`
to avoid duplication.

If in the future we need different logic in the callback depending on
exact/regex match, the callback can get the type of formatter matching
used from the TypeMatcher argument anyway.

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

21 months ago[SLP]Improve/fix CSE analysis of the blocks/instructions.
Alexey Bataev [Wed, 5 Oct 2022 15:43:39 +0000 (08:43 -0700)]
[SLP]Improve/fix CSE analysis of the blocks/instructions.

Added analysis for invariant extractelement instructions and improved
detection of the CSE blocks for generated extractelement instructions.

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

21 months ago[Sanitizers][Darwin] Fix invalid gap found by FindAvailableMemoryRange
Mariusz Borsa [Tue, 20 Sep 2022 22:23:58 +0000 (15:23 -0700)]
[Sanitizers][Darwin] Fix invalid gap found by FindAvailableMemoryRange

An application running with ASAN can fail during shadow memory allocation, with an error
indicating a failure to map shadow memory region due to negative size parameter passed to mmap.

It turns out that the mach_vm_region_recurse() call can return an address of a module
which is beyond the range of the VM address space available to the iOS process,
i.e. greater than the value returned by GetMaxVirtualAddress(). It leads the FindAvailableMemoryRange function
to the an incorrect conclusion that it has found a suitable gap where the shadow memory can fit in,
 while the shadow memory cannot be really allocated in this case.

The fix just takes the maximum VM address into account, causing the function to return 0,
meaning that the VM gap to fit the requested size could not be found.

rdar://66530705

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

21 months ago[lldb] Fix hard-coded argument to set_target_properties
Jonas Devlieghere [Thu, 6 Oct 2022 18:01:49 +0000 (11:01 -0700)]
[lldb] Fix hard-coded argument to set_target_properties

The call to `set_target_properties` should use the target passed to
`add_lldb_library` instead of a hard-coded value. Upstream `liblldb` is
the only target for which this matters, but downstream we have
LLDBRPC.framework which needs this as well.

21 months ago[GlobalISel] Add a m_SpecificReg matcher
Jessica Paquette [Thu, 6 Oct 2022 17:30:10 +0000 (10:30 -0700)]
[GlobalISel] Add a m_SpecificReg matcher

Similar to the specific matchers for constants.

The intention here is to make it easier to write combines which check if a
specific register is used more than once.

e.g. matching patterns like:

```
(X + Y) == Y
```

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