platform/upstream/llvm.git
16 months ago[ORC] Drop StaticLibraryDefinitionGenerator Load/Create overloads with triples.
Lang Hames [Wed, 22 Feb 2023 05:22:28 +0000 (21:22 -0800)]
[ORC] Drop StaticLibraryDefinitionGenerator Load/Create overloads with triples.

We can get the triple from the ExecutionSession, so clients shouldn't have to
provide it.

16 months ago[libc] add basic Intel MacOS configuration
Michael Jones [Wed, 1 Mar 2023 19:35:40 +0000 (11:35 -0800)]
[libc] add basic Intel MacOS configuration

The config is based on the ARM MacOS config, but with fenv and math
functions disabled.

This should unblock this bug: https://github.com/llvm/llvm-project/issues/60910

Reviewed By: sivachandra

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

16 months ago[RegAllocFast] insert additional spills along indirect edges of INLINEASM_BR
Nick Desaulniers [Wed, 1 Mar 2023 23:20:55 +0000 (15:20 -0800)]
[RegAllocFast] insert additional spills along indirect edges of INLINEASM_BR

When generating spills (stores) for values produced by INLINEASM_BR
instructions, make sure to insert one spill per indirect target.
Otherwise the reload generated may load from a stack slot that has not
yet been stored to (resulting in a load of an uninitialized stack slot).

Link: https://github.com/llvm/llvm-project/issues/53562
Fixes: https://github.com/llvm/llvm-project/issues/60855

Reviewed By: MatzeB

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

16 months agoprecommit test for pr60855
Nick Desaulniers [Mon, 27 Feb 2023 19:22:42 +0000 (11:22 -0800)]
precommit test for pr60855

This test demonstrates an issue with callbr outputs being used along
indirect edges when using regallocfast.

Link: https://github.com/llvm/llvm-project/issues/60855
Differential Revision: https://reviews.llvm.org/D144906

16 months ago[mlir][python] Remove "Raw" OpView classes
Rahul Kayaith [Mon, 23 Jan 2023 04:31:18 +0000 (23:31 -0500)]
[mlir][python] Remove "Raw" OpView classes

The raw `OpView` classes are used to bypass the constructors of `OpView`
subclasses, but having a separate class can create some confusing
behaviour, e.g.:
```
op = MyOp(...)
# fails, lhs is 'MyOp', rhs is '_MyOp'
assert type(op) == type(op.operation.opview)
```

Instead we can use `__new__` to achieve the same thing without a
separate class:
```
my_op = MyOp.__new__(MyOp)
OpView.__init__(my_op, op)
```

Reviewed By: stellaraccident

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

16 months ago[mlir][python] Allow running pass manager on any operation
rkayaith [Wed, 9 Nov 2022 03:48:26 +0000 (22:48 -0500)]
[mlir][python] Allow running pass manager on any operation

`PassManager.run` is currently restricted to running on `builtin.module`
ops, but this restriction doesn't exist on the C++ side. This updates it
to take `ir.Operation/OpView` instead of `ir.Module`.

Depends on D143354

Reviewed By: mehdi_amini

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

16 months ago[mlir][CAPI] Allow running pass manager on any operation
rkayaith [Wed, 9 Nov 2022 03:39:18 +0000 (22:39 -0500)]
[mlir][CAPI] Allow running pass manager on any operation

`mlirPassManagerRun` is currently restricted to running on
`builtin.module` ops, but this restriction doesn't exist on the C++
side. This renames it to `mlirPassManagerRunOnOp` and updates it to take
`MlirOperation` instead of `MlirModule`.

Depends on D143352

Reviewed By: mehdi_amini

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

16 months ago[mlir][python] Add generic operation parse APIs
rkayaith [Tue, 8 Nov 2022 21:55:06 +0000 (16:55 -0500)]
[mlir][python] Add generic operation parse APIs

Currently the bindings only allow for parsing IR with a top-level
`builtin.module` op, since the parse APIs insert an implicit module op.
This change adds `Operation.parse`, which returns whatever top-level op
is actually in the source.

To simplify parsing of specific operations, `OpView.parse` is also
added, which handles the error checking for `OpView` subclasses.

Reviewed By: ftynse, stellaraccident

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

16 months ago[mlir][AsmParser] Improve parse{Attribute,Type} error handling
Rahul Kayaith [Sat, 25 Feb 2023 07:30:46 +0000 (02:30 -0500)]
[mlir][AsmParser] Improve parse{Attribute,Type} error handling

Currently these functions report errors directly to stderr, this updates
them to use diagnostics instead. This also makes partially-consumed
strings an error if the `numRead` parameter isn't provided (the
docstrings already claimed this happened, but it didn't.)

While here I also tried to reduce the number of overloads by switching
to using default parameters.

Reviewed By: rriddle

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

16 months ago[NFC][Pipeline] Move PromotePass into GlobalCleanupPM
Arthur Eubanks [Wed, 1 Mar 2023 21:21:04 +0000 (13:21 -0800)]
[NFC][Pipeline] Move PromotePass into GlobalCleanupPM

16 months ago[OpenMP][NFC] Clean up Twines and other issues in plugins
Joseph Huber [Wed, 1 Mar 2023 21:02:00 +0000 (15:02 -0600)]
[OpenMP][NFC] Clean up Twines and other issues in plugins

Summary:
Tihs patch is mostly NFC to fix some warning currently present in OpenMP
offloading plugins. Specifically this mostly removes the use of Twine
variables in favor of LLVM's small string. Twine variables are prone to
use-after-free and this is a cleaner way to concatenate a string.

16 months ago[llvm][LowerConstantIntrinsics] add debug statements
Nick Desaulniers [Wed, 1 Mar 2023 20:58:13 +0000 (12:58 -0800)]
[llvm][LowerConstantIntrinsics] add debug statements

These can help us better understand what __builtin_constant_p and
__builtin_object_size get folded to.

