platform/upstream/llvm.git
2 years ago[WebAssembly] Update relaxed SIMD opcodes and names
Thomas Lively [Tue, 17 May 2022 00:51:45 +0000 (17:51 -0700)]
[WebAssembly] Update relaxed SIMD opcodes and names

to reflect the latest state of the proposal:
https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md#binary-format.
Moves code around to match the instruction order from the proposal, but the only
functional changes are to the names and opcodes.

Reviewed By: aheejin

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

2 years ago[nfc][lld-macho] Fixed test from https://reviews.llvm.org/D125732
Vy Nguyen [Tue, 17 May 2022 00:46:15 +0000 (20:46 -0400)]
[nfc][lld-macho] Fixed test from https://reviews.llvm.org/D125732

Details:
The test was incorrectly expecting the error messages for the export symbols to have a particular order.
It shouldn't because the export symbol list is processed concurrently.

2 years ago[lld-macho] Temporarily disable test on windows
Vy Nguyen [Tue, 17 May 2022 00:36:49 +0000 (20:36 -0400)]
[lld-macho] Temporarily disable test on windows
The metadata seems to be demangled differently

2 years ago[RISCV] Use classic dataflow for VSETVLI insertion
Philip Reames [Mon, 16 May 2022 23:43:13 +0000 (16:43 -0700)]
[RISCV] Use classic dataflow for VSETVLI insertion

Our current implementation of the InsertVSETVLI dataflow allows phase 3 to arrive at a different block end state than the data flow in phase 1/2 computed. This arises because a block which contains instructions (e.g. load or stores) which don't consume all the incoming bits of the VL/VTYPE can be compatible with multiple incoming states. The algorithm effectively changes the SEW on such instructions, and propagates the prior state forward. As phase 3 uses the block input state for this propagation, but phase 1/2 doesn't, this can result in different block end states.

If we don't correct for it, this discrepancy can result in miscompiles. This was the source of multiple recent bugs. However, by now we have fixes for all known correctness issues.

The basic strategy we use is to insert a compensation vsetvli to bring the block state leaving the block back into consistency with the one computed. This is correct, but results in extra vsetvlis being placed at the end of blocks.

This change adjusts the phase 1/2 algorithm to propagate the incoming block state through the block, allowing the compatibility rules to modify the end state. The algorithm may need to run slightly more iterations, but the end result is consistent with what phase 3 does.

The benefit of doing this is two fold.

First, we reverse some of the code quality introductions introduced in the functional fixes.

Second, we simplify the invariants, and allow the strict assertions to be enabled. Several humans, myself included, have found it quite surprising that invariant didn't hold already, and arguably that confusion is the cause of several of our recent miscompiles in this code.

The downside to this patch is that the dataflow may require additional iterations to stabilize. In the worse case, we go from O(Edges) to O(E + UniquePaths) as the incoming state (and thus the outgoing one) can now change once for each path from the entry block.

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

2 years ago[RISCV] Fix missing vsetvli in transparent block case
Philip Reames [Mon, 16 May 2022 23:40:35 +0000 (16:40 -0700)]
[RISCV] Fix missing vsetvli in transparent block case

We've got a lurking problem with our data flow implementation where different phases disagree, resulting in possible miscompiles. D119518 introduced a workaround, but failed to consider blocks which only contain load/stores compatible with their incoming state.

When I went to rebase and simplify D125232, it turned out that not all of the correctness issues had been fixed yet after all. This is the correctness fix accidentally embedded in the original more complicated version.

Note that the test changes here are mostly regressions. It's worth noting that the simplified version of D125232 exactly reverses all the non-functional diffs in the test caused here. D125232 should be the immediate following commit.

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

2 years ago[test-suite][cmake] sort unit test targets
Grace Jennings [Mon, 16 May 2022 23:50:49 +0000 (16:50 -0700)]
[test-suite][cmake] sort unit test targets

This patch sorts unit test targets into directories corresponding to the
test source file directories to improve target navigation.

Reviewed By: smeenai

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

2 years ago[dwarf] Emit a DIGlobalVariable for constant strings.
Mitch Phillips [Mon, 16 May 2022 23:03:47 +0000 (16:03 -0700)]
[dwarf] Emit a DIGlobalVariable for constant strings.

An upcoming patch will extend llvm-symbolizer to provide the source line
information for global variables. The goal is to move AddressSanitizer
off of internal debug info for symbolization onto the DWARF standard
(and doing a clean-up in the process). Currently, ASan reports the line
information for constant strings if a memory safety bug happens around
them. We want to keep this behaviour, so we need to emit debuginfo for
these variables as well.

Reviewed By: dblaikie, rnk, aprantl

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

2 years ago[lld-macho] Demangle symbol names in export-symbol error messages when -demangle...
Vy Nguyen [Mon, 16 May 2022 23:19:32 +0000 (19:19 -0400)]
[lld-macho] Demangle symbol names in export-symbol error messages when -demangle is specified.
PR/55512

Reviewed By: keith

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

2 years ago[mlir][NFC] Fix the tags for various doc code blocks
River Riddle [Mon, 16 May 2022 23:45:51 +0000 (16:45 -0700)]
[mlir][NFC] Fix the tags for various doc code blocks

2 years ago[mlir][PDLL] Tweak the grammar to highlight partial code better
River Riddle [Mon, 16 May 2022 23:37:31 +0000 (16:37 -0700)]
[mlir][PDLL] Tweak the grammar to highlight partial code better

This commit enables proper highlighting when inner statements are
outside of a constraint/pattern/etc. This shouldn't really happen in
actual code, but can happen in documentation (which uses the same
syntax grammar).

2 years ago[mlir][sparse] Restyling macros in the runtime library
wren romano [Wed, 11 May 2022 23:32:54 +0000 (16:32 -0700)]
[mlir][sparse] Restyling macros in the runtime library

In addition to reducing code repetition, this also helps ensure that the various API functions follow the naming convention of mlir::sparse_tensor::primaryTypeFunctionSuffix (e.g., due to typos in the repetitious code).

Depends On D125428

Reviewed By: aartbik

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

