platform/upstream/llvm.git
2 years ago[AArch64] Alter mull shuffle(ext(..)) combine to work on buildvectors
David Green [Mon, 21 Feb 2022 15:44:30 +0000 (15:44 +0000)]
[AArch64] Alter mull shuffle(ext(..)) combine to work on buildvectors

We have a combine for converting mul(dup(ext(..)), ...) into
mul(ext(dup(..)), ..), for allowing more uses of smull and umull
instructions. Currently it looks for vector insert and shuffle vectors
to detect the element that we can convert to a vector extend. Not all
cases will have a shufflevector/insert element though.

This started by extending the recognition to buildvectors (with elements
that may be individually extended). The new method seems to cover all
the cases that the old method captured though, as the shuffle will
eventually be lowered to buildvectors, so the old method has been
removed to keep the code a little simpler. The new code detects legal
build_vector(ext(a), ext(b), ..), converting them to ext(build_vector(a,
b, ..)) providing all the extends/types match up.

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

2 years agoMIR: Start diagnosing too many operands on an instruction
Matt Arsenault [Fri, 18 Feb 2022 21:22:20 +0000 (16:22 -0500)]
MIR: Start diagnosing too many operands on an instruction

Previously this would just assert which was annoying and didn't point
to the specific instruction/operand.

2 years ago[InstSimplify] add tests for funnel shift with redundant shift; NFC
Sanjay Patel [Mon, 21 Feb 2022 14:26:07 +0000 (09:26 -0500)]
[InstSimplify] add tests for funnel shift with redundant shift; NFC

2 years ago[AArch64][RISCV][x86] add tests for funnel shift with shift logic; NFC
Sanjay Patel [Mon, 21 Feb 2022 14:07:59 +0000 (09:07 -0500)]
[AArch64][RISCV][x86] add tests for funnel shift with shift logic; NFC

2 years agoFix llvm-objcopy shared lib build
Sven van Haastregt [Mon, 21 Feb 2022 13:55:29 +0000 (13:55 +0000)]
Fix llvm-objcopy shared lib build