$ clang -mllvm -debug-only=lower-is-constant-intrinsic ...

Reviewed By: void

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

16 months ago[libc] Fix mismatch in exception decl
Jeff Bailey [Wed, 1 Mar 2023 20:55:59 +0000 (20:55 +0000)]
[libc] Fix mismatch in exception decl

When running the libc tests under vscode, I got an error about a
mismatches exception declaration for strerror.  Since string.h
seems to be getting included transitively anyway, just include
it and rely on its definition.

Reviewed By: michaelrj

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

16 months ago[mlir][sparse] support coiteration with fused reshape tensor
Peiming Liu [Wed, 1 Mar 2023 19:03:02 +0000 (19:03 +0000)]
[mlir][sparse] support coiteration with fused reshape tensor

Reviewed By: aartbik

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

16 months ago[libc++] [FreeBSD] only use _umtx_op(2) on 64bit arches
Konstantin Belousov [Fri, 20 Jan 2023 23:32:11 +0000 (18:32 -0500)]
[libc++] [FreeBSD] only use _umtx_op(2) on 64bit arches

Only 64bit architectures can be supported this way, because libcxx
defines __cxx_contention_t to be int64_t for FreeBSD, and 32bit
arches do not have a kind of UMTX_OP_WAIT_INT64_PRIVATE operation.

Fixes: 83387dbc18e7998f87aa4a2d35320bcb2ed5c392

Reviewed by: arichardson, ldionne, emaste, Mordante
Differential Revision: https://reviews.llvm.org/D142422

16 months ago[Flang][Tool][bbc] Emit module wrapper in addition to body
Andrew Gozillon [Wed, 1 Mar 2023 20:32:54 +0000 (14:32 -0600)]
[Flang][Tool][bbc] Emit module wrapper in addition to body

This change seeks to emit the full module from the bbc tool and
not just the body. This change currently does not break existing tests
when running check-(mlir, flang, all). This stops the discarding of
any attributes that may be applied to the Module during
compilation.

Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D144869

16 months ago[libc++] Use generic-cxx20 instead of apple-cxx20 on Apple CI
Louis Dionne [Wed, 1 Mar 2023 20:25:29 +0000 (15:25 -0500)]
[libc++] Use generic-cxx20 instead of apple-cxx20 on Apple CI

apple-cxx20 is equivalent to generic-cxx20, so we don't need it anymore.
It had been introduced when clang-tidy was enabled explicitly from
run-buildbot, but that's not needed anymore since clang-tidy is
enabled from the buildkite pipeline definition.

16 months ago[libc++][NFC] Remove trailing whitespace on line and clang-format
Louis Dionne [Wed, 1 Mar 2023 20:11:44 +0000 (15:11 -0500)]
[libc++][NFC] Remove trailing whitespace on line and clang-format

This broke the CI after 813e1da974 was checked in.

16 months ago[Libomptarget] Fix block and thread limit environment variables not being respected
Joseph Huber [Wed, 1 Mar 2023 20:02:40 +0000 (14:02 -0600)]
[Libomptarget] Fix block and thread limit environment variables not being respected

The next-gen plugins did not properly set the values from
`OMP_NUM_TEAMS` and `OMP_TEAMS_THREAD_LIMIT`. This is because these
maximum values are set by each plugin to its hardware maximum. This
happens *after* the previous initialization. Move it to the correct
place and then add a test.

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

Reviewed By: tianshilei1992

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

16 months ago[AArch64] Precommit some more LD1R splat tests for scalar int/fp loads
Sjoerd Meijer [Wed, 1 Mar 2023 14:43:35 +0000 (14:43 +0000)]
[AArch64] Precommit some more LD1R splat tests for scalar int/fp loads

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

16 months ago[flang] Check for BIND(C) through use association.
Slava Zakharin [Wed, 1 Mar 2023 16:42:22 +0000 (08:42 -0800)]
[flang] Check for BIND(C) through use association.

If the interface specifies BIND(C), then the declarations using
this interface inherit BIND(C), and if they are referenced via use
association they must be classified as BIND(C) subprograms.

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

16 months ago[libc++] Refactor the std/depr C headers tests
Louis Dionne [Wed, 1 Mar 2023 19:45:17 +0000 (14:45 -0500)]
[libc++] Refactor the std/depr C headers tests

Move multiple tests to .compile.pass.cpp when they were not running
anything and reindent a bit more consistently.

16 months ago[llvm] Prevent building for riscv32-unknown-fuchsia
Leonard Chan [Wed, 1 Mar 2023 19:42:15 +0000 (19:42 +0000)]
[llvm] Prevent building for riscv32-unknown-fuchsia

Fuchsia is exclusively 64-bit so this throw an error when using this
triple.

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

16 months ago[MLIR] Add `print-ir` pass for debugging purposes
Frederik Gossen [Wed, 1 Mar 2023 19:33:49 +0000 (14:33 -0500)]
[MLIR] Add `print-ir` pass for debugging purposes

Add pass to print the entire IR on the debug stream.
This is meant for debugging purposes to inspect the IR at a specific point in the pipeline.

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

16 months ago[flang] Move fir.select_type into the PolymorphicOpConversion pass
Renaud-K [Mon, 27 Feb 2023 22:39:18 +0000 (14:39 -0800)]
[flang] Move fir.select_type into the PolymorphicOpConversion pass
https://reviews.llvm.org/D144921

16 months ago[DivRemPairs] Remove legacy pass
Fangrui Song [Wed, 1 Mar 2023 19:16:18 +0000 (11:16 -0800)]
[DivRemPairs] Remove legacy pass

Following recent changes to remove non-core legacy passes.

16 months ago[LLDB] Expose several methods in SBWatchpoint
Dan Liew [Tue, 28 Feb 2023 01:05:19 +0000 (17:05 -0800)]
[LLDB] Expose several methods in SBWatchpoint