2 years agoTeach PeepholeOpt to eliminate redundant copy from constant physreg (e.g VLENB on...
Philip Reames [Mon, 16 May 2022 23:27:39 +0000 (16:27 -0700)]
Teach PeepholeOpt to eliminate redundant copy from constant physreg (e.g VLENB on RISCV)

The existing redundant copy elimination required a virtual register source, but the same logic works for any physreg where we don't have to worry about clobbers.  On RISCV, this helps eliminate redundant CSR reads from VLENB.

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

2 years ago[llvm-ar][NFC] Address post-commit comments on D125439.
Ben Dunbobbin [Mon, 16 May 2022 23:11:18 +0000 (00:11 +0100)]
[llvm-ar][NFC] Address post-commit comments on D125439.

Remove errant whitespace.

AIX uses big archive format so check for both !<arch> and <bigaf>.

Only the "gnu" format has thin archives; specify --format=gnu for
thin archive test-cases.

2 years ago[mlir][NFC] Fix a few langref typos
River Riddle [Mon, 16 May 2022 23:23:01 +0000 (16:23 -0700)]
[mlir][NFC] Fix a few langref typos

2 years ago[llvm-objcopy][test] Add cmp after copy
Keith Smiley [Thu, 12 May 2022 17:28:57 +0000 (10:28 -0700)]
[llvm-objcopy][test] Add cmp after copy

All of the other tests here either check that the copy fails, or that
the resulting binary is the same, it seems like this check was omitted
for the universal object case.

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

2 years ago[mlir][Tablegen-LSP] Add support for a basic TableGen language server
River Riddle [Mon, 9 May 2022 17:36:48 +0000 (10:36 -0700)]
[mlir][Tablegen-LSP] Add support for a basic TableGen language server

This follows the same general structure of the MLIR and PDLL language
servers. This commits adds the basic functionality for setting up the server,
and initially only supports providing diagnostics. Followon commits will
build out more comprehensive behavior.

Realistically this should eventually live in llvm/, but building in MLIR is an easier
initial step given that:
* All of the necessary LSP functionality is already here
* It allows for proving out useful language features (e.g. compilation databases)
  without affecting wider scale tablegen users
* MLIR has a vscode extension that can immediately take advantage of it

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

2 years ago[clang] Avoid suggesting typoed directives in `.S` files
Ken Matsui [Mon, 16 May 2022 22:36:54 +0000 (15:36 -0700)]
[clang] Avoid suggesting typoed directives in `.S` files

This patch is itended to avoid suggesting typoed directives in `.S`
files to support the cases of `#` directives treated as comments or
various pseudo-ops. The feature is implemented in
https://reviews.llvm.org/D124726.

Fixes: https://reviews.llvm.org/D124726#3516346.

Reviewed By: nickdesaulniers

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

2 years ago[mlir][sparse] Adding "final" keyword wherever appropriate
wren romano [Wed, 11 May 2022 23:10:22 +0000 (16:10 -0700)]
[mlir][sparse] Adding "final" keyword wherever appropriate

This enables the compiler to perform devirtualization.  And benchmarks
indicate devirtualization can sometimes give considerable speedup.

Depends On D122061

Reviewed By: aartbik

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

2 years ago[mlir][sparse] Enhancing sparse=>sparse conversion.
wren romano [Wed, 11 May 2022 23:05:13 +0000 (16:05 -0700)]
[mlir][sparse] Enhancing sparse=>sparse conversion.

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

Depends On D122060

Reviewed By: aartbik

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

2 years ago[mlir] Restrict dialect doc gen to a single dialect
River Riddle [Sun, 15 May 2022 23:40:18 +0000 (16:40 -0700)]
[mlir] Restrict dialect doc gen to a single dialect

In the overwhelmingly majority of cases only one dialect is generated at a time
anyways, and this restriction more easily catches user error when multiple
dialects might be generated. We hit this semi-recently with the PDL dialect,
and circt+other downstream users are also actively hitting this as well.

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

2 years ago[NFC] Don't bother with unstripped binary w/ dSYM, don't DebugSymbols twice
Jason Molenda [Mon, 16 May 2022 22:27:21 +0000 (15:27 -0700)]
[NFC] Don't bother with unstripped binary w/ dSYM, don't DebugSymbols twice

This patch addresses two perf issues when we find a dSYM on macOS
after calling into the DebugSymbols framework.  First, when we have
a local (probably stripped) binaary, we find the dSYM and we may
be told about the location of the symbol rich binary (probably
unstripped) which may be on a remote filesystem.  We don't need the
unstripped binary, use the local binary we already have.
Second, after we've found the path to the dSYM, save that in the Module
so we don't call into DebugSymbols a second time later on to
rediscover it.  If the user has a DBGShellCommands set, we need to
exec that process twice, serially, which can add up.

Differential Revision: https://reviews.llvm.org/D125616
rdar://84576917

2 years ago[OpenMP] Don't build the offloading driver without a source input
Joseph Huber [Mon, 16 May 2022 16:26:32 +0000 (12:26 -0400)]
[OpenMP] Don't build the offloading driver without a source input

The Clang driver additional stages to build a complete offloading
program for applications using CUDA or OpenMP offloading. This normally
requires either a source file input or a valid object file to be
handled. This would cause problems when trying to compile an assembly or
LLVM IR file through clang with flags that would enable offloading. This
patch simply adds a check to prevent the offloading toolchain from being
used if we don't have a valid source file.

Reviewed By: jdoerfert

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

2 years ago[Libomptarget] Don't build the device runtime without a new Clang
Joseph Huber [Mon, 16 May 2022 15:49:51 +0000 (11:49 -0400)]
[Libomptarget] Don't build the device runtime without a new Clang

The OpenMP device offloading library is a bitcode library and thus only
expect to build and linked with the same version of clang that was used
to create it. This somewhat copmlicates the building process as we
require the Clang that was just built to be used to create the library.
This is either done with a two-step build, where OpenMP is built with
the Clang that was just installed, or through the
`-DLLLVM_ENABLE_RUNTIMES=openmp` option. This has always been the case,
but recent changes have caused this to make it difficult to build the
rest of OpenMP. This patchs adds a check to not build the OpenMP device
runtime if the current compiler is not Clang with the same version as
the LLVM installation. This should allow users to build OpenMP as a
project using any compiler without it erroring out due to the bitcode
library, but if users require it they will need to use the above methods
to compile it.

Reviewed By: jdoerfert, tianshilei1992, ye-luo

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

2 years ago[mlir] allow for re-registering extension ops
Alex Zinenko [Fri, 13 May 2022 16:03:08 +0000 (18:03 +0200)]
[mlir] allow for re-registering extension ops

Op registration mechanism does not allow for ops with the same name to be
re-registered. This is okay to avoid name conflicts and debug
double-registration, but may be problematic for dialect extensions that may get
registered several times (unlike dialects that are deduplicated in the
registry). When registering ops through the Transform dialect extension
mechanism, check first if the ops are already registered and only complain in
the case of repeated registration with the same name but different TypeID.

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

2 years ago[lldb] Prevent underflow in crashlog.py
Jonas Devlieghere [Mon, 16 May 2022 21:51:27 +0000 (14:51 -0700)]
[lldb] Prevent underflow in crashlog.py

Avoid a OverflowError (an underflow really) when the pc is zero. This
can happen for "unknown frames" where the crashlog generator reports a
zero pc. We could omit them altogether, but if they're part of the
crashlog it seems fair to display them in lldb as well.

rdar://92686666

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

2 years agoRevert "[InstCombine] invert canonicalization for cast of signbit test"
Sanjay Patel [Mon, 16 May 2022 21:47:02 +0000 (17:47 -0400)]
Revert "[InstCombine] invert canonicalization for cast of signbit test"

This reverts commit 3794cc0e996481e10307b67c8436aa44e0d65d22.
This change is suspected of causing bots to hang at stage 2
compiles, so reverting to confirm and investigate.

2 years ago[MC] [Win64EH] Check for matches between epilogs and the prolog on ARM64
Martin Storsjö [Sat, 14 May 2022 22:59:14 +0000 (01:59 +0300)]
[MC] [Win64EH] Check for matches between epilogs and the prolog on ARM64

This allows sharing opcodes between prolog and epilog even when there
is more than one epilog.

I didn't make any handcrafted special MC level testcases for this (yet
at least), but it does seem to have the expected effect on two existing
CodeGen level testcases.

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