Fix after ddf528b7a092 ("[llvm-objcopy][COFF] Fix section name
encoding", 2022-02-21) caused "undefined reference to
`llvm::COFF::encodeSectionName" failures.

2 years ago[X86] use-cr-result-of-dom-icmp-st.ll - add checks without -cgp-icmp-eq2icmp-st flag
Simon Pilgrim [Mon, 21 Feb 2022 13:44:36 +0000 (13:44 +0000)]
[X86] use-cr-result-of-dom-icmp-st.ll - add checks without -cgp-icmp-eq2icmp-st flag

2 years ago[Clang][Sema] Check unexpected else statement in cond-update-stmt
Shilei Tian [Mon, 21 Feb 2022 13:20:26 +0000 (08:20 -0500)]
[Clang][Sema] Check unexpected else statement in cond-update-stmt

In 'cond-update-stmt', `else` statement is not expected. This patch adds
the check in Sema.

Reviewed By: ABataev

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

2 years ago[SCEV][NFC] Replace contains+insert check with insert.second
Max Kazantsev [Mon, 21 Feb 2022 13:10:42 +0000 (20:10 +0700)]
[SCEV][NFC] Replace contains+insert check with insert.second

2 years ago[DAG] visitBSWAP - pull out repeated SDLoc. NFC
Simon Pilgrim [Mon, 21 Feb 2022 13:07:51 +0000 (13:07 +0000)]
[DAG] visitBSWAP - pull out repeated SDLoc. NFC

Cleanup for D120192

2 years ago[NFC][RISCV] Fix path checking issue if default sysroot is given
Kito Cheng [Mon, 21 Feb 2022 12:43:40 +0000 (20:43 +0800)]
[NFC][RISCV] Fix path checking issue if default sysroot is given

2 years ago[clangd] Treat 'auto' params as deduced if there's a single instantiation.
Sam McCall [Fri, 11 Feb 2022 11:09:57 +0000 (12:09 +0100)]
[clangd] Treat 'auto' params as deduced if there's a single instantiation.

This makes hover/go-to-definition/expand-auto etc work for auto params in many
common cases.
This includes when a generic lambda is passed to a function accepting
std::function. (The tests don't use this case, it requires a lot of setup).

Note that this doesn't affect the AST of the function body itself, cause its
nodes not to be dependent, improve code completion etc.
(These sort of improvements seem possible, in a similar "if there's a single
instantiation, traverse it instead of the primary template" way).

Fixes https://github.com/clangd/clangd/issues/493
Fixes https://github.com/clangd/clangd/issues/1015

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

2 years agoissue-subscriber: Fix handling of labels with spaces
Tom Stellard [Mon, 21 Feb 2022 12:02:55 +0000 (04:02 -0800)]
issue-subscriber: Fix handling of labels with spaces

Fixes #53288

Reviewed By: mehdi_amini, asl, Quuxplusone

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

2 years ago[mlir] Annotate methods on a correct class in PybindAdaptors.h
Alex Zinenko [Wed, 19 Jan 2022 12:43:24 +0000 (13:43 +0100)]
[mlir] Annotate methods on a correct class in PybindAdaptors.h

The `.def` and `.def_property_readonly` functions in PybindAdaptors.h should
construct the functions as method of the current class rather than as method of
pybind11:none(), which is an object and not even a class.

Depends On D117658

Reviewed By: gysit

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

2 years ago[gn build] Port 85f4023e731c
LLVM GN Syncbot [Mon, 21 Feb 2022 11:51:36 +0000 (11:51 +0000)]
[gn build] Port 85f4023e731c

2 years ago[llvm-objcopy][COFF] Fix section name encoding
Nicolas Miller [Sat, 19 Feb 2022 18:28:38 +0000 (20:28 +0200)]
[llvm-objcopy][COFF] Fix section name encoding

The section name encoding for `llvm-objcopy` had two main issues, the
first is that the size used for the `snprintf` in the original code is
incorrect because `snprintf` adds a null byte, so this code was only
able to encode offsets of 6 digits - `/`, `\0` and 6 digits of the
offset - rather than the 7 digits it should support.

And the second part is that it didn't support the base64 encoding for
offsets larger than 7 digits.

This issue specifically showed up when using the `clang-offload-bundler`
with a binary containing a lot of symbols/sections, since it uses
`llvm-objcopy` to add the sections containing the offload code.

Reviewed By: jhenderson

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

2 years ago[COFF] Move section name encoding into BinaryFormat
Nicolas Miller [Sat, 19 Feb 2022 18:29:08 +0000 (20:29 +0200)]
[COFF] Move section name encoding into BinaryFormat

Large COFF section names are moved into the string table and the
section header field is the offset into the string table encoded in
ASCII for offset smaller than 7 digits and in base64 for larger
offsets.

The operation of taking the string table offsets is done in a few
places in the codebase, so it is helpful to move this operation into
`BinaryFormat` so that it can be shared everywhere it's done.

So this patch takes the implementation of this operation from
`llvm/lib/MC/WinCOFFObjectWriter.cpp` and moves it into `BinaryFormat`.

Reviewed By: jhenderson, rnk

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

2 years ago[Test] Move test for PR53969 to LoopDeletion folder where it truly belongs
Max Kazantsev [Mon, 21 Feb 2022 11:39:04 +0000 (18:39 +0700)]
[Test] Move test for PR53969 to LoopDeletion folder where it truly belongs

2 years ago[OpenCL] opencl-c.h: remove arg names from atomics; NFC
Sven van Haastregt [Mon, 21 Feb 2022 11:29:10 +0000 (11:29 +0000)]
[OpenCL] opencl-c.h: remove arg names from atomics; NFC

This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" the identifiers "success",
"failure", "desired", "value".

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

2 years agoRevert "[AArch64][GlobalISel] Optimize conjunctions of compares to conditional compares."
Florian Hahn [Mon, 21 Feb 2022 10:52:09 +0000 (10:52 +0000)]
Revert "[AArch64][GlobalISel] Optimize conjunctions of compares to conditional compares."

This reverts commit 2a46450849de6904fc64f9a65303b20ca7fc9dbd.

This triggers the following assertion in an internal project:

    Assertion failed: (VRegInfo[Reg.id()].first.is<const TargetRegisterClass
    *>() && "Register class not set, wrong accessor"), function getRegClass,
    file MachineRegisterInfo.h, line 646.

I'll work with the author directly to get a reproducer.

2 years ago[AMDGPU] SILoadStoreOptimizer: avoid unbounded register pressure increases
Jay Foad [Fri, 28 Jan 2022 13:49:12 +0000 (13:49 +0000)]
[AMDGPU] SILoadStoreOptimizer: avoid unbounded register pressure increases

Previously when combining two loads this pass would sink the
first one down to the second one, putting the combined load
where the second one was. It would also sink any intervening
instructions which depended on the first load down to just
after the combined load.

For example, if we started with this sequence of
instructions (code flowing from left to right):

  X A B C D E F Y

After combining loads X and Y into XY we might end up with:

  A B C D E F XY

But if B D and F depended on X, we would get:

  A C E XY B D F

Now if the original code had some short disjoint live ranges
from A to B, C to D and E to F, in the transformed code
these live ranges will be long and overlapping. In this way
a single merge of two loads could cause an unbounded
increase in register pressure.

To fix this, change the way the way that loads are moved in
order to merge them so that:
- The second load is moved up to the first one. (But when
  merging stores, we still move the first store down to the
  second one.)
- Intervening instructions are never moved.
- Instead, if we find an intervening instruction that would
  need to be moved, give up on the merge. But this case
  should now be pretty rare because normal stores have no
  outputs, and normal loads only have address register
  inputs, but these will be identical for any pair of loads
  that we try to merge.

As well as fixing the unbounded register pressure increase
problem, moving loads up and stores down seems like it
should usually be a win for memory latency reasons.

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

2 years ago[Test] Add failing test for PR53969
Max Kazantsev [Mon, 21 Feb 2022 10:48:08 +0000 (17:48 +0700)]
[Test] Add failing test for PR53969

2 years agoIncrease the limit on parser diagnostics
Benjamin Kramer [Mon, 21 Feb 2022 10:43:40 +0000 (11:43 +0100)]
Increase the limit on parser diagnostics

We're really close to the limit
$ grep -c DIAG tools/clang/include/clang/Basic/DiagnosticParseKinds.inc
598

2 years ago[StableHashing] Hash vregs with multiple defs
Jay Foad [Fri, 18 Feb 2022 11:55:09 +0000 (11:55 +0000)]
[StableHashing] Hash vregs with multiple defs

This allows stableHashValue to be used on Machine IR that is
not in SSA form.

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

2 years ago[DebugInfo][test] XFAIL DebugInfo/Generic/no-empty-child-vars.ll on SPARC
Rainer Orth [Mon, 21 Feb 2022 10:23:15 +0000 (11:23 +0100)]
[DebugInfo][test] XFAIL DebugInfo/Generic/no-empty-child-vars.ll on SPARC

`DebugInfo/Generic/no-empty-child-vars.ll` `FAIL`s on SPARC.  As discussed
in D95617 <https://reviews.llvm.org/D95617>, this is yet another instance
of Issue #46473.

As was done for other failures due to this bug, this patch `XFAIL`s the test.

Tested on `sparcv9-sun-solaris2.11`.

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

2 years ago[RISCV] Add tests for SHFLI and UNSHFLI aliases in Zbp extension
Lian Wang [Mon, 21 Feb 2022 09:58:55 +0000 (09:58 +0000)]
[RISCV] Add tests for SHFLI and UNSHFLI aliases in Zbp extension

Supplement tests alias of SHFLI and UNSHFLI instructions.

RV32: zip8/zip4/zip2/unzip8/unzip4/unzip2

RV64: zip8.w/zip4.w/zip2.w/zip.w/zip8/zip4/zip2/zip/
      unzip8.w/unzip4.w/unzip2.w/unzip.w/unzip8/unzip4/unzip2/unzip

Reviewed By: craig.topper

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

2 years ago[VE] v512i1 mask arithmetic isel
Simon Moll [Mon, 21 Feb 2022 09:37:47 +0000 (10:37 +0100)]
[VE] v512i1 mask arithmetic isel

Packed vector and mask registers (v512) are composed of two v256
subregisters that occupy the even and odd element positions.  We add
packing support SDNodes (vec_unpack_lo|hi and vec_pack) and splitting of
v512i1 mask arithmetic ops with those.

Reviewed By: kaz7

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

2 years ago[C++20][Modules][1/8] Track valid import state.
Iain Sandoe [Thu, 11 Feb 2021 00:15:56 +0000 (00:15 +0000)]
[C++20][Modules][1/8] Track valid import state.

In C++20 modules imports must be together and at the start of the module.
Rather than growing more ad-hoc flags to test state, this keeps track of the
phase of of a valid module TU (first decl, global module frag, module,
private module frag).  If the phasing is broken (with some diagnostic) the
pattern does not conform to a valid C++20 module, and we set the state
accordingly.

We can thus issue diagnostics when imports appear in the wrong places and
decouple the C++20 modules state from other module variants (modules-ts and
clang modules).  Additionally, we attempt to diagnose wrong imports before
trying to find the module where possible (the latter will generally emit an
unhelpful diagnostic about the module not being available).

Although this generally simplifies the handling of C++20 module import
diagnostics, the motivation was that, in particular, it allows detecting
invalid imports like:

import module A;

int some_decl();

import module B;

where being in a module purview is insufficient to identify them.

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

2 years ago[ELF] Replace uncompressed InputSectionBase::data() with rawData. NFC
Fangrui Song [Mon, 21 Feb 2022 08:39:26 +0000 (00:39 -0800)]
[ELF] Replace uncompressed InputSectionBase::data() with rawData. NFC

In many call sites we know uncompression cannot happen (non-SHF_ALLOC, or the
data (even if compressed) must have been uncompressed by a previous pass).
Prefer rawData in these cases. data() increases code size and prevents
optimization on rawData.

2 years ago[mlir][linalg][bufferize][NFC] Move interface impl to Linalg Transforms
Matthias Springer [Mon, 21 Feb 2022 08:13:13 +0000 (17:13 +0900)]
[mlir][linalg][bufferize][NFC] Move interface impl to Linalg Transforms

This is for consistency with other dialects.

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

2 years ago[MLIR][LINALG] Add canonicalization pattern in `linalg.generic` op for static shape...
Prateek Gupta [Thu, 3 Feb 2022 15:55:30 +0000 (15:55 +0000)]
[MLIR][LINALG] Add canonicalization pattern in `linalg.generic` op for static shape inference.

This commit adds canonicalization pattern in `linalg.generic` op
for static shape inference. If any of the inputs or outputs have
static shape or is casted from a tensor of static shape, then
shapes of all the inputs and outputs can be inferred by using the
affine map of the static shape input/output.

Signed-Off-By: Prateek Gupta <prateek@nod-labs.com>
Reviewed By: mravishankar

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

2 years ago[mlir][OpenMP] Added assemblyFormat for SectionsOp
Shraiysh Vaishay [Mon, 21 Feb 2022 07:20:58 +0000 (12:50 +0530)]
[mlir][OpenMP] Added assemblyFormat for SectionsOp

This patch adds assemblyFormat for omp.sections operation.

Some existing functions have been altered to fit the custom directive
in assemblyFormat. This has led to their callsites to get modified too,
but those will be removed in later patches, when other operations get
their assemblyFormat. All operations were not changed in one patch for
ease of review.

Reviewed By: Mogball

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

2 years ago[RISCV] Fix the include search path order between sysroot and resource folder (Recomm...
Kito Cheng [Mon, 21 Feb 2022 06:06:19 +0000 (14:06 +0800)]
[RISCV] Fix the include search path order between sysroot and resource folder (Recommit again)

Resource folder[1] should include before sysroot[2] in general (Linux clang
toolchain, BareMetal clang toolchain, and GCC using that order), and that
prevent sysroot's header file override resource folder's one, this change is
reference from BareMetal::AddClangSystemIncludeArgs@BareMetal.cpp[3].

And also fix the behavior of `-nobuiltininc`.

[1] Include path from resource folder is something like this: `<toolchain-path>/lib/clang/13.0.0/include/`
[2] Include path from sysroot is something like this: `<toolchain-path>/riscv32-unknown-elf/include`
[3] https://github.com/llvm/llvm-project/blob/llvmorg-13.0.1/clang/lib/Driver/ToolChains/BareMetal.cpp#L193

Reviewed By: asb

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

The recommit fixes the Windows build failure due to path issue.

2 years agoRevert "[RISCV] Fix the include search path order between sysroot and resource folder...
Kito Cheng [Mon, 21 Feb 2022 06:56:50 +0000 (14:56 +0800)]
Revert "[RISCV] Fix the include search path order between sysroot and resource folder (Recommit)"

This reverts commit 47b1fa5fc48821eefefd157ed4af2f2cf3bacef4.

2 years ago[ARM] Remove unused lowerABS function. NFC
Craig Topper [Mon, 21 Feb 2022 06:35:30 +0000 (22:35 -0800)]
[ARM] Remove unused lowerABS function. NFC

This function was added in D49837, but no setOperationAction call
was added with it. The code is equivalent to what is done by the
default ExpandIntRes_ABS implementation when ADDCARRY is supported.
Test case added to verify this. There was some existing coverage
from Thumb2 MVE tests, but they started from vectors.

2 years ago[RISCV] Fix the include search path order between sysroot and resource folder (Recommit)
Kito Cheng [Mon, 21 Feb 2022 06:06:19 +0000 (14:06 +0800)]
[RISCV] Fix the include search path order between sysroot and resource folder (Recommit)

Resource folder[1] should include before sysroot[2] in general (Linux clang
toolchain, BareMetal clang toolchain, and GCC using that order), and that
prevent sysroot's header file override resource folder's one, this change is
reference from BareMetal::AddClangSystemIncludeArgs@BareMetal.cpp[3].

And also fix the behavior of `-nobuiltininc`.

[1] Include path from resource folder is something like this: `<toolchain-path>/lib/clang/13.0.0/include/`
[2] Include path from sysroot is something like this: `<toolchain-path>/riscv32-unknown-elf/include`
[3] https://github.com/llvm/llvm-project/blob/llvmorg-13.0.1/clang/lib/Driver/ToolChains/BareMetal.cpp#L193

Reviewed By: asb

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

The recommit fixes the Windows build failure due to path issue.

2 years agoRevert "[RISCV] Fix the include search path order between sysroot and resource folder"
Kito Cheng [Mon, 21 Feb 2022 06:25:49 +0000 (14:25 +0800)]
Revert "[RISCV] Fix the include search path order between sysroot and resource folder"

This reverts commit 079d13668bf1b7f929f1897af90f64caae41c81d.

2 years ago[RISCV] Fix the include search path order between sysroot and resource folder
Kito Cheng [Mon, 21 Feb 2022 06:06:19 +0000 (14:06 +0800)]
[RISCV] Fix the include search path order between sysroot and resource folder

Resource folder[1] should include before sysroot[2] in general (Linux clang
toolchain, BareMetal clang toolchain, and GCC using that order), and that
prevent sysroot's header file override resource folder's one, this change is
reference from BareMetal::AddClangSystemIncludeArgs@BareMetal.cpp[3].

And also fix the behavior of `-nobuiltininc`.

[1] Include path from resource folder is something like this: `<toolchain-path>/lib/clang/13.0.0/include/`
[2] Include path from sysroot is something like this: `<toolchain-path>/riscv32-unknown-elf/include`
[3] https://github.com/llvm/llvm-project/blob/llvmorg-13.0.1/clang/lib/Driver/ToolChains/BareMetal.cpp#L193

Reviewed By: asb

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

2 years ago[SelectionDAG][RISCV][ARM][PowerPC][X86][WebAssembly] Change default abs expansion...
Craig Topper [Mon, 21 Feb 2022 05:11:21 +0000 (21:11 -0800)]
[SelectionDAG][RISCV][ARM][PowerPC][X86][WebAssembly] Change default abs expansion to use sra (X, size(X)-1); sub (xor (X, Y), Y).

Previous we used sra (X, size(X)-1); xor (add (X, Y), Y).

By placing sub at the end, we allow RISCV to combine sign_extend_inreg
with it to form subw.

Some X86 tests for Z - abs(X) seem to have improved as well.

Other targets look to be a wash.

I had to modify ARM's abs matching code to match from sub instead of
xor. Maybe instead ISD::ABS should be made legal. I'll try that in
parallel to this patch.

This is an alternative to D119099 which was focused on RISCV only.

Reviewed By: RKSimon

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

2 years ago[STATEPOINT] Mark LR is early-clobber implicit def.
Serguei Katkov [Fri, 18 Feb 2022 11:10:14 +0000 (18:10 +0700)]
[STATEPOINT] Mark LR is early-clobber implicit def.

LR is modified at the moment of the call and before any use is read.

Reviewers: reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D120114

2 years agoReland [XCOFF][llvm-objdump] change the priority of symbols with the same address...
esmeyi [Mon, 21 Feb 2022 02:51:10 +0000 (21:51 -0500)]
Reland [XCOFF][llvm-objdump] change the priority of symbols with the same address by symbol types.

Fix the Buildbot failure #19373.

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

2 years ago[ISEL] remove unnecessary getNode(); NFC
Chen Zheng [Thu, 17 Feb 2022 13:57:53 +0000 (08:57 -0500)]
[ISEL] remove unnecessary getNode(); NFC

Reviewed By: RKSimon, craig.topper

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

2 years ago[RISCV][NFC] Add sched for some instructions in Zb extension
Lian Wang [Mon, 21 Feb 2022 01:58:08 +0000 (09:58 +0800)]
[RISCV][NFC] Add sched for some instructions in Zb extension

Add sched to brev8, zip and unzip instruction.

Reviewed By: craig.topper

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

2 years ago[SDAG] enable binop identity constant folds for sub
Luo, Yuanke [Fri, 18 Feb 2022 13:04:08 +0000 (21:04 +0800)]
[SDAG] enable binop identity constant folds for sub

This patch extract the sub folding from D119654 and leave only add
folding in that patch.

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

2 years ago[BOLT] Added fuzzer target (llvm-bolt-fuzzer)
Amir Ayupov [Mon, 21 Feb 2022 01:23:40 +0000 (17:23 -0800)]
[BOLT] Added fuzzer target (llvm-bolt-fuzzer)

This adds a target that would consume random binary as an
input ELF file.
TBD: add structured input support (ELF).

Build:
```
cmake /path/to/llvm-project/llvm -GNinja \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=1 \
-DCMAKE_C_COMPILER=<sanitizer-capable clang> \
-DCMAKE_CXX_COMPILER=<sanitizer-capable clang++> \
-DLLVM_ENABLE_PROJECTS="bolt"  \
-DLLVM_USE_SANITIZER=Address \
-DLLVM_USE_SANITIZE_COVERAGE=On
ninja llvm-bolt-fuzzer
```

Test Plan: ninja llvm-bolt-fuzzer

Reviewed By: maksfb

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

2 years ago[BOLT][NFC] Fix data race in ShrinkWrapping stats
Amir Ayupov [Sun, 20 Feb 2022 22:44:09 +0000 (14:44 -0800)]
[BOLT][NFC] Fix data race in ShrinkWrapping stats

Fix data race reported by ThreadSanitizer in clang.test:
```
ThreadSanitizer: data race /data/llvm-project/bolt/lib/Passes/ShrinkWrapping.cpp:1359:28
in llvm::bolt::ShrinkWrapping::moveSaveRestores()
```

The issue is with incrementing global counters from multiple threads.

Reviewed By: yota9

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

2 years ago[clang-format][NFC] Fix typos and inconsistencies
Krystian Kuzniarek [Mon, 21 Feb 2022 01:16:06 +0000 (17:16 -0800)]
[clang-format][NFC] Fix typos and inconsistencies

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

2 years agoDebugInfo: Add an assert about cross-unit references in dwo units
David Blaikie [Sun, 20 Feb 2022 22:52:33 +0000 (14:52 -0800)]
DebugInfo: Add an assert about cross-unit references in dwo units

This is helping me debug some issues with simplified template names

2 years ago[clang-tidy] Provide fine control of color in run-clang-tidy
Kesavan Yogeswaran [Sun, 20 Feb 2022 22:00:23 +0000 (22:00 +0000)]
[clang-tidy] Provide fine control of color in run-clang-tidy

D90110 modified the behavior of `run-clang-tidy` to always pass the
`--use-color` option to clang-tidy, which enabled colored diagnostics
output regardless of TTY status or .clang-tidy settings. This left the
user with no option to disable the colored output.

This presents an issue when trying to parse the output of run-clang-tidy
programmaticall, as the output is polluted with ANSI escape characters.

This PR fixes this issue in two ways:
1. It restores the default behavior of `run-clang-tidy` to let
   `clang-tidy` decide whether to color output. This allows the user to
   configure color via the `UseColor` option in a .clang-tidy file.
2. It adds mutually exclusive, optional `-use-color` and `-no-use-color`
   argument flags that let the user explicitly set the color option via
   the invocation.

After this change the default behavior of `run-clang-tidy` when no
.clang-tidy file is available is now to show no color, presumably
because `clang-tidy` detects that the output is being piped and defaults
to not showing colored output. This seems like an acceptable tradeoff
to respect .clang-tidy configurations, as users can still use the
`-use-color` option to explicitly enable color.

Fixes #49441 (50097 in Bugzilla)

Reviewed By: njames93

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

2 years ago[clang-format][docs] Fix incorrect 'clang-format 13' configuration ...
Krystian Kuzniarek [Sun, 20 Feb 2022 20:07:53 +0000 (21:07 +0100)]
[clang-format][docs] Fix incorrect 'clang-format 13' configuration ...

...options markers

Note: Option 'IndentRequiresClause' was previously known as
'IndentRequires' but the version marker should still indicate
'clang-format 15' as this option most recent name wasn't accessible
earlier and it would produce:
error: unknown key 'IndentRequiresClause'

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

2 years ago[clang-format][NFC] Return early in ContinuationIndenter::mustBreak
Björn Schäpers [Sun, 2 Jan 2022 20:42:08 +0000 (21:42 +0100)]
[clang-format][NFC] Return early in ContinuationIndenter::mustBreak

We can return as early as possible and only calculate IsComparison if we
really need to. Also cache getPrecedence() instead of querying it at
most 4 times.

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

2 years ago[clang-format] Fixed handling of requires clauses followed by attributes
Björn Schäpers [Tue, 15 Feb 2022 21:59:23 +0000 (22:59 +0100)]
[clang-format] Fixed handling of requires clauses followed by attributes

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

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

2 years agoRevert "[clang-format] Avoid inserting space after C++ casts."
Marek Kurdej [Sun, 20 Feb 2022 21:18:16 +0000 (22:18 +0100)]
Revert "[clang-format] Avoid inserting space after C++ casts."

This reverts commit e021987273bece6e94bc6f43b6b5232de10637c8.

This commit provokes failures in formatting tests of polly.
Cf. https://lab.llvm.org/buildbot/#/builders/205/builds/3320.

That's probably because of `)` being annotated as `CastRParen` instead of `Unknown` before, hence being kept on the same line with the next token.

2 years ago[clang-format] Avoid inserting space after C++ casts.
Marek Kurdej [Fri, 18 Feb 2022 17:24:14 +0000 (18:24 +0100)]
[clang-format] Avoid inserting space after C++ casts.

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

This is a solution for standard C++ casts: const_cast, dynamic_cast, reinterpret_cast, static_cast.

A general approach handling all possible casts is not possible without semantic information.
Consider the code:
```
static_cast<T>(*function_pointer_variable)(arguments);
```
vs.
```
some_return_type<T> (*function_pointer_variable)(parameters);
// Later used as:
function_pointer_variable = &some_function;
return function_pointer_variable(args);
```
In the latter case, it's not a cast but a variable declaration of a pointer to function.
Without knowing what `some_return_type<T>` is (and clang-format does not know it), it's hard to distinguish between the two cases. Theoretically, one could check whether "parameters" are types (not a cast) and "arguments" are value/expressions (a cast), but that might be inefficient (needs lots of lookahead).

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years agoFix extraneous whitespace addition in line comments on clang-format directives
Luis Penagos [Sun, 20 Feb 2022 20:35:47 +0000 (21:35 +0100)]
Fix extraneous whitespace addition in line comments on clang-format directives

Fixes https://github.com/llvm/llvm-project/issues/53844.
I believe this regression was caused by not accounting for clang-format directives in https://reviews.llvm.org/D92257.

Reviewed By: HazardyKnusperkeks, curdeius

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

2 years ago[X86] Regenerate switch-default-only.ll
Simon Pilgrim [Sun, 20 Feb 2022 20:42:31 +0000 (20:42 +0000)]
[X86] Regenerate switch-default-only.ll

2 years ago[llvm] Add missind dep on Symbolize to Debuginfod
Yannic Bonenberger [Sun, 20 Feb 2022 20:32:38 +0000 (12:32 -0800)]
[llvm] Add missind dep on Symbolize to Debuginfod

 `llvm/Debuginfod/DIFetcher.h` imports `llvm/DebugInfo/Symbolize/DIFetcher.h`,
so there should be a dependency on Symbolize.

Reviewed By: #debug-info, dblaikie, phosek

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

2 years ago[AArch64][RISCV][x86] add tests for mul-add demanded bits; NFC
Sanjay Patel [Fri, 18 Feb 2022 22:01:37 +0000 (17:01 -0500)]
[AArch64][RISCV][x86] add tests for mul-add demanded bits; NFC

See #53829

2 years ago[docs] Update ReleaseNotes template
Alex Bradbury [Sun, 20 Feb 2022 19:42:07 +0000 (19:42 +0000)]
[docs] Update ReleaseNotes template

This change makes several updates to the ReleaseNotes template:

* Orders the backend/target updates alphabetically
* Adds RISC-V to the list
* Uses "Backend" rather than a mix of "Target" and "Backend" (I don't
  have a strong view on which term is used, but we should be
  consistent!)
* Uses * ... as the placeholder text, as this matches the format
  actually used for most updates in recent releases

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

2 years ago[libcxx][test] Update msvc_stdlib_force_include.h for C++23
Casey Carter [Sun, 20 Feb 2022 19:34:48 +0000 (11:34 -0800)]
[libcxx][test] Update msvc_stdlib_force_include.h for C++23

Make distinct `TEST_STD_VER` values for C++20 and C++23; add C++23 deprecation suppression.

Fixes #53597

2 years ago[SimplifyCFG][OpaquePtr] Check store type when merging conditional store
Arthur Eubanks [Sun, 20 Feb 2022 19:29:54 +0000 (11:29 -0800)]
[SimplifyCFG][OpaquePtr] Check store type when merging conditional store

2 years ago[X86] combineX86ShufflesRecursively - attempt to fold ISD::EXTRACT_SUBVECTOR into...
Simon Pilgrim [Sun, 20 Feb 2022 18:50:28 +0000 (18:50 +0000)]
[X86] combineX86ShufflesRecursively - attempt to fold ISD::EXTRACT_SUBVECTOR into a shuffle chain

Peek through if we're extracting a non-zero'th subvector in an attempt to fold the extract into a lane-crossing shuffle

This also exposes a failure to fold extract_subvector(movddup(x),c) -> movddup(extract_subvector(x,c))

2 years ago[docs] fix typo
Nuno Lopes [Sun, 20 Feb 2022 18:43:30 +0000 (18:43 +0000)]
[docs] fix typo

2 years ago[MLIR][Presburger] Inequality Typing in coalesce
Michel Weber [Sun, 20 Feb 2022 17:49:09 +0000 (23:19 +0530)]
[MLIR][Presburger] Inequality Typing in coalesce

This patch adds typing of inequalities to the simplex. This is a cental part of the coalesce algorithm and will be heavily used in later coalesce patches. Currently, only the three most basic types are supported with more to be introduced when they are needed.

Reviewed By: arjunp

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

2 years ago[PowerPC] Add option to disable perfect shuffle
Qiu Chaofan [Sun, 20 Feb 2022 17:39:35 +0000 (01:39 +0800)]
[PowerPC] Add option to disable perfect shuffle

Perfect shuffle was introduced into PowerPC backend years ago, and only
available in big-endian subtargets. This optimization has good effects
in simple cases, but brings serious negative impact in large programs
with many shuffle instructions sharing the same mask.

Here introduces a temporary backend hidden option to control it until we
implemented better way to fix the gap in vectorshuffle decomposition.

Reviewed By: jsji

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

2 years ago[X86] combineX86ShufflesRecursively - add TODO not to generate temporary nodes
Simon Pilgrim [Sun, 20 Feb 2022 15:59:23 +0000 (15:59 +0000)]
[X86] combineX86ShufflesRecursively - add TODO not to generate temporary nodes

Extension to PR45974, unless we actual combine the target shuffles we shouldn't be generating temporary nodes as they may interfere with the one use checks in the shuffle recursions

2 years ago[LV] Add store to test to make sure the loop is not dead.
Florian Hahn [Sun, 20 Feb 2022 15:05:20 +0000 (15:05 +0000)]
[LV] Add store to test to make sure the loop is not dead.

Add an extra store to the test, to make sure the operations in the loop
cannot be optimized away after D118051.

2 years agoPut back err_drv_negative_columns/err_drv_small_columns for flang
Benjamin Kramer [Sun, 20 Feb 2022 14:42:20 +0000 (15:42 +0100)]
Put back err_drv_negative_columns/err_drv_small_columns for flang

These are unused by Clang, but Flang references them.

2 years ago[clangd] Remove uuidof warning. Clang never emits this one.
Benjamin Kramer [Sun, 20 Feb 2022 13:44:47 +0000 (14:44 +0100)]
[clangd] Remove uuidof warning. Clang never emits this one.

2 years ago[AArch64] Extra tests for larger umull/smull generation. NFC
David Green [Sun, 20 Feb 2022 13:20:34 +0000 (13:20 +0000)]
[AArch64] Extra tests for larger umull/smull generation. NFC

2 years agoPrune unused diagnostics. NFC.
Benjamin Kramer [Sun, 20 Feb 2022 13:06:58 +0000 (14:06 +0100)]
Prune unused diagnostics. NFC.

2 years ago[docs] Frotend perf tips: mention poison vs undef and noundef attribute
Nuno Lopes [Sun, 20 Feb 2022 11:58:46 +0000 (11:58 +0000)]
[docs] Frotend perf tips: mention poison vs undef and noundef attribute

2 years ago[ArgPromotion] Regenerate test checks for dead-gep-no-promotion.ll
Valery Pykhtin [Sun, 20 Feb 2022 11:57:06 +0000 (14:57 +0300)]
[ArgPromotion] Regenerate test checks for dead-gep-no-promotion.ll
with --function-signature option (otherwise filecheck gets confused).

2 years ago[docs] Simplify the description of poison values
Nuno Lopes [Sun, 20 Feb 2022 11:41:49 +0000 (11:41 +0000)]
[docs] Simplify the description of poison values

2 years ago[docs] Add a note saying that the use of poison is preferred to the use of undef
Nuno Lopes [Sun, 20 Feb 2022 11:33:47 +0000 (11:33 +0000)]
[docs] Add a note saying that the use of poison is preferred to the use of undef
Plus fix a few wrong examples with undef

2 years agoUnionize clang::DynTypedNodeList. NFC.
Benjamin Kramer [Sun, 20 Feb 2022 11:12:39 +0000 (12:12 +0100)]
Unionize clang::DynTypedNodeList. NFC.

2 years agoRevert "[C++20][Modules][1/8] Track valid import state."
Iain Sandoe [Sun, 20 Feb 2022 10:20:48 +0000 (10:20 +0000)]
Revert "[C++20][Modules][1/8] Track valid import state."

This reverts commit 8a3f9a584ad43369cf6a034dc875ebfca76d9033.

need to investigate build failures that do not show on CI or local
testing.

2 years ago[ArgPromotion] auto-update test checks.
Valery Pykhtin [Sat, 19 Feb 2022 17:21:45 +0000 (20:21 +0300)]
[ArgPromotion] auto-update test checks.

Rename %tmp => %temp IR values to avoid update warning.

2 years ago[C++20][Modules][1/8] Track valid import state.
Iain Sandoe [Thu, 11 Feb 2021 00:15:56 +0000 (00:15 +0000)]
[C++20][Modules][1/8] Track valid import state.

In C++20 modules imports must be together and at the start of the module.
Rather than growing more ad-hoc flags to test state, this keeps track of the
phase of of a valid module TU (first decl, global module frag, module,
private module frag).  If the phasing is broken (with some diagnostic) the
pattern does not conform to a valid C++20 module, and we set the state
accordingly.

We can thus issue diagnostics when imports appear in the wrong places and
decouple the C++20 modules state from other module variants (modules-ts and
clang modules).  Additionally, we attempt to diagnose wrong imports before
trying to find the module where possible (the latter will generally emit an
unhelpful diagnostic about the module not being available).

Although this generally simplifies the handling of C++20 module import
diagnostics, the motivation was that, in particular, it allows detecting
invalid imports like:

import module A;

int some_decl();

import module B;

where being in a module purview is insufficient to identify them.

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

2 years ago[AArch64][GlobalISel] Optimize conjunctions of compares to conditional compares.
Amara Emerson [Sun, 20 Feb 2022 09:13:34 +0000 (01:13 -0800)]
[AArch64][GlobalISel] Optimize conjunctions of compares to conditional compares.

This is a partial port of the same optimization from AArch64ISelLowering,
although the original handles more cases when generating regular compares
instead of this one which just does it when selecting G_SELECTs.

For more detailed comments see the original comments for
emitConditionalComparison() in AArch64ISelLowering.

Gives minor code size improvements.

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

2 years ago[AArch64][GlobalISel] Implement combines for boolean G_SELECT->bitwise ops.
Amara Emerson [Sun, 20 Feb 2022 08:53:09 +0000 (00:53 -0800)]
[AArch64][GlobalISel] Implement combines for boolean G_SELECT->bitwise ops.

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

2 years ago[HIP] Support linking archive of bundled bitcode
Yaxun (Sam) Liu [Thu, 17 Feb 2022 15:42:15 +0000 (10:42 -0500)]
[HIP] Support linking archive of bundled bitcode

HIP programs compiled with -c -fgpu-rdc generate clang-offload-bundler
bundles which contain bitcode for different GPU's.

Such files can be archived to an archive file which can be linked with
HIP programs with -fgpu-rdc.

This patch adds suppor of linking archive of bundled bitcode.

When an archive of bundled bitcode is passed to clang by -l, for each
GPU specified through --offload-arch, clang extracts bitcode from
the archive and creates a new archive for that GPU and pass it
to lld.

Reviewed by: Artem Belevich

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

Fixes: SWDEV-321741, SWDEV-315773

2 years ago[MLIR][Presburger] Introduce MaybeOptimum type to represent computed optima
Arjun P [Sat, 19 Feb 2022 20:06:14 +0000 (20:06 +0000)]
[MLIR][Presburger] Introduce MaybeOptimum type to represent computed optima

This allows to differentiate between the cases where the optimum does not
exist due to being unbounded and due to the polytope being empty.

Reviewed By: Groverkss

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

2 years ago[VectorCombine] Remove redundant checks (NFC).
Florian Hahn [Sat, 19 Feb 2022 21:05:32 +0000 (21:05 +0000)]
[VectorCombine] Remove redundant checks (NFC).

The removed conditions are already checked by the if above.

Fixes #53761.

2 years ago[mlir][bufferize] Add a way for ops to fail the analysis
Matthias Springer [Sat, 19 Feb 2022 20:49:33 +0000 (05:49 +0900)]
[mlir][bufferize] Add a way for ops to fail the analysis

Add `BufferizableOpInterface::verifyAnalysis`. Ops can implement this method to check for expected invariants and limitations.

The purpose of this change is to introduce a modular way of checking assertions such as `assertScfForAliasingProperties`.

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

2 years ago[SelectionDAGBuilder] Simplify visitShift. NFC
Craig Topper [Sat, 19 Feb 2022 20:03:28 +0000 (12:03 -0800)]
[SelectionDAGBuilder] Simplify visitShift. NFC

This code was detecting whether the value returned by getShiftAmountTy
can represent all shift amounts. If not, it would use MVT::i32 as a
placeholder. getShiftAmountTy was updated last year to return i32
if the type returned by the target couldn't represent all values.

This means the MVT::i32 case here is dead and can the logic can
be simplified.

Reviewed By: RKSimon

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

2 years ago[X86] vector-reduce-add-mask.ll - add missing AVX512BW/BWVL check prefixes
Simon Pilgrim [Sat, 19 Feb 2022 20:19:48 +0000 (20:19 +0000)]
[X86] vector-reduce-add-mask.ll - add missing AVX512BW/BWVL check prefixes

2 years ago[lldb] Fix some accidental IntervalMap copies
Benjamin Kramer [Sat, 19 Feb 2022 19:55:20 +0000 (20:55 +0100)]
[lldb] Fix some accidental IntervalMap copies

I made that type non-copyable in some cases in dc4f9f0368cd

2 years ago[GISel] Fix dead code warning in getRuleRangeForIdentifier emitted method. NFC.
Simon Pilgrim [Sat, 19 Feb 2022 19:43:53 +0000 (19:43 +0000)]
[GISel] Fix dead code warning in getRuleRangeForIdentifier emitted method. NFC.

Break the if-else chain as every block returns, and remove the return at the end of the function as the else block means this was never hit

2 years ago[X86] combineArithReduction - pull out repeated getVectorNumElements() calls
Simon Pilgrim [Fri, 18 Feb 2022 22:04:57 +0000 (22:04 +0000)]
[X86] combineArithReduction - pull out repeated getVectorNumElements() calls

2 years ago[ADT] Just use a union in IntervalMap
Benjamin Kramer [Sat, 19 Feb 2022 19:20:52 +0000 (20:20 +0100)]
[ADT] Just use a union in IntervalMap

IntervalMap has seen type-punned arrays, AlignedCharArrayUnion and
std::aligned_union_t, with varying degrees of buggyness. Plain unions
have become quite powerful, so just try that instead.

2 years ago[X86] Extend bswap+shl tests
Simon Pilgrim [Sat, 19 Feb 2022 19:16:56 +0000 (19:16 +0000)]
[X86] Extend bswap+shl tests

Different shift amounts and multiuse tests

2 years ago[X86] Add bswap(shl()) test
Simon Pilgrim [Sat, 19 Feb 2022 17:37:07 +0000 (17:37 +0000)]
[X86] Add bswap(shl()) test

Test based off issues #51391 and #53867 - we're going to end up needing InstCombine + DAG variants of this fold as DAG can create BSWAP nodes as part of load folding

2 years ago[X86] Add some add reduction tests for values that are zero in the upper bits
Simon Pilgrim [Sat, 19 Feb 2022 15:36:17 +0000 (15:36 +0000)]
[X86] Add some add reduction tests for values that are zero in the upper bits

This is an extension of some of the tests mentioned in Issue #42019 - we might be able to use PSADBW to add+zext 4 x bytes to i64 that can then be reduced

2 years ago[AArch64] Adds SUBS and ADDS instructions to the MIPeepholeOpt.
Micah Weston [Sat, 19 Feb 2022 15:35:53 +0000 (15:35 +0000)]
[AArch64] Adds SUBS and ADDS instructions to the MIPeepholeOpt.

Implements ADDS/SUBS 24-bit immediate optimization using the
MIPeepholeOpt pass. This follows the pattern:

Optimize ([adds|subs] r, imm) -> ([ADDS|SUBS] ([ADD|SUB] r, #imm0, lsl #12), #imm1),
if imm == (imm0<<12)+imm1. and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

Optimize ([adds|subs] r, imm) -> ([SUBS|ADDS] ([SUB|ADD] r, #imm0, lsl #12), #imm1),
if imm == -(imm0<<12)-imm1, and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

The SplitAndOpcFunc type had to change the return type to an Opcode pair so that
the first add/sub is the regular instruction and the second is the flag setting
instruction. This required updating the code in the AND case.

Testing:

I ran a two stage bootstrap with this code.
Using the second stage compiler, I verified that the negation of an ADDS to SUBS
or vice versa is a valid optimization. Example V == -0x111111.

Reviewed By: dmgreen

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

2 years ago[AArch64] Common patterns between UMULL and int_aarch64_neon_umull
David Green [Sat, 19 Feb 2022 14:38:57 +0000 (14:38 +0000)]
[AArch64] Common patterns between UMULL and int_aarch64_neon_umull

We have some duplicate patterns between the AArch64ISD::UMULL (/SMULL)
and the int_aarch64_neon_umull (/smull) intrinsics. They did not
replicate all the patterns though, leaving some gaps on instructions
like umlal2 from codegen. This commons all the patterns by converting
all int_aarch64_neon_umull intrinsics to UMULL nodes and removing the
duplicate for umull/smull intrinsics, so that all instructions go
through the same tablegen pattern.

This improves some of the longer-than-legal mla patterns, helping them
replace ext with umlal2.

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

2 years agoFix Wdocumentation missing code snippet warnings
Simon Pilgrim [Sat, 19 Feb 2022 13:17:10 +0000 (13:17 +0000)]
Fix Wdocumentation missing code snippet warnings

2 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Sat, 19 Feb 2022 13:06:09 +0000 (13:06 +0000)]
Fix Wdocumentation unknown parameter warning

2 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Sat, 19 Feb 2022 13:00:59 +0000 (13:00 +0000)]
Fix Wdocumentation unknown parameter warning

2 years ago[docs] HowToCrossCompileLLVM.rst: update cmake options
fourdim [Sat, 19 Feb 2022 12:36:31 +0000 (20:36 +0800)]
[docs] HowToCrossCompileLLVM.rst: update cmake options

This patch updates the cmake options suggested when cross compiling. This should fix [#52819](https://github.com/llvm/llvm-project/issues/52819).

Brad King (Member of CMake) says:

The linked [CMAKE_CROSSCOMPILING](https://cmake.org/cmake/help/v3.22/variable/CMAKE_CROSSCOMPILING.html) documentation says:

This variable will be set to true by CMake if the `CMAKE_SYSTEM_NAME` variable has been set manually (i.e. in a toolchain file or as a cache entry from the cmake command line).

It is not meant to be set by project code or toolchain files. It is always set automatically. Don't put `set(CMAKE_CROSSCOMPILING ON)` anywhere in your code.

`CMAKE_CROSSCOMPILING` indicates only whether `CMAKE_SYSTEM_NAME` was set by the user/project/toolchain-file instead of by CMake.

In LLVM project, `CMAKE_CROSSCOMPILING` is used to determine whether to execute some tests on the host machine.

LLVM needs to use another method for that. `CMAKE_CROSSCOMPILING` is not a reliable indicator of whether produced binaries will run on the host, and does not claim so in its documentation. If one sets `CMAKE_SYSTEM_NAME` to Linux in a toolchain file, and builds on a Linux host, that doesn't mean the target architecture or minimum glibc version is the same.

Reviewed By: rengolin

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

2 years ago[CodeGen] Make ShapeT::operator== const. NFC.
Benjamin Kramer [Sat, 19 Feb 2022 12:23:27 +0000 (13:23 +0100)]
[CodeGen] Make ShapeT::operator== const. NFC.

Otherwise it becomes asymmetric in the types it accepts.