This patch adds the following methods:

* `GetType()`
* `GetWatchValueKind()`
* `GetWatchSpec()`
* `IsWatchingReads()`
* `IsWatchingWrites()`

These mostly expose methods that `lldb_private::Watchpoint` already
had. Tests are included that exercise these new methods.

The motivation for exposing these are as follows:

* `GetType()` - With this information and the address from a watchpoint
  it is now possible to construct an SBValue from an SBWatchpoint.
  Previously this wasn't possible. The included test case illustrates
  doing this.
* `GetWatchValueKind()` - This allows the caller to determine whether the
  watchpoint is a variable watchpoint or an expression watchpoint. A new
  enum (`WatchpointValueKind`) has been introduced to represent the
  return values. Unfortunately the name `WatchpointKind` was already
  taken.
* `GetWatchSpec()` - This allows (at least for variable watchpoints)
  to use a sensible name for SBValues created from an SBWatchpoint.
* `IsWatchingReads()` - This allow checking if a watchpoint is
  monitoring read accesses.
* `IsWatchingWRites()` - This allow checking if a watchpoint is
  monitoring write accesses.

rdar://105606978

Reviewers: jingham, mib, bulbazord, jasonmolenda, JDevlieghere

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

16 months ago[lld] [MTE] Add DT_AARCH64_MEMTAG_* dynamic entries, and small cleanup
Mitch Phillips [Wed, 1 Mar 2023 19:00:49 +0000 (11:00 -0800)]
[lld] [MTE] Add DT_AARCH64_MEMTAG_* dynamic entries, and small cleanup

Adds the new AArch64-ABI dynamic entry generation to LLD. This will
allow Android to move from the Android-specific ELF note onto the
dynamic entries.

Change the behaviour of an unspecified --android-memtag-mode. Now, when
unspecified, this will print a warning that you're doing a no-op, rather
than implicitly turning on sync mode. This is important for MTE globals
later, where a binary containing static tagged global descriptors
shouldn't have MTE turned on without specific intent being passed to the
linker.

For now, continue to emit the Android ELF note by default. In future, we
can probably make it only emit the note when provided a flag.

Do a quick NFC-cleanup of the ELF note while we're here. It doesn't
change anything about the ELF note itself, but makes it more clear to
the reader of the code what alignment requirements are being (previously
implicitly) met.

Reviewed By: fmayer, MaskRay

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

16 months ago[Sanitizers] Error out for -static-libsan on darwin
usama hameed [Wed, 1 Mar 2023 19:07:03 +0000 (00:07 +0500)]
[Sanitizers] Error out for -static-libsan on darwin
since it is not supported

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

16 months ago[mlir][sparse] fuse collapse_shape on sparse tensor with GenericOp.
Peiming Liu [Mon, 27 Feb 2023 22:40:34 +0000 (22:40 +0000)]
[mlir][sparse] fuse collapse_shape on sparse tensor with GenericOp.

Instead of always materializing a new sparse tensor after reshape, this patch tries to fuses the reshape (currently only on COO) with GenericOp and coiterates with the reshaped tensors without allocating a new sparse tensor.

Reviewed By: aartbik

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

16 months ago[mlir][spirv] Support shaped types with index element
Jakub Kuderski [Wed, 1 Mar 2023 19:03:17 +0000 (14:03 -0500)]
[mlir][spirv] Support shaped types with index element

This makes the SPIR-V type converter first convert `index` element types
to the right integer type.

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

Reviewed By: antiagainst

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

16 months ago[DAG] expandIntMINMAX - attempt to match existing SETCC node
Simon Pilgrim [Wed, 1 Mar 2023 19:03:56 +0000 (19:03 +0000)]
[DAG] expandIntMINMAX - attempt to match existing SETCC node

As noticed on D144789, when we have pairs of min/max nodes we often end up with multiple comparisons which we could reuse with commuted select ops, so check to see if a suitable SETCC already exists. This also allowed us to remove a similar X86 peephole.

There are other getSETCC cases where we could safely reuse other CondCodes as well - I've been trying to think of how we could reuse this logic in SelectionDAG but haven't found anything that always works well.

An alternative would be to have a TLI callback that returns a preferred CondCode from a list of options, I've noticed this helped fpclamptosat tests on some other targets (MVE + WebAssembly), but other tests suffered.

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

16 months ago[llvm-readobj] Add --memtag
Mitch Phillips [Wed, 1 Mar 2023 18:49:39 +0000 (10:49 -0800)]
[llvm-readobj] Add --memtag

This adds functionality to readelf/readobj to specifically handle
MTE-related bits, like the AARCH64_MEMTAG_* dynamic entries, and a
decoder for the Android-specific ELF note.

Reviewed By: jhenderson, MaskRay

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

16 months ago[libc] Fix strcspn
Alex Brachet [Wed, 1 Mar 2023 18:57:07 +0000 (18:57 +0000)]
[libc] Fix strcspn

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

16 months ago[libc] Fix printf %f rounding condition
Michael Jones [Tue, 28 Feb 2023 23:10:08 +0000 (15:10 -0800)]
[libc] Fix printf %f rounding condition

When running the tbin2dec tests I found a rounding error in my code.
Upon inspection I realized it was due to a lack of parenthesis when
calculating the number of trailing digits. This patch fixes that mistake
and adds unit tests to catch regressions in future.

Reviewed By: lntue

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

16 months ago[GWP-ASan][Fuchsia] Use more modern zxtest testing macros
Alex Brachet [Wed, 1 Mar 2023 18:54:05 +0000 (18:54 +0000)]
[GWP-ASan][Fuchsia] Use more modern zxtest testing macros

16 months ago[GWP-ASan] Stop using type aliases for ::testing:: types
Alex Brachet [Wed, 1 Mar 2023 18:49:18 +0000 (18:49 +0000)]
[GWP-ASan] Stop using type aliases for ::testing:: types