2 years ago[MC] [Win64EH] Try writing an ARM64 "packed epilog" even if the epilog doesn't share...
Martin Storsjö [Fri, 13 May 2022 07:42:56 +0000 (10:42 +0300)]
[MC] [Win64EH] Try writing an ARM64 "packed epilog" even if the epilog doesn't share opcodes with the prolog

The "packed epilog" form only implies that the epilog is located
exactly at the end of the function (so the location of the epilog
is implicit from the epilog opcodes), but it doesn't have to share
opcodes with the prolog - as long as the total number of opcode
bytes and the offset to the epilog fit within the bitfields.

This avoids writing a 4 byte epilog scope in many cases. (I haven't
measured how much this shrinks actual xdata sections in practice
though.)

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

2 years ago[ARM] Rename the isARMAreaXRegister parameter isIOS to SplitFramePushPop. NFC.
Martin Storsjö [Mon, 16 May 2022 07:51:36 +0000 (10:51 +0300)]
[ARM] Rename the isARMAreaXRegister parameter isIOS to SplitFramePushPop. NFC.

In f8b0a7af52f8c4ec6b4ddcfe3a6fa75098c9507c in 2016, this parameter
was generalized on the caller side (previously passing
STI.isTargetMachO(), now passing STI.splitFramePushPop()). Rename
the parameter on the receiver side to match the generalization.

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

2 years ago[compiler-rt builtins] Assert that atomic.c can be compiled correctly.
Eli Friedman [Mon, 16 May 2022 21:40:57 +0000 (14:40 -0700)]
[compiler-rt builtins] Assert that atomic.c can be compiled correctly.

The spinlock requires that lock-free operations are available;
otherwise, the implementation just calls itself. As discussed in
D120026.

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

2 years ago[AArch64] Use ADDV for boolean xor reductions.
Paul Walker [Sat, 14 May 2022 11:49:07 +0000 (12:49 +0100)]
[AArch64] Use ADDV for boolean xor reductions.

NEON does not have native support for xor reductions. However, when
reducing predicate vectors the operation is synonymous with an add
reduction that is supported.

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

2 years ago[InstrProf] Fix promoter when using counter relocations
Ellis Hoag [Mon, 16 May 2022 17:36:20 +0000 (10:36 -0700)]
[InstrProf] Fix promoter when using counter relocations

When using counter relocations, two instructions are emitted to compute
the address of the counter variable.

```
%BiasAdd = add i64 ptrtoint <__profc_>, <__llvm_profile_counter_bias>
%Addr = inttoptr i64 %BiasAdd to i64*
```

When promoting a counter, these instructions might not be available in
the block, so we need to copy these instructions.

This fixes https://github.com/llvm/llvm-project/issues/55125

Reviewed By: phosek

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

2 years ago[mlir][bufferize] Better propagation of errors
Matthias Springer [Mon, 16 May 2022 21:09:08 +0000 (23:09 +0200)]
[mlir][bufferize] Better propagation of errors

Return immediately when an op bufferization patterns fails.

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

2 years ago[mlir][ods] Fix verification of attribute + colon type ambiguity
Mogball [Mon, 16 May 2022 20:28:17 +0000 (20:28 +0000)]
[mlir][ods] Fix verification of attribute + colon type ambiguity

An attribute without a type builder followed by a colon in an assembly format is potentially ambiguous because the parser will read ahead to parse the colon-type and pass this as the type argument to the attribute's constructor.

However, the previous verifier that checks for this ambiguity erroneously produces an error in the case of

```
let assemblyFormat = "( `(` $attr `)` )? `:`";
```

This patch fixes the bug by implementing a checker that correctly handles all edge cases, including very strange assembly formats like:

```
let assemblyFormat = "( `(` $attr ) : (`>`)? attr-dict (`>` $a^) : (`<`)? `:`";
```

Reviewed By: rriddle

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

2 years ago[mlir] Remove the `type` keyword from type alias definitions
River Riddle [Thu, 12 May 2022 20:36:05 +0000 (13:36 -0700)]
[mlir] Remove the `type` keyword from type alias definitions

This was carry over from LLVM IR where the alias definition can
be ambiguous, but MLIR type aliases have no such problems.
Having the `type` keyword is superfluous and doesn't add anything.
This commit drops it, which also nicely aligns with the syntax for
attribute aliases (which doesn't have a keyword).

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

2 years ago[mlir][transforms] Add a topological sort utility and pass
Mogball [Mon, 16 May 2022 20:45:24 +0000 (20:45 +0000)]
[mlir][transforms] Add a topological sort utility and pass

This patch adds a topological sort utility and pass. A topological sort reorders
the operations in a block without SSA dominance such that, as much as possible,
users of values come after their producers.

The utility function sorts topologically the operation range in a given block
with an optional user-provided callback that can be used to virtually break cycles.
The toposort pass itself recursively sorts graph regions under the target op.

Reviewed By: mehdi_amini

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

2 years ago[AIX] llvm-link support big archive.
zhijian [Mon, 16 May 2022 20:29:16 +0000 (16:29 -0400)]
[AIX] llvm-link support big archive.

Summary:
Use object::Archive::create so that the returned archive object has a dynamic type of either Archive or BigArchive.

Reviewers: James Henderson,Fangrui Song
Differential Revision: https://reviews.llvm.org/D124940

2 years ago[mlir][ods] Ignore AttributeSelfTypeParameter in assembly formats
Mogball [Mon, 16 May 2022 20:21:39 +0000 (20:21 +0000)]
[mlir][ods] Ignore AttributeSelfTypeParameter in assembly formats

The attribute self type parameter is currently treated like any other attribute parameter in the assembly format. The self type parameter should be handled by the operation parser and printer and play no role in the generated parsers and printers of attributes.

Reviewed By: rriddle

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

2 years ago[mlir][sparse] introduce complex type to sparse tensor support
Aart Bik [Sat, 14 May 2022 00:54:32 +0000 (17:54 -0700)]
[mlir][sparse] introduce complex type to sparse tensor support

This is the first implementation of complex (f64 and f32) support
in the sparse compiler, with complex add/mul as first operations.
Note that various features are still TBD, such as other ops, and
reading in complex values from file. Also, note that the
std::complex<float> had a bit of an ABI issue when passed as
single argument. It is still TBD if better solutions are possible.

Reviewed By: bixia

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

2 years ago[DomPrinter] Migrate -dot-dom to the new pass manager.
Yang Keao [Mon, 16 May 2022 19:12:50 +0000 (14:12 -0500)]
[DomPrinter] Migrate -dot-dom to the new pass manager.

In D123677, @YangKeao provided an implementation of `DOTGraphTraits{Viewer,Printer}` in the new pass manager. This commit migrates the `DomPrinter` and `DomViewer` to the new pass manager.

Reviewed By: Meinersbur

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

2 years ago[SelectionDAG] Remove duplicate "is scaled" information from gather/scatter SDNodes.
Paul Walker [Fri, 8 Apr 2022 11:59:21 +0000 (12:59 +0100)]
[SelectionDAG] Remove duplicate "is scaled" information from gather/scatter SDNodes.

During early gather/scatter enablement two different approaches
were taken to represent scaled indices:

* A Scale operand whereby byte_offsets = Index * Scale
* An IndexType whereby byte_offsets = Index * sizeof(MemVT.ElementType)

Having multiple representations is bad as shown by this patch which
fixes instances where the two are out of sync. The dedicated scale
operand is more flexible and pervasive so this patch removes the
UNSCALED values from IndexType. This means all indices are scaled
but the scale can be one, hence unscaled. SDNodes now use the scale
operand to answer the "isScaledIndex" question.

I toyed with the idea of keeping the UNSCALED enums and helper
functions but because they will have no uses and force SDNodes to
validate the set of supported values I figured it's best to remove
them. We can re-add them if there's a real need. For similar
reasons I've kept the IndexType enum when a bool could be used as I
think being explicitly looks better.

Depends On D123347

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

2 years ago[libc++] Remove overly conservative error in <stdatomic.h>
Louis Dionne [Fri, 13 May 2022 20:13:54 +0000 (16:13 -0400)]
[libc++] Remove overly conservative error in <stdatomic.h>

As mentionned in D97044, it is fine if users include <atomic> and then
include <stdatomic.h> -- we don't need to error out for that case.

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

2 years ago[libc++] Remove the legacy LIBCXX_LIBCPPABI_VERSION option
Louis Dionne [Mon, 16 May 2022 14:04:33 +0000 (10:04 -0400)]
[libc++] Remove the legacy LIBCXX_LIBCPPABI_VERSION option

I think this notion of libc++abi's version was relevant a long time ago
on Apple platforms when we were using a Xcode project to build the library.
As part of moving Apple's build to CMake, D59489 made it possible to
specify the "ABI version" of libc++abi in use. However, it's not possible
to build libc++abi with that old ABI anymore and we don't need the ability
to link against that version from libc++ anymore.

Hence, we can clean this up and stop falsely pretending that libc++abi
has more than one ABI version.

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

2 years ago[sanitizer] Don't use newfstatat for Linux on SPARC
John Paul Adrian Glaubitz [Mon, 16 May 2022 17:56:19 +0000 (10:56 -0700)]
[sanitizer] Don't use newfstatat for Linux on SPARC

Linux on SPARC uses fstatat64 instead.

Reviewed By: MaskRay

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

2 years agoOptimise findRefs for XRefs and docHighlights
Utkarsh Saxena [Mon, 16 May 2022 09:40:49 +0000 (11:40 +0200)]
Optimise findRefs for XRefs and docHighlights

Reduces time spent in findRef by 66%.

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

2 years ago[mlir][tosa] Use math.ctlz intrinsic for tosa.clz
Robert Suderman [Mon, 16 May 2022 18:08:49 +0000 (11:08 -0700)]
[mlir][tosa] Use math.ctlz intrinsic for tosa.clz

We were custom counting per bit for the clz instruction. Math dialect
now has an intrinsic to do this in one instruction. Migrated to this
instruction and fixed a minor bug math-to-llvm for the intrinsic.

Reviewed By: mravishankar

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

2 years ago[AIX] fixed llvm-ar can not read empty big archive correctly.
zhijian [Mon, 16 May 2022 18:29:37 +0000 (14:29 -0400)]
[AIX] fixed llvm-ar can not read empty big archive correctly.

Summary:

llvm-ar can not read empty big archive correctly. it output error as
error: unable to load 'empty.a': truncated or malformed archive (characters in size field in archive member header are not all decimal numbers: '<bigaf>'

Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D124017

2 years ago[AMDGPU] Revert wide LDS DMA support.
Stanislav Mekhanoshin [Wed, 11 May 2022 20:04:17 +0000 (13:04 -0700)]
[AMDGPU] Revert wide LDS DMA support.

This reverts ffbee7acdcaaf, see also bug 37653 which it was fixing.
The bug claims this is an undocumented feature which actually works.
In the reality it is documented as not working for a good reason.
It likely does something, but it is useless anyway. These instructions
write into the LDS. The LDS address is:

M0 + inst_offset + (TIDinWave * 4).

For a store wider than a DWORD neighboring lanes will overwrite each
other.

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

2 years agoAdd documentHighlight in clangd check for performance measurements.
Utkarsh Saxena [Mon, 16 May 2022 12:06:22 +0000 (14:06 +0200)]
Add documentHighlight in clangd check for performance measurements.

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

2 years ago[WebAssembly][TableGen][NFCI] Use getValueAsBit rather than converting TableGen ...
Alex Bradbury [Mon, 16 May 2022 17:47:25 +0000 (18:47 +0100)]
[WebAssembly][TableGen][NFCI] Use getValueAsBit rather than converting TableGen 'bit' to string

The logic around IsCanonical previously used getAsString and compared to
"1". Just using getValueAsBit is simpler.

2 years ago[mlir:toy][NFC] Remove unnecessary trailing return type
Jakub Kuderski [Mon, 16 May 2022 17:43:35 +0000 (13:43 -0400)]
[mlir:toy][NFC] Remove unnecessary trailing return type

In this instance, the trailing return type does not improve readability
as it repeats what is returned in the same line.

Reviewed By: rriddle

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

2 years ago[Driver] Change "zlib not installed" diagnostic to "zlib not enabled"
Fangrui Song [Mon, 16 May 2022 17:42:43 +0000 (10:42 -0700)]
[Driver] Change "zlib not installed" diagnostic to "zlib not enabled"

The former is a bit misleading and a user may try installing zlib which
will not help.

2 years ago[docs] Re-generate ClangCommandLineReference.rst
Fangrui Song [Mon, 16 May 2022 17:34:01 +0000 (10:34 -0700)]
[docs] Re-generate ClangCommandLineReference.rst

2 years ago[llvm-objdump] Let --symbolize-operands symbolize basic block addresses based on...
Rahman Lavaee [Fri, 13 May 2022 17:32:13 +0000 (10:32 -0700)]
[llvm-objdump] Let --symbolize-operands symbolize basic block addresses based on the SHT_LLVM_BB_ADDR_MAP section.

`--symbolize-operands` already symbolizes branch targets based on the disassembly. When the object file is created with `-fbasic-block-sections=labels` (ELF-only) it will include a SHT_LLVM_BB_ADDR_MAP section which maps basic blocks to their addresses. In such case `llvm-objdump` can annotate the disassembly based on labels inferred on this section.

In contrast to the current labels, SHT_LLVM_BB_ADDR_MAP-based labels are created for every machine basic block including empty blocks and those which are not branched into (fallthrough blocks).

The old logic is still executed even when the SHT_LLVM_BB_ADDR_MAP section is present to handle functions which have not been received an entry in this section.

Reviewed By: jhenderson, MaskRay

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

2 years agoRemove stale file from modulemap
Adrian Prantl [Mon, 16 May 2022 17:05:38 +0000 (10:05 -0700)]
Remove stale file from modulemap

2 years ago[AArch64] Predicate SSHLL;SCVTF patterns behind UseAlternateSExtLoadCVTF32
David Green [Mon, 16 May 2022 17:00:30 +0000 (18:00 +0100)]
[AArch64] Predicate SSHLL;SCVTF patterns behind UseAlternateSExtLoadCVTF32

There have been some patterns in the AArch64 backend to optimize code of
the form:
  ldrsh w8, [x0]
  scvtf s0, w8
to:
  ldr h0, [x0]
  sshll v0.4s, v0.4h, #0
  scvtf s0, s0
The idea is to remove the GRP->FPR move, but in reality is making code
larger and slower (or the same) on all the cpus I tried.

This patch adds the UseAlternateSExtLoadCVTF32 predicate similar to
nearby related pattern.

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

2 years ago[InstCombine] invert canonicalization for cast of signbit test
Sanjay Patel [Mon, 16 May 2022 16:29:47 +0000 (12:29 -0400)]
[InstCombine] invert canonicalization for cast of signbit test

The existing transform was wrong in 3 ways:
1. It created an extra instruction when the source and dest types don't match.
2. It did not account for an extra use of the icmp, so could create 2 extra insts.
3. It favored bit hacks over icmp (icmp generally has better analysis).

This fixes #54692 (modeled by the PhaseOrdering tests).

This is a minimal step to fix the bug, but we should likely invert
the sibling transform for the "is negative" pattern too.

The backend should be able to invert this back to a shift if that
leads to better codegen.

2 years ago[InstCombine] add tests for zext-of-signbit test; NFC
Sanjay Patel [Mon, 16 May 2022 16:26:48 +0000 (12:26 -0400)]
[InstCombine] add tests for zext-of-signbit test; NFC

2 years ago[AArch64][ARM][RISCV][X86] Add test cases for PR55484. NFC
Craig Topper [Mon, 16 May 2022 16:28:09 +0000 (09:28 -0700)]
[AArch64][ARM][RISCV][X86] Add test cases for PR55484. NFC

This bug is in generic DAG combine and easily reproducible on many
targets.

Reviewed By: david-arm

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

2 years ago[TargetLowering] Expand the last stage of i16 popcnt using shift+add+and instead...
Craig Topper [Mon, 16 May 2022 16:27:43 +0000 (09:27 -0700)]
[TargetLowering] Expand the last stage of i16 popcnt using shift+add+and instead of mul+shift.

If we use multiply it would be with 0x0101 which is 1 more than a power
of 2. On some targets we would expand this to shl+add. By avoiding the
multiply earlier, we can generate better code.

Note, PowerPC doesn't do the shl+add expansion of multiply so one of
the tests increased in instruction count.

Limiting to scalars because it almost always increased the number of
instructions in vector tests.

Reviewed By: RKSimon

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

2 years ago[DAGCombiner] Fix incorrect indentation. NFC
Craig Topper [Sun, 15 May 2022 18:45:42 +0000 (11:45 -0700)]
[DAGCombiner] Fix incorrect indentation. NFC

2 years ago[RISCV] Add further trace output to InsertVSETLVI
Philip Reames [Mon, 16 May 2022 16:15:26 +0000 (09:15 -0700)]
[RISCV] Add further trace output to InsertVSETLVI

2 years ago[llvm-profgen] Update callsite body samples by summing up all call target samples.
Hongtao Yu [Fri, 13 May 2022 05:08:18 +0000 (22:08 -0700)]
[llvm-profgen] Update callsite body samples by summing up all call target samples.

Current profile generation caculcates callsite body samples and call target samples separately. The former is done based on LBR range samples while the latter is done based on branch samples. Note that there's a subtle difference. LBR ranges is formed from two consecutive branch samples. Therefore the last entry in a LBR record will not be counted towards body samples while there's still a chance for it to be counted towards call targets if it is a function call. I'm making sense of the call body samples by updating it to the aggregation of call targets.

Reviewed By: wenlei

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

2 years ago[mlir][bufferize] Better user control of layout maps
Matthias Springer [Mon, 16 May 2022 15:02:00 +0000 (17:02 +0200)]
[mlir][bufferize] Better user control of layout maps

This changes replaces the `fully-dynamic-layout-maps` options (which was badly named) with two new options:

* `unknown-type-conversion` controls the layout maps on buffer types for which no layout map can be inferred.
* `function-boundary-type-conversion` controls the layout maps on buffer types inside of function signatures.

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

2 years ago[InstrProf][NFC] Save profile bias to function map
Ellis Hoag [Mon, 16 May 2022 14:13:07 +0000 (07:13 -0700)]
[InstrProf][NFC] Save profile bias to function map

Add a map from functions to load instructions that compute the profile bias. Previously we assumed that if the first instruction in the function was a load instruction, then it must be computing the bias. This was likely to work out because functions usually start with the `llvm.instrprof.increment` instruction, but optimizations could change this. For example, inlining into a non-profiled function.

Reviewed By: phosek

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

2 years ago[IR] create and use helper functions that test the signbit; NFCI
Sanjay Patel [Mon, 16 May 2022 15:11:51 +0000 (11:11 -0400)]
[IR] create and use helper functions that test the signbit; NFCI

2 years ago[LiveIntervals] Add range accessors for value numbers [nfc]
Philip Reames [Mon, 16 May 2022 14:48:57 +0000 (07:48 -0700)]
[LiveIntervals] Add range accessors for value numbers [nfc]

2 years ago[polly] Remove 'using namespace llvm/polly' from ScopGraphPrinter.h header.
Simon Pilgrim [Mon, 16 May 2022 15:19:03 +0000 (16:19 +0100)]
[polly] Remove 'using namespace llvm/polly' from ScopGraphPrinter.h header.

As mentioned on D123678 this appears to be causing namespace resolution issues on some versions of gcc.

2 years ago[AArch64] Update check lines in arm64-scvt.ll. NFC
David Green [Mon, 16 May 2022 14:50:39 +0000 (15:50 +0100)]
[AArch64] Update check lines in arm64-scvt.ll. NFC

2 years ago[PhaseOrdering] add tests for cmp + boolean/bitwise logic; NFC
Sanjay Patel [Mon, 16 May 2022 14:21:55 +0000 (10:21 -0400)]
[PhaseOrdering] add tests for cmp + boolean/bitwise logic; NFC

The tests (see C++ source in #54692) have multiple potential
optimizations/canonicalizations, but we should be consistent
since they are logically identical.

2 years ago[InstCombine] fix test name; NFC
Sanjay Patel [Mon, 16 May 2022 13:59:31 +0000 (09:59 -0400)]
[InstCombine] fix test name; NFC

The bug number was typo'd when it was added for D86243.

2 years ago[SLP]Check if the root of the buildvector has one use only.
Alexey Bataev [Mon, 16 May 2022 13:43:00 +0000 (06:43 -0700)]
[SLP]Check if the root of the buildvector has one use only.

The root of the buildvector can have only one use, otherwise it can be
treated only as a final element of the previous buildvector sequence.

2 years ago[ValueTracking] Handle and/or on RHS of isImpliedCondition()
Nikita Popov [Fri, 13 May 2022 14:35:43 +0000 (16:35 +0200)]
[ValueTracking] Handle and/or on RHS of isImpliedCondition()

isImpliedCondition() currently handles and/or on the LHS, but not
on the RHS, resulting in asymmetric behavior. This patch adds two
new implication rules:

 * LHS ==> (RHS1 || RHS2) if LHS ==> RHS1 or LHS ==> RHS2
 * LHS ==> !(RHS1 && RHS2) if LHS ==> !RHS1 or LHS ==> !RHS2

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

2 years ago[LAA,LV] Add initial support for pointer-diff memory checks.
Florian Hahn [Mon, 16 May 2022 14:27:22 +0000 (15:27 +0100)]
[LAA,LV] Add initial support for pointer-diff memory checks.

This patch adds initial support for a pointer diff based runtime check
scheme for vectorization. This scheme requires fewer computations and
checks than the existing full overlap checking, if it is applicable.

The main idea is to only check if source and sink of a dependency are
far enough apart so the accesses won't overlap in the vector loop. To do
so, it is sufficient to compute the difference and compare it to the
`VF * UF * AccessSize`. It is sufficient to check
`(Sink - Src) <u VF * UF * AccessSize` to rule out a backwards
dependence in the vector loop with the given VF and UF. If Src >=u Sink,
there is not dependence preventing vectorization, hence the overflow
should not matter and using the ULT should be sufficient.

Note that the initial version is restricted in multiple ways:

1. Pointers must only either be read or written, by a single
   instruction (this allows re-constructing source/sink for
   dependences with the available information)
 2. Source and sink pointers must be add-recs, with matching steps
 3. The step must be a constant.
 3. abs(step) == AccessSize.

Most of those restrictions can be relaxed in the future.

See https://github.com/llvm/llvm-project/issues/53590.

Reviewed By: dmgreen

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

2 years ago[AMDGPU] Mark sendmsg hasSideEffects. NFC
Joe Nash [Fri, 13 May 2022 16:55:16 +0000 (12:55 -0400)]
[AMDGPU] Mark sendmsg hasSideEffects. NFC

Address the FIXME by marking the sendmsg instructions with
hasSideEffects.

Reviewed By: foad

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

2 years ago[AMDGPU] Shrink MAD/FMA to MADAK/MADMK/FMAAK/FMAMK on GFX10
Jay Foad [Fri, 18 Feb 2022 17:24:50 +0000 (17:24 +0000)]
[AMDGPU] Shrink MAD/FMA to MADAK/MADMK/FMAAK/FMAMK on GFX10

On GFX10 VOP3 instructions can have a literal operand, so the conversion
from VOP3 MAD/FMA to VOP2 MADAK/MADMK/FMAAK/FMAMK will not happen in
SIFoldOperands. The only benefit of the VOP2 form is code size, so do it
in SIShrinkInstructions instead.

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

2 years ago[ConstantRange] Add toKnownBits() method
Nikita Popov [Mon, 16 May 2022 14:04:11 +0000 (16:04 +0200)]
[ConstantRange] Add toKnownBits() method

Add toKnownBits() method to mirror fromKnownBits(). We know the
top bits that are constant between min and max.

The return value for an empty range is chosen to be conservative.

2 years ago[AMDGPU] gfx11 BUF Instructions
Joe Nash [Tue, 19 Apr 2022 19:38:35 +0000 (15:38 -0400)]
[AMDGPU] gfx11 BUF Instructions

Includes MachineCode layer support and tests, and MIR tests not requiring
CodeGen pass changes.
Includes a small change in SMInstructions.td to correct encoded bits.

Contributors:
Petar Avramovic <Petar.Avramovic@amd.com>
Dmitry Preobrazhensky <dmitry.preobrazhensky@amd.com>

Depends on D125316

Patch 6/N for upstreaming of AMDGPU gfx11 architecture.

Reviewed By: dp, Petar.Avramovic

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

2 years ago[MSVC] Add support for pragma alloc_text
Stephen Long [Mon, 16 May 2022 13:59:40 +0000 (06:59 -0700)]
[MSVC] Add support for pragma alloc_text

`#pragma alloc_text` is a MSVC pragma that names the code section where functions should be placed. It only
applies to functions with C linkage.

https://docs.microsoft.com/en-us/cpp/preprocessor/alloc-text?view=msvc-170

Reviewed By: aaron.ballman

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

2 years agoApply clang-tidy fixes for llvm-qualified-auto in LinalgInterfaces.cpp (NFC)
Mehdi Amini [Mon, 16 May 2022 09:50:18 +0000 (09:50 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in LinalgInterfaces.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-move-const-arg in SerializeToHsaco.cpp (NFC)
Mehdi Amini [Mon, 16 May 2022 09:49:11 +0000 (09:49 +0000)]
Apply clang-tidy fixes for performance-move-const-arg in SerializeToHsaco.cpp (NFC)

2 years ago[clang-tidy][NFC] Reimplement SimplifyBooleanExpr with RecursiveASTVisitors
Nathan James [Mon, 16 May 2022 13:42:43 +0000 (14:42 +0100)]
[clang-tidy][NFC] Reimplement SimplifyBooleanExpr with RecursiveASTVisitors

Reimplement the matching logic using Visitors instead of matchers.

Benchmarks from running the check over SemaCodeComplete.cpp
Before 0.20s, After 0.04s

Reviewed By: aaron.ballman

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

2 years ago[CodeGen] Use ArrayRef in TargetLowering functions
Liqin.Weng [Mon, 16 May 2022 13:30:58 +0000 (13:30 +0000)]
[CodeGen] Use ArrayRef in TargetLowering functions

Reviewed By: craig.topper

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

2 years ago[runtimes] Generalize how we reorder projects
Louis Dionne [Fri, 6 May 2022 19:43:18 +0000 (15:43 -0400)]
[runtimes] Generalize how we reorder projects

This way, we could use it for LLVM_ENABLE_PROJECTS too if desired.

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

2 years ago[RISCV] remove useless code
Liqin.Weng [Mon, 16 May 2022 12:53:32 +0000 (12:53 +0000)]
[RISCV] remove useless code

When legality check for vectoring reduction, hasVInstructions() check be unneeded. RISCV can only loop vectorization with hasVInstructions()

Reviewed By: kito-cheng, craig.topper

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

2 years ago[runtimes] Introduce object libraries
Louis Dionne [Wed, 11 May 2022 15:06:28 +0000 (11:06 -0400)]
[runtimes] Introduce object libraries

This is a variant of D116689 rebased on top of the new (proposed) ABI
refactoring in D120727. It should conserve the basic properties of the
original patch by @phosek, except it also allows cleaning up the merging
of libc++abi into libc++ from the libc++ side.

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

2 years ago[clang][NFC] Cleanup some coroutine tests
Nathan Sidwell [Fri, 13 May 2022 10:52:49 +0000 (03:52 -0700)]
[clang][NFC] Cleanup some coroutine tests

I noticed these two tests emit a warning about a missing
unhandled_exception.  That's irrelevant to what is being tested, but
is unnecessary noise.

Reviewed By: dblaikie

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

2 years ago[AST] Cleanup on getting the underlying decl of using-shdow decl.
Haojian Wu [Mon, 16 May 2022 11:38:13 +0000 (13:38 +0200)]
[AST] Cleanup on getting the underlying decl of using-shdow decl.

This should be a NFC cleanup. It removes a unnecessary loop to get the underlying
decl, and add an assertion.

The underlying decl of a using-shadow decl is always the original declaration
has been brought into the scope, clang never builds a nested using-shadow
decl (see Sema::BuildUsingShadowDecl).

Reviewed By: sammccall

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

2 years ago[InstCombine] Combine instructions of type or/and where AND masks can be combined.
Biplob Mishra [Mon, 16 May 2022 11:43:12 +0000 (12:43 +0100)]
[InstCombine] Combine instructions of type or/and where AND masks can be combined.

The patch simplifies some of the patterns as below

(A | (B & C0)) | (B & C1) -> A | (B & C0|C1)
((B & C0) | A) | (B & C1) -> (B & C0|C1) | A

In some scenarios like byte reverse on half word, we can see this pattern multiple times and this conversion can optimize these patterns.

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

2 years ago[DAGCombine] Support splat_vector nodes in (and (extload)) dagcombine
Bradley Smith [Tue, 10 May 2022 12:25:38 +0000 (12:25 +0000)]
[DAGCombine] Support splat_vector nodes in (and (extload)) dagcombine

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

2 years agoAArch64: support ISel for fence instructions
Tim Northover [Mon, 16 May 2022 10:59:51 +0000 (11:59 +0100)]
AArch64: support ISel for fence instructions

Only the most conservative of the DAG patterns matched, leaving GISel with "dmb
ish" everywhere which is inefficient.

2 years ago[lldb][NFC] Simplify GenerateOptionUsage
David Spickett [Mon, 9 May 2022 10:58:21 +0000 (10:58 +0000)]
[lldb][NFC] Simplify GenerateOptionUsage

Once we get into the if block we know the value of only_print_args.
Move some variables closer to point of use.

Depends on D125218

Reviewed By: JDevlieghere

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

2 years ago[lldb][NFC] Make cmd a reference in GenerateOptionUsage
David Spickett [Mon, 9 May 2022 10:50:03 +0000 (10:50 +0000)]
[lldb][NFC] Make cmd a reference in GenerateOptionUsage

Nowhere in lldb do we call this with a null pointer.
If we did, the first line of the function would fault anyway.

Reviewed By: JDevlieghere

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

2 years ago[ADT] Adopt the new casting infrastructure for PointerUnion
Sheng [Mon, 16 May 2022 10:38:39 +0000 (18:38 +0800)]
[ADT] Adopt the new casting infrastructure for PointerUnion

Reviewed By: lattner, bzcheeseman

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

2 years ago[GlobalISel] Handle constant splat in funnel shift combine
Abinav Puthan Purayil [Thu, 12 May 2022 17:05:52 +0000 (22:35 +0530)]
[GlobalISel] Handle constant splat in funnel shift combine

This change adds the constant splat versions of m_ICst() (by using
getBuildVectorConstantSplat()) and uses it in
matchOrShiftToFunnelShift(). The getBuildVectorConstantSplat() name is
shortened to getIConstantSplatVal() so that the *SExtVal() version would
have a more compact name.

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

2 years ago[AMDGPU][GlobalISel] Pre-commit tests for D125516
Abinav Puthan Purayil [Fri, 13 May 2022 10:58:05 +0000 (16:28 +0530)]
[AMDGPU][GlobalISel] Pre-commit tests for D125516

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

2 years ago[X86][AVX] Add test showing poor expansion of bit-reversal permutation shuffles
Simon Pilgrim [Mon, 16 May 2022 10:24:13 +0000 (11:24 +0100)]
[X86][AVX] Add test showing poor expansion of bit-reversal permutation shuffles

Reported here: https://discourse.llvm.org/t/ir-alternatives-to-freeze-to-selectively-prevent-compiler-from-combining-shufflevectors/62521

2 years ago[SelectionDAG] Make getNode which uses single element SDVTList pass SDNodeFlags.
Yeting Kuo [Mon, 16 May 2022 03:56:31 +0000 (11:56 +0800)]
[SelectionDAG] Make getNode which uses single element SDVTList pass SDNodeFlags.

The patch make users not need to know getNode with SDNodeFlags argument may not
pass its flags.

Reviewed By: craig.topper

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

2 years ago[AArch64] Handle 64bit vectors in tryCombineFixedPointConvert
David Green [Mon, 16 May 2022 10:08:47 +0000 (11:08 +0100)]
[AArch64] Handle 64bit vectors in tryCombineFixedPointConvert

Under some situations we can visit 64bit vector extract elements in
tryCombineFixedPointConvert, where an assert fires as they are expected
to have been converted to 128bit. Turn the assert into an if statement,
bailing out and letting the extract be handled first.

Also invert some ifs, using early exits to reduce indentation.

Fixes #55417

2 years ago[StatepointLowering] Properly handle local and non-local relocates of the same value.
Denis Antrushin [Fri, 13 May 2022 10:55:26 +0000 (17:55 +0700)]
[StatepointLowering] Properly handle local and non-local relocates of the same value.

FunctionLoweringInfo::StatepointRelocationMaps map is used to pass GC pointer
lowering information from statepoint to gc.relocate  which may appear ini
different block.
D124444 introduced different lowering for local and non-local relocates.
Local relocates use SDValue and non-local relocates use value exported to VReg.
But I overlooked the fact that StatepointRelocationMap is indexed not by
GCRelocate instruction, but by derived pointer. This works incorrectly when
we have two relocates (one local and another non-local) of the same value,
because they need different relocation records.

This patch fixes the problem by recording relocation information per relocate
instruction, not per derived pointer. This way, each gc.relocate can be lowered
differently.

Reviewed By: skatkov

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