16 months ago[libc++][NFC] Move test to .compile.pass.cpp since it doesn't run anything
Louis Dionne [Wed, 1 Mar 2023 18:21:01 +0000 (13:21 -0500)]
[libc++][NFC] Move test to .compile.pass.cpp since it doesn't run anything

16 months ago[libc++] implement move_iterator<T*> should be a random access iterator \n Differntia...
Shivam kunwar [Wed, 1 Mar 2023 18:11:36 +0000 (23:41 +0530)]
[libc++] implement move_iterator<T*> should be a random access iterator \n Differntial Revision- https://reviews.llvm.org/D135248

16 months ago[PhaseOrdering] add test for vector load and cast transforms; NFC
Sanjay Patel [Wed, 1 Mar 2023 17:18:44 +0000 (12:18 -0500)]
[PhaseOrdering] add test for vector load and cast transforms; NFC

issue #51397

16 months ago[InstCombine] add tests for signed absolute diff; NFC
Sanjay Patel [Wed, 1 Mar 2023 14:24:54 +0000 (09:24 -0500)]
[InstCombine] add tests for signed absolute diff; NFC

16 months ago[mlir] Fix a warning
Kazu Hirata [Wed, 1 Mar 2023 17:42:31 +0000 (09:42 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp:37:13: error:
  unused function 'debugPrintLoopInShortForm'
  [-Werror,-Wunused-function]

16 months ago[ADCE] Keep track of if we modified the CFG and preserve analyses accordingly
Arthur Eubanks [Tue, 28 Feb 2023 23:06:51 +0000 (15:06 -0800)]
[ADCE] Keep track of if we modified the CFG and preserve analyses accordingly

No measurable compile time impact, but might as well resolve the TODO.

Reviewed By: nikic

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

16 months ago[PassBuilder] Always enable CountVisitsPass when stats are enabled
Arthur Eubanks [Tue, 28 Feb 2023 23:38:01 +0000 (15:38 -0800)]
[PassBuilder] Always enable CountVisitsPass when stats are enabled

Rather than having a separate flag.

Reviewed By: asbirlea

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

16 months ago[SIAnnotateControlFlow] Use Uniformity analysis
Anshil Gandhi [Wed, 1 Mar 2023 17:19:17 +0000 (10:19 -0700)]
[SIAnnotateControlFlow] Use Uniformity analysis

Reviewed By: foad

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

16 months ago[AMDGPUUnifyDivergentExitNodes] Use Uniformity Analysis
Anshil Gandhi [Wed, 1 Mar 2023 17:15:31 +0000 (10:15 -0700)]
[AMDGPUUnifyDivergentExitNodes] Use Uniformity Analysis

Reviewed By: foad

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

16 months ago[clang] drop buggy use of `-serialize-diagnostics` flag
Ashay Rane [Tue, 28 Feb 2023 01:14:13 +0000 (19:14 -0600)]
[clang] drop buggy use of `-serialize-diagnostics` flag

The `-serialize-diagnostics` flag requires a filename to be passed
immediately after it, but the filename argument was skipped in the
P1689.cppm clang test.  This caused the code to incorrectly consume the
argument that followed as the dignostics file.

Since the `-serialize-diagnostics` flag isn't needed for this test to
work, this patch removes it instead of passing a file argument.

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

16 months ago[ASTMatcher] Add coroutineBodyStmt matcher
Chris Cotter [Wed, 1 Mar 2023 16:51:46 +0000 (11:51 -0500)]
[ASTMatcher] Add coroutineBodyStmt matcher

The coroutineBodyStmt matcher matches CoroutineBodyStmt AST nodes.

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

16 months ago[DAG] ABD is not reassociative
David Green [Wed, 1 Mar 2023 16:22:13 +0000 (16:22 +0000)]
[DAG] ABD is not reassociative

I'm not sure how I missed this in the testing, but as far as I understand
whilst ABDS and ABDU are commutive they are not associative. This patch
disables reassociateOps from visitABD, fixing the problems found in #61069.
ABDU: https://alive2.llvm.org/ce/z/eiT5QG
ABDS: https://alive2.llvm.org/ce/z/HzE29l

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

16 months ago[ADT] Use `adl_begin`/`end` in `enumerate`
Jakub Kuderski [Wed, 1 Mar 2023 16:10:40 +0000 (11:10 -0500)]
[ADT] Use `adl_begin`/`end` in `enumerate`

This allows `enumerate` to work with range types that expose custom
`begin`/`end` functions.

This is a cleanup in preparation for future changes in
https://reviews.llvm.org/D144503.

Reviewed By: zero9178

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

16 months agoFix Bazel build post c888a0ce8846e7ebf30914d4959125da80b3f566
Nicolas Vasilache [Wed, 1 Mar 2023 16:10:49 +0000 (08:10 -0800)]
Fix Bazel build post c888a0ce8846e7ebf30914d4959125da80b3f566

16 months ago[clang][Interp] Handle DecompositionDecls
Timm Bäder [Thu, 12 Jan 2023 11:47:02 +0000 (12:47 +0100)]
[clang][Interp] Handle DecompositionDecls

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

16 months ago[libc++] Fix modules issues on OS X
Arthur O'Dwyer [Sun, 31 Jul 2022 16:25:05 +0000 (12:25 -0400)]
[libc++] Fix modules issues on OS X

First, fix a collision with the Point type from MacTypes.h, which was
reported on Slack, 2022-07-31: https://cpplang.slack.com/archives/C2X659D1B/p1659284691275889

Second, rename the meta:: namespace to types::. OSX's "/usr/include/ncurses.h"
defines a `meta` function, and is (for some reason) included in
"<SDK>/usr/include/module.modulemap", so that identifier is off-limits
for us to use in anything that compiles with -fmodules:

    libcxx/test/support/type_algorithms.h:16:11: error: redefinition of 'meta' as different kind of symbol
    namespace meta {
               ^
    <SDK>/usr/include/ncurses.h:603:28: note: previous definition is here
    extern NCURSES_EXPORT(int) meta (WINDOW *,bool);                        /* implemented */
                                ^

Finally, add a CI configuration for modules on OS X to make sure it
does not regress.

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

16 months ago[mlir][sparse] Improve the implementation of sparse_tensor.new for the codegen path.
bixia1 [Tue, 28 Feb 2023 20:52:16 +0000 (12:52 -0800)]
[mlir][sparse] Improve the implementation of sparse_tensor.new for the codegen path.

Rewrite a NewOp into a NewOp of a sorted COO tensor and a ConvertOp for
converting the sorted COO tensor to the destination tensor type.

Codegen a NewOp of a sorted COO tensor to use the new bulk reader API and sort
the elements only when the input is not sorted.

Reviewed By: aartbik

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

16 months ago[mlir][MemRef] Rewrite multi-buffering with proper composable abstractions
Nicolas Vasilache [Wed, 1 Mar 2023 11:47:56 +0000 (03:47 -0800)]
[mlir][MemRef] Rewrite multi-buffering with proper composable abstractions

Rewrite and document multi-buffering properly:
1. Use IndexingUtils / StaticValueUtils instead of duplicating functionality
2. Properly plumb RewriterBase through.
3. Add support
4. Better debug messages.

This revision is otherwise almost NFC, if it weren't for the extra DeallocOp
support that would previoulsy make multi-buffering fail.

Depends on: D145036

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

16 months ago[clang][RISCV][test] Add coverage for __fp16 support in arguments/returns
Alex Bradbury [Wed, 1 Mar 2023 15:17:19 +0000 (15:17 +0000)]
[clang][RISCV][test] Add coverage for __fp16 support in arguments/returns

By choice, we don't set HalfArgsAndReturns=true (which would allow
__fp16 in args and returns). Add test coverage for this to ensure it
isn't changed by accident.

16 months ago[SimpleLoopUnswitch] Forget loops before invalidating IR.
Florian Hahn [Wed, 1 Mar 2023 15:06:33 +0000 (16:06 +0100)]
[SimpleLoopUnswitch] Forget loops before invalidating IR.

Invalidate SCEV before adjusting switch instruction, so the IR remains
in a valid state for SCEV invalidation.

16 months ago[ARM] Remove a redundant function fixupBTI
Jirui Wu [Mon, 27 Feb 2023 15:03:42 +0000 (15:03 +0000)]
[ARM] Remove a redundant function fixupBTI

Since the redundant BTI instructions emitted by jump tables are now
removed in the ARMBranchTargets pass, the fixupBTI function is not needed
in the ARMConstantIslandPass. Some related tests are removed as well.

The relevant patch that removes the redundant BTI instructions:
https://reviews.llvm.org/D144470

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

16 months ago[flang] MERGE result is polymorphic only if TSOURCE and FSOURCE are polymorphic
Valentin Clement [Wed, 1 Mar 2023 14:43:34 +0000 (15:43 +0100)]
[flang] MERGE result is polymorphic only if TSOURCE and FSOURCE are polymorphic

16.9.129 point 4: the result is polymorphic if and only if both TSOURCE and
FSOURCE are polymorphic.

If neither TSOURCE and FSOURCE are polymorphic then the current behavior is
preserved.

Depends on D145058

Reviewed By: jeanPerier

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

16 months agoLibclangTest: remove libclang-test-* tmp dir reliably
Igor Kushnir [Wed, 1 Mar 2023 14:44:43 +0000 (09:44 -0500)]
LibclangTest: remove libclang-test-* tmp dir reliably

Temporary directories created by two LibclangReparseTest tests -
ReparseWithModule and clang_parseTranslationUnit2FullArgv - remained in
the system temporary directory after running libclangTests, because not
all files and subdirectories created in TestDir were added to set
LibclangParseTest::Files.

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

16 months ago[flang] Allow scalar boxed record type in intrinsic elemental lowering
Valentin Clement [Wed, 1 Mar 2023 14:41:56 +0000 (15:41 +0100)]
[flang] Allow scalar boxed record type in intrinsic elemental lowering

Relax a bit the condition added in D144417 and allow scalar polymorphic entities
and boxed scalar record type.

Reviewed By: jeanPerier

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

16 months ago[clang][Interp] This pointers are writable in de-/constructors
Timm Bäder [Wed, 26 Oct 2022 09:20:13 +0000 (11:20 +0200)]
[clang][Interp] This pointers are writable in de-/constructors

This is possible in C++20, so we need to check this when doing stores.

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

16 months ago[SLP][NFC]Update the test to simplify and avoid dead instruction
Alexey Bataev [Wed, 1 Mar 2023 14:34:52 +0000 (06:34 -0800)]
[SLP][NFC]Update the test to simplify and avoid dead instruction
removal, NFC.

16 months ago[CodeGen] Always expand division larger than i128
Nikita Popov [Mon, 27 Feb 2023 14:23:01 +0000 (15:23 +0100)]
[CodeGen] Always expand division larger than i128

Default MaxDivRemBitWidthSupported to 128, so that divisions larger
than 128 bits are always expanded, without requiring additional
configuration from the target.

Note that this may still emit calls to __udivti3 on 32-bit targets,
which likely don't have an implementation of that builtin. However,
I believe this is sufficient to fix
https://github.com/llvm/llvm-project/issues/60531, because Zig must
already be defining those builtins.

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

16 months ago[RISCV] Pre-commit test case for ordered reduction, NFC
Mel Chen [Tue, 21 Feb 2023 07:08:37 +0000 (23:08 -0800)]
[RISCV] Pre-commit test case for ordered reduction, NFC

Reviewed By: reames

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

16 months ago[LoopVectorize] Use overflow-check analysis to improve tail-folding.
Sander de Smalen [Mon, 30 Jan 2023 11:21:31 +0000 (11:21 +0000)]
[LoopVectorize] Use overflow-check analysis to improve tail-folding.

This work follows on from D142109 and addresses a possible regression
when we know the loop iteration counter cannot overflow.

When we know the overflow-check always evaluates to false, it's better to
use the other style of tail folding where it assumes a runtime check was
added, because that avoids having to calculate a modified trip-count.

Reviewed By: paulwalker-arm

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

16 months ago[gn build] Port f8d10d5ac9ab
LLVM GN Syncbot [Wed, 1 Mar 2023 14:01:57 +0000 (14:01 +0000)]
[gn build] Port f8d10d5ac9ab

16 months ago[InstCombine] prevent miscompiles from select-of-div/rem transform
Sanjay Patel [Wed, 1 Mar 2023 13:32:27 +0000 (08:32 -0500)]
[InstCombine] prevent miscompiles from select-of-div/rem transform

This avoids the danger shown in issue #60906.
There were no regression tests for these patterns, so these potential
failures have been around for a long time.

We freeze the condition and preserve the optimization because
getting rid of a div/rem is always a win.

Here are a couple of examples that can be corrected by freezing the
condition:
https://alive2.llvm.org/ce/z/sXHTTC

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

16 months ago[AArch64] Load into zero vector patterns
David Green [Wed, 1 Mar 2023 13:54:03 +0000 (13:54 +0000)]
[AArch64] Load into zero vector patterns

A LDR will implicitly zero the rest of the vector, so vector_insert(zeros,
load, 0) can use a single load. This adds tablegen patterns for both scaled and
unscaled loads, detecting where we are inserting a load into the lower element
of a zero vector.

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

16 months ago[gn] port e281d102fb73 more
Nico Weber [Wed, 1 Mar 2023 13:50:44 +0000 (08:50 -0500)]
[gn] port e281d102fb73 more

16 months agoMove close() to the proper else block
Wu, Yingcong [Wed, 1 Mar 2023 13:38:00 +0000 (19:08 +0530)]
Move close() to the proper else block

`LogWriter::Close(LW)` is outside the null check if-else block, which, when `LW == nullptr`, will causing a NULL dereference.
I think the close() means to be in else block, which is when `LW != nullptr`.

Reviewed By: xgupta

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

16 months ago[clang][RISCV][test] Add further test coverage for _Float16 on RISC-V
Alex Bradbury [Wed, 1 Mar 2023 13:31:40 +0000 (13:31 +0000)]
[clang][RISCV][test] Add further test coverage for _Float16 on RISC-V

Check for size and alignment as we do for other types.

16 months ago[flang] Implement isnan and ieee_is_nan intrinsics
David Truby [Thu, 23 Feb 2023 16:24:50 +0000 (16:24 +0000)]
[flang] Implement isnan and ieee_is_nan intrinsics

To implement these we call the LLVM intrinsic is.fpclass indicating that
we are checking for either a quiet or signalling NaN.

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

16 months ago[mlir][Linalg] Improve HoistPadding to propagate through iter_args
Nicolas Vasilache [Wed, 1 Mar 2023 07:41:39 +0000 (23:41 -0800)]
[mlir][Linalg] Improve HoistPadding to propagate through iter_args

This revision properly plumbs the subsitution of a padded op through
iter_args in the case of an scf::ForOp consumer.

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

16 months ago[NFC] Fix incorrect comment in VLIW packetizer
Ben Shi [Wed, 1 Mar 2023 10:23:52 +0000 (18:23 +0800)]
[NFC] Fix incorrect comment in VLIW packetizer

Reviewed By: bcain

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

16 months ago[mlir][standalone] Enable to build as LLVM external project
Marius Brehler [Wed, 1 Mar 2023 13:14:59 +0000 (14:14 +0100)]
[mlir][standalone] Enable to build as LLVM external project

In addition to the component build, this enables the standalone example
to be build as part of a monolithic LLVM build by using the LLVM
external projects mechanism (`LLVM_EXTERNAL_PROJECTS`).

Reviewed By: stephenneuendorffer, stellaraccident

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

16 months ago[lldb/test] Update error message in debug-types-signature-loop.s
Pavel Labath [Wed, 1 Mar 2023 12:51:06 +0000 (13:51 +0100)]
[lldb/test] Update error message in debug-types-signature-loop.s

The error message changed in D144664.

16 months ago[clang-format][NFC] Refactor formatting unit tests.
Manuel Klimek [Wed, 1 Mar 2023 12:33:19 +0000 (12:33 +0000)]
[clang-format][NFC] Refactor formatting unit tests.

Pull out common base class for formatting unit tests, removing duplicate
code that accumulated over the years.

Pull out macro expansion test into its own test file.

16 months ago[AMDGPU][AsmParser][NFC] Simplify parsing cache policies.
Ivan Kosarev [Wed, 1 Mar 2023 12:01:55 +0000 (12:01 +0000)]
[AMDGPU][AsmParser][NFC] Simplify parsing cache policies.

Reviewed By: foad

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

16 months ago[mlir-reduce] Create proper tmp test files (NFC)
Christian Ulmann [Wed, 1 Mar 2023 12:05:43 +0000 (13:05 +0100)]
[mlir-reduce] Create proper tmp test files (NFC)

This commit ensures that the sh script creates temporary files with
mktmp to ensure they do not collide with existing files. The previous
behaviour caused sporadic permission issues on a multi-user system.

Reviewed By: gysit

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

16 months ago[Flang][WWW] Update Bug Reports link to point to Github issues
Kiran Chandramohan [Wed, 1 Mar 2023 10:16:46 +0000 (10:16 +0000)]
[Flang][WWW] Update Bug Reports link to point to Github issues

16 months ago[Dexter] Use non-blocking resume when debugging Visual Studio
Stephen Tozer [Tue, 28 Feb 2023 18:07:31 +0000 (18:07 +0000)]
[Dexter] Use non-blocking resume when debugging Visual Studio

The Visual Studio debugger currently uses blocking calls to Go and
StepInto, which interferes with Dexter's ability to do any processing
(e.g. checking for time outs) in between breakpoints. This patch updates
these functions to use non-blocking calls.

Reviewed By: Orlando

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

16 months ago[clang][test][RISCV] Add RISC-V to clang/test/Sema/Float16.c
Alex Bradbury [Wed, 1 Mar 2023 11:31:15 +0000 (11:31 +0000)]
[clang][test][RISCV] Add RISC-V to clang/test/Sema/Float16.c

Since D105001, HasFloat16 was unconditionally set to true for RISC-V.
This patch adds test coverage for this.

16 months ago[mlir][llvm] Make DISubprogram name optional
Christian Ulmann [Wed, 1 Mar 2023 10:08:50 +0000 (11:08 +0100)]
[mlir][llvm] Make DISubprogram name optional

This commit make the name parameter of the DISubprogramAttr optional.
LLVM will for example omit these subprogram names in initialization
functions for globals.

Reviewed By: gysit

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

16 months ago[NFC][clang] Refine tests by adding `:` to checks
Mariya Podchishchaeva [Wed, 1 Mar 2023 10:58:20 +0000 (05:58 -0500)]
[NFC][clang] Refine tests by adding `:` to checks

The tests can fail if wokring directory where the tests were launched
has a `error` substring in its path.

Reviewed By: benlangmuir

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

16 months ago[AArch64] More patterns to generate LD1R vector splats
Sjoerd Meijer [Wed, 1 Mar 2023 10:39:07 +0000 (10:39 +0000)]
[AArch64] More patterns to generate LD1R vector splats

We are missing patterns to generate vector splats using LD1R. A shuffle vector
with all 0s is a vector splat if the operands are a load and undef for which
we can generate a LD1R.

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

16 months ago[AArch64] Precommit tests to check more ld1r vector splat patterns in D145004.
Sjoerd Meijer [Wed, 1 Mar 2023 10:31:09 +0000 (10:31 +0000)]
[AArch64] Precommit tests to check more ld1r vector splat patterns in D145004.

16 months ago[mlir] Fix GreedyPatternRewriteDriver::notifyOperationModified.
Ingo Müller [Wed, 1 Mar 2023 10:10:12 +0000 (10:10 +0000)]
[mlir] Fix GreedyPatternRewriteDriver::notifyOperationModified.

The previous implementation did not notify the attached listener.

Reviewed By: springerm

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

16 months ago[flang][hlfir] Implement hlfir.declare optional codegen
Jean Perier [Wed, 1 Mar 2023 09:43:16 +0000 (10:43 +0100)]
[flang][hlfir] Implement hlfir.declare optional codegen

The hlfir fir.box with the local lower bounds and type parameters
must be generated conditionally when the entity is optional.

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

16 months ago[AArch64] Remove 64bit->128bit vector insert lowering
David Green [Wed, 1 Mar 2023 09:39:51 +0000 (09:39 +0000)]
[AArch64] Remove 64bit->128bit vector insert lowering

The AArch64 backend, during lowering, will convert an 64bit vector insert to a
128bit vector:

vector_insert %dreg, %v, %idx
=>
%qreg = insert_subvector undef, %dreg, 0
%ins = vector_insert %qreg, %v, %idx
EXTRACT_SUBREG %ins, dsub

This creates a bit of mess in the DAG, and the EXTRACT_SUBREG being a machine
nodes makes it difficult to simplify. This patch removes that, treating the
64bit vector insert as legal and handling them with extra tablegen patterns.

The end result is a simpler DAG that is easier to write tablegen patterns for.

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

16 months ago[InstCombine] Improvement the analytics through the dominating condition
Zhongyunde [Wed, 1 Mar 2023 08:59:26 +0000 (16:59 +0800)]
[InstCombine] Improvement the analytics through the dominating condition

Address the dominating condition, the urem fold is benefit from the analytics improvements.
Fix https://github.com/llvm/llvm-project/issues/60546

NOTE: delete the calls in simplifyBinaryIntrinsic and foldICmpWithDominatingICmp
is used to reduce compile time.

Reviewed By: nikic, arsenm, erikdesjardins
Differential Revision: https://reviews.llvm.org/D144248

16 months ago[LoopVectorize] Remove runtime check and scalar tail loop when tail-folding.
Sander de Smalen [Thu, 19 Jan 2023 10:29:16 +0000 (10:29 +0000)]
[LoopVectorize] Remove runtime check and scalar tail loop when tail-folding.

When using tail-folding and using the predicate for both data and control-flow
(the next vector iteration's predicate is generated with the llvm.active.lane.mask
intrinsic and then tested for the backedge), the LoopVectorizer still inserts a
runtime check to see if the 'i + VF' may at any point overflow for the given
trip-count. When it does, it falls back to a scalar epilogue loop.

We can get rid of that runtime check in the pre-header and therefore also
remove the scalar epilogue loop. This reduces code-size and avoids a runtime
check.

Consider the following loop:

  void foo(char * __restrict__ dst, char *src, unsigned long N) {
      for (unsigned long  i=0; i<N; ++i)
          dst[i] = src[i] + 42;
  }

If 'N' is e.g. ULONG_MAX, and the VF > 1, then the loop iteration counter
will overflow when calculating the predicate for the next vector iteration
at some point, because LLVM does:

  vector.ph:
    %active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)

  vector.body:
    %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
    %active.lane.mask = phi <vscale x 16 x i1> [ %active.lane.mask.entry, %vector.ph ], [ %active.lane.mask.next, %vector.body ]
    ...

    %index.next = add i64 %index, 16
      ; The add above may overflow, which would affect the lane mask and control flow. Hence a runtime check is needed.
    %active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 %index.next, i64 %N)
    %8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
    br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7

The solution:

What we can do instead is calculate the predicate before incrementing
the loop iteration counter, such that the llvm.active.lane.mask is
calculated from 'i' to 'tripcount > VF ? tripcount - VF : 0', i.e.

  vector.ph:
    %active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)
    %N_minus_VF = select %N > 16 ? %N - 16 : 0

  vector.body:
    %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
    %active.lane.mask = phi <vscale x 16 x i1> [ %active.lane.mask.entry, %vector.ph ], [ %active.lane.mask.next, %vector.body ]
    ...

    %active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 %index, i64 %N_minus_VF)
    %index.next = add i64 %index, %4
      ; The add above may still overflow, but this time the active.lane.mask is not affected
    %8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
    br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7

For N = 20, we'd then get:

  vector.ph:
    %active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)
      ; %active.lane.mask.entry = <1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
    %N_minus_VF = select 20 > 16 ? 20 - 16 : 0
      ; %N_minus_VF = 4

  vector.body: (1st iteration)
    ... ; using <1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1> as predicate in the loop
    ...
    %active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 4)
      ; %active.lane.mask.next = <1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
    %index.next = add i64 0, 16
      ; %index.next = 16
    %8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
      ; %8 = 1
    br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
      ; branch to %vector.body

  vector.body: (2nd iteration)
    ... ; using <1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> as predicate in the loop
    ...
    %active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 16, i64 4)
      ; %active.lane.mask.next = <0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
    %index.next = add i64 16, 16
      ; %index.next = 32
    %8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
      ; %8 = 0
    br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
      ; branch to %for.cond.cleanup

Reviewed By: fhahn, david-arm

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

16 months agoNFC: Use generate_test_checks script for LV tests which seem to have been auto-generated.
Sander de Smalen [Thu, 19 Jan 2023 11:50:21 +0000 (11:50 +0000)]
NFC: Use generate_test_checks script for LV tests which seem to have been auto-generated.

16 months ago[Orc] Remove LLVMInitializeCore() calls from examples
Nikita Popov [Wed, 1 Mar 2023 08:51:29 +0000 (09:51 +0100)]
[Orc] Remove LLVMInitializeCore() calls from examples

Per discussion on D144970, these are no longer necessary.

16 months ago[flang][NFC] Remove redundant and incomplete comment
Valentin Clement [Wed, 1 Mar 2023 08:51:03 +0000 (09:51 +0100)]
[flang][NFC] Remove redundant and incomplete comment

16 months ago[flang] Handle dynamic type in move_alloc
Valentin Clement [Wed, 1 Mar 2023 08:44:39 +0000 (09:44 +0100)]
[flang] Handle dynamic type in move_alloc

Update move_alloc to carry over the dyanmic type of `from` to `to`
and reset the dynamic type of `from` to its declared type when it
is polymorphic.

Reviewed By: PeteSteinfeld

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

16 months ago[MLIR][Linalg] Fix propagation for rank-zero tensor
Lorenzo Chelini [Tue, 28 Feb 2023 14:31:18 +0000 (15:31 +0100)]
[MLIR][Linalg] Fix propagation for rank-zero tensor

`isScalar` only returns true if the operand is non-shaped.
But we need to handle also rank zero tensors.

Reviewed By: hanchung

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

16 months ago[IR][Legalization] Split illegal deinterleave and interleave vectors
Caroline Concatto [Tue, 28 Feb 2023 17:40:00 +0000 (17:40 +0000)]
[IR][Legalization] Split illegal deinterleave and interleave vectors

To make legalization easier, the operands and outputs have the same size for
these ISD Nodes. When legalizing the results in SplitVectorResult the operands
are legalized to the same size as the outputs.
The ISD Node has two output/results, therefore the legalizing functions update
both results/outputs.

Reviewed By: craig.topper

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

16 months ago[mlir][llvm] Add AliasAnalysis and AccessGroup interfaces.
Tobias Gysi [Wed, 1 Mar 2023 08:15:37 +0000 (09:15 +0100)]
[mlir][llvm] Add AliasAnalysis and AccessGroup interfaces.

The revision introduces two interfaces that provide access to
the alias analysis and access group metadata attributes. The
AliasAnalysis interface combines all alias analysis related
attributes (alias, noalias, and tbaa) similar to LLVM's getAAMetadata
method, while the AccessGroup interface is dedicated to the
access group metadata.

Previously, only the load and store operations supported alias analysis
and access group metadata. This revision extends this support to the
atomic operations. A follow up revision will also add support for the
memcopy, memset, and memove intrinsics. The interfaces then provide
convenient access to the metadata attributes and eliminate the need
of TypeSwitch or string based attribute access.

The revision still relies on string based attribute access for
the translation to LLVM IR (except for tbaa metadata). Only once
the the memory access intrinsics also implement the new interfaces,
the translation to LLVM IR can be fully switched to use interface
based attribute accesses.

Depends on D144875

Reviewed By: ftynse

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

16 months ago[clang][ASTImporter] Improve import of InjectedClassNameType.
Balázs Kéri [Wed, 1 Mar 2023 07:42:32 +0000 (08:42 +0100)]
[clang][ASTImporter] Improve import of InjectedClassNameType.

During AST import multiple different InjectedClassNameType objects
could be created for a single class template. This can cause problems
and failed assertions when these types are compared and found to be
not the same (because the instance is different and there is no
canonical type).
The import of this type does not use the factory method in ASTContext,
probably because the preconditions are not fulfilled at that state.
The fix tries to make the code in ASTImporter work more like the code
in ASTContext::getInjectedClassNameType. If a type is stored at the
Decl or previous Decl object, it is reused instead of creating a new
one. This avoids crash at least a part of the cases.

Reviewed By: gamesh411, donat.nagy, vabridgers

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