platform/upstream/llvm.git
2 years agoRevert "Fix UB in DwarfExpression::emitLegacyZExt()"
Adrian Prantl [Wed, 26 Jan 2022 20:46:07 +0000 (12:46 -0800)]
Revert "Fix UB in DwarfExpression::emitLegacyZExt()"

This reverts commit 216002c4bb708e6d6fd1895c8ea636470961f824
while investigating bot breakage.

2 years agoAMDGPU/GlobalISel: Fold wave address into mubuf addressing modes
Matt Arsenault [Wed, 12 Jan 2022 17:02:40 +0000 (12:02 -0500)]
AMDGPU/GlobalISel: Fold wave address into mubuf addressing modes

2 years agoGlobalISel: Avoid crash on asm with lying result types
Matt Arsenault [Wed, 19 Jan 2022 22:23:57 +0000 (17:23 -0500)]
GlobalISel: Avoid crash on asm with lying result types

The physical register in the asm has the wrong type for the declared
IR. It seems to work in the DAG by extracting the 4 elements that are
defined in the IR from the register, but that isn't handled here. This
doesn't seem to be a well tested path since other mismatched cases are
crashing the DAG asm handling.

2 years ago[libcxx][test] Narrow XFAIL for tests that pass with `msvc && stdlib=msvc`
Casey Carter [Tue, 4 Jan 2022 01:01:16 +0000 (17:01 -0800)]
[libcxx][test] Narrow XFAIL for tests that pass with `msvc && stdlib=msvc`

... but fail with `msvc && stdlib=libc++`.

Differential Review: https://reviews.llvm.org/D118194

2 years ago[libcxx] [test] Fix the locale.time.put.byname/put1 testcase on Linux and Windows
Martin Storsjö [Sun, 23 Jan 2022 23:16:46 +0000 (23:16 +0000)]
[libcxx] [test] Fix the locale.time.put.byname/put1 testcase on Linux and Windows

The Windows and Glibc abbreviated form of Saturday in French locale
is "sam." with a trailing period included. Account for this in the
test reference.

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

2 years agoAMDGPU/GlobalISel: Mostly fix BFI patterns
Matt Arsenault [Wed, 19 Jan 2022 17:36:39 +0000 (12:36 -0500)]
AMDGPU/GlobalISel: Mostly fix BFI patterns

Most importantly, fixes constant bus errors in the 64-bit cases. It's
surprising to me these were even passing the selection test using
SReg_* sources. Also fixes pattern matching in the 32-bit cases, with
simple operands.

These patterns aren't working in a few cases, like with mixed SGPR
inputs. The patterns aren't looking through the SGPR->VGPR copies like
they need to. The vector cases also have some unmerges of build_vector
which are obscuring the inputs.

2 years agoAMDGPU: Add some additional test coverage for BFI matching
Matt Arsenault [Wed, 19 Jan 2022 18:45:30 +0000 (13:45 -0500)]
AMDGPU: Add some additional test coverage for BFI matching

Try to stress constant bus restriction enforcement since some of these
are broken for GlobalISel. Split the r600 test because some of these
cases don't compile (and all the ones using return values are
discarded).

2 years agoAMDGPU: Switch bfi pattern test to generated checks and add gfx10
Matt Arsenault [Wed, 19 Jan 2022 18:21:58 +0000 (13:21 -0500)]
AMDGPU: Switch bfi pattern test to generated checks and add gfx10

2 years ago[mlir] Move std.generic_atomic_rmw to the memref dialect
River Riddle [Wed, 26 Jan 2022 02:41:02 +0000 (18:41 -0800)]
[mlir] Move std.generic_atomic_rmw to the memref dialect

This is part of splitting up the standard dialect. The move makes sense anyways,
given that the memref dialect already holds memref.atomic_rmw which is the non-region
sibling operation of std.generic_atomic_rmw (the relationship is even more clear given
they have nearly the same description % how they represent the inner computation).

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

2 years ago[mlir] Move the complex support of std.constant to a new complex.constant operation
River Riddle [Tue, 25 Jan 2022 21:20:01 +0000 (13:20 -0800)]
[mlir] Move the complex support of std.constant to a new complex.constant operation

This is part of splitting up the standard dialect.

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

2 years ago[mlir:GPU] Replace reference to LLVMFuncOp with FuncOpInterface
River Riddle [Tue, 25 Jan 2022 20:00:46 +0000 (12:00 -0800)]
[mlir:GPU] Replace reference to LLVMFuncOp with FuncOpInterface

The GPU dialect currently contains an explicit reference to  LLVMFuncOp
during verification to handle the situation where the kernel has already been
converted. This commit changes that reference to instead use FunctionOpInterface,
which has two main benefits:

* It allows for removing an otherwise unnecessary dependency on the LLVM dialect
* It removes hardcoded assumptions about the lowering path and use of the GPU dialect

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

2 years ago[clang] Fix -Wsubobject-linkage after D117262
Arthur Eubanks [Wed, 26 Jan 2022 19:41:47 +0000 (11:41 -0800)]
[clang] Fix -Wsubobject-linkage after D117262

/home/buildbot/llvm-avr-linux/llvm-avr-linux/llvm/clang/lib/CodeGen/Address.h:76:7: warning: 'clang::CodeGen::Address' has a field 'clang::CodeGen::Address::A' whose type uses the anonymous namespace [-Wsubobject-linkage]

https://lab.llvm.org/buildbot/#/builders/112/builds/12047

2 years ago[lldb/API] Add ability to check if module is backed by a file on disk
Med Ismail Bennani [Wed, 26 Jan 2022 19:40:24 +0000 (20:40 +0100)]
[lldb/API] Add ability to check if module is backed by a file on disk

This patch introduces a new SBAPI method: `SBModule::IsFileBacked`

As the name suggests, it tells the user if the module's object file is
on disk or in memory.

rdar://68538278

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[InstrProf][Correlate] Improve error messages
Ellis Hoag [Tue, 25 Jan 2022 20:35:23 +0000 (12:35 -0800)]
[InstrProf][Correlate] Improve error messages

Improve the error messages when using `llvm-profdata` to correlate profiles with debug info.

Reviewed By: kyulee, phosek

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

2 years ago[clang] Add an extract-api driver option
Zixu Wang [Thu, 20 Jan 2022 18:30:56 +0000 (10:30 -0800)]
[clang] Add an extract-api driver option

This is the initial commit for the clang-extract-api RFC
<https://lists.llvm.org/pipermail/cfe-dev/2021-September/068768.html>
Add a new driver option `-extract-api` and associate it with a dummy
(for now) frontend action to set up the initial structure for
incremental works.

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

2 years ago[openmp] Disable build of old runtimes by default
Jon Chesterfield [Wed, 26 Jan 2022 19:17:30 +0000 (19:17 +0000)]
[openmp] Disable build of old runtimes by default

The old runtime is not tested by CI. Disable the build prior to the llvm-14 branch.

Reviewed By: jdoerfert

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

2 years ago[RISCV] Remove references to 'B' extension from AssemblerPredicate and SubtargetFeatu...
Craig Topper [Wed, 26 Jan 2022 18:35:53 +0000 (10:35 -0800)]
[RISCV] Remove references to 'B' extension from AssemblerPredicate and SubtargetFeature strings.

For Zba/Zbb/Zbc/Zbs I've removed the 'B' completely and used the
extension names as presented at the start of Chapter 1 of the
1.0.0 Bitmanipulation spec.

For the unratified extensions, I've replaced 'B' with 'Zb' and
otherwise left them unchanged.

Reviewed By: asb

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

2 years agoInitialize terminfo.bzl linkopts to None
jonmeow [Wed, 26 Jan 2022 19:02:20 +0000 (11:02 -0800)]
Initialize terminfo.bzl linkopts to None

The underlying issue here is that line 125 checks if linkopts was assigned (by line 120) but it's not initialized, so that becomes a crash. This was noticed by someone trying to use Docker, so no terminfo library installed.

Reviewed By: GMNGeoffrey

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

2 years agoFix UB in DwarfExpression::emitLegacyZExt()
Adrian Prantl [Tue, 25 Jan 2022 21:29:22 +0000 (13:29 -0800)]
Fix UB in DwarfExpression::emitLegacyZExt()

A shift-left > 63 triggers a UBSAN failure. This patch kicks the can
down the road (to the consumer) by emitting a more compact
representation of the shift computation in DWARF expressions.

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

2 years agoAMDGPU: Emit user sgpr count directives in text asm
Matt Arsenault [Fri, 21 Jan 2022 21:23:09 +0000 (16:23 -0500)]
AMDGPU: Emit user sgpr count directives in text asm

We were emitting these in the object file but not printing them.

2 years ago[NFC] Store Address's alignment into PointerIntPairs
Arthur Eubanks [Fri, 14 Jan 2022 00:30:29 +0000 (16:30 -0800)]
[NFC] Store Address's alignment into PointerIntPairs

This mitigates the extra memory caused by D115725.

On 32-bit arches where we only have 2 bits per PointerIntPair we fall
back to simply storing alignment separately.

Reviewed By: rnk, nikic

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

2 years ago[test][ASan][Win] Print more info when LoadLibrary fails
Arthur Eubanks [Wed, 26 Jan 2022 01:46:29 +0000 (17:46 -0800)]
[test][ASan][Win] Print more info when LoadLibrary fails

Reviewed By: hans

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

2 years ago[gn build] Make HAVE_MALLINFO2 a gn arg, default to false
Arthur Eubanks [Wed, 26 Jan 2022 17:43:44 +0000 (09:43 -0800)]
[gn build] Make HAVE_MALLINFO2 a gn arg, default to false

D117916 broke some people because some distros are still using a glibc
older than 2.33. Add gn arg llvm_have_mallinfo2 and default to false for
now.

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

2 years ago[ELF] Simplify writing the Elf_Chdr header. NFC
Fangrui Song [Wed, 26 Jan 2022 18:23:56 +0000 (10:23 -0800)]
[ELF] Simplify writing the Elf_Chdr header. NFC

And avoiding changing `size` in `writeTo`.

2 years ago[gn build] Manually port D118110
Arthur Eubanks [Wed, 26 Jan 2022 17:49:21 +0000 (09:49 -0800)]
[gn build] Manually port D118110

2 years ago[AMDGPU] SILoadStoreOptimizer: Precommit tests for merging across a swizzled access
Jay Foad [Wed, 26 Jan 2022 17:09:29 +0000 (17:09 +0000)]
[AMDGPU] SILoadStoreOptimizer: Precommit tests for merging across a swizzled access

2 years ago[Bazel] Update config.h to add the new define.
Adrian Kuegel [Wed, 26 Jan 2022 17:28:14 +0000 (18:28 +0100)]
[Bazel] Update config.h to add the new define.

2 years ago[clang][dataflow] Allow clients to disable built-in transfer functions.
Yitzhak Mandelbaum [Tue, 25 Jan 2022 20:36:14 +0000 (20:36 +0000)]
[clang][dataflow] Allow clients to disable built-in transfer functions.

These built-in functions build the (sophisticated) model of the code's
memory. This model isn't used by all analyses, so we provide for disabling it to
avoid incurring the costs associated with its construction.

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

2 years ago[clang] NFC: Use flush() idiomatically
Kirill Bobyrev [Wed, 26 Jan 2022 17:24:37 +0000 (18:24 +0100)]
[clang] NFC: Use flush() idiomatically

Using both `raw_ostream::flush()` and `raw_ostream::str()` consecutively is
redundant. The alternatives are:

- Use `raw_ostream::str()` without `raw_ostream::flush()`
- Use `raw_ostream::flush()` and then use the destination for `raw_ostream`
  writer

The latter is more idiomatic, so the fix resolves this particular case in its
favor.

Reviewed By: kadircet

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

2 years ago[lldb] Remove ConstString::StaticMemorySize
Jonas Devlieghere [Wed, 26 Jan 2022 17:10:50 +0000 (09:10 -0800)]
[lldb] Remove ConstString::StaticMemorySize

Remove ConstString::StaticMemorySize as it is unused and superseded by
GetMemoryStats. It is referenced in a bunch of doc comments but I don't
really understand why. My best guess it that the comments were
copy-pasted from ConstString::MemorySize() even though it didn't make
sense there either. The implementation of StaticMemorySize was being
called on the MemoryPool, not on the ConstString itself.

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

2 years ago[DebugInfo] Add stringLocationExp field to DIStringType
Chih-Ping Chen [Tue, 18 Jan 2022 19:54:01 +0000 (14:54 -0500)]
[DebugInfo] Add stringLocationExp field to DIStringType

DIStringType is used to encode the debug info of a character object
in Fortran. A Fortran deferred-length character object is typically
implemented as a pair of the following two pieces of info: An address
of the raw storage of the characters, and the length of the object.
The stringLocationExp field contains the DIExpression to get to the
raw storage.

This patch also enables the emission of DW_AT_data_location attribute
in a DW_TAG_string_type debug info entry based on stringLocationExp
in DIStringType.

A test is also added to ensure that the bitcode reader is backward
compatible with the old DIStringType format.

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

2 years ago[AMDGPU][SIWholeQuadMode] Use the right VCC register to activate the correct lanes.
Konstantina [Tue, 25 Jan 2022 04:10:20 +0000 (20:10 -0800)]
[AMDGPU][SIWholeQuadMode] Use the right VCC register to activate the correct lanes.

Reviewed By: critson

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

2 years ago[CMake] [Clang] Add option to specify PowerPC long double format
Qiu Chaofan [Wed, 26 Jan 2022 16:49:17 +0000 (00:49 +0800)]
[CMake] [Clang] Add option to specify PowerPC long double format

This method introduces new CMake variable
PPC_LINUX_DEFAULT_IEEELONGDOUBLE (false by default) to enable fp128 as
default long double format.

Reviewed By: jsji

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

2 years ago[AMDGPU] Remove feature register-banking
Stanislav Mekhanoshin [Tue, 25 Jan 2022 22:17:04 +0000 (14:17 -0800)]
[AMDGPU] Remove feature register-banking

Since RegBankReassign pass was removed this feature is not
use for anything.

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

2 years agoFIx typo in comment
Alex Tsao [Wed, 26 Jan 2022 16:32:32 +0000 (22:02 +0530)]
FIx typo in comment

Reviewed By: xgupta

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

2 years ago[AArch64] Add float vector compare/select cost-model tests.
Florian Hahn [Wed, 26 Jan 2022 16:26:19 +0000 (16:26 +0000)]
[AArch64] Add float vector compare/select cost-model tests.

2 years ago[lldb] Fix a couple of use-of-uninit-var errors in Materializer.cpp
Pavel Labath [Wed, 26 Jan 2022 15:46:19 +0000 (16:46 +0100)]
[lldb] Fix a couple of use-of-uninit-var errors in Materializer.cpp

These were probably not picked up before because they only run when
logging is enabled.

2 years agoRevert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17"
Benjamin Kramer [Wed, 26 Jan 2022 15:55:53 +0000 (16:55 +0100)]
Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17"

This reverts commit ef8206320769ad31422a803a0d6de6077fd231d2.

- It conflicts with the existing llvm::size in STLExtras, which will now
  never be called.
- Calling it without llvm:: breaks C++17 compat

2 years agoFix ambiguous call to llvm::size introduced in ef8206320769ad31422
serge-sans-paille [Wed, 26 Jan 2022 15:53:38 +0000 (16:53 +0100)]
Fix ambiguous call to llvm::size introduced in ef8206320769ad31422

2 years ago[clang][dataflow] Add a transfer function for CXXBoolLiteralExpr
Stanislav Gatev [Wed, 26 Jan 2022 12:10:38 +0000 (12:10 +0000)]
[clang][dataflow] Add a transfer function for CXXBoolLiteralExpr

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D118236

2 years ago[NFC][ORC][AArch64] use isInt<N> to replace fitsRangeSignedInt on aarch64
dongAxis [Wed, 26 Jan 2022 15:22:09 +0000 (23:22 +0800)]
[NFC][ORC][AArch64] use isInt<N> to replace fitsRangeSignedInt on aarch64

Summary:
This is the first path to support more relocation types on aarch64.
 The patch just uses the isInt<N> to replace fitsRangeSignedInt.

Test Plan:
check-all

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

2 years ago[SDAG] fix bug in ComputeNumSignBits of target constant
Sanjay Patel [Wed, 26 Jan 2022 14:59:51 +0000 (09:59 -0500)]
[SDAG] fix bug in ComputeNumSignBits of target constant

The loop below the changed line assumes that the element
width of the target constant is the same as the element
width of the loaded value, but that is not always true.

We could try harder to do some kind of min/max calc even
if the sizes don't match, but that can be another patch
if needed. This fixes #53401 (miscompile) and does not
change the motivating cases added when this analysis
was introduced:
ad298f86b7ad2a

2 years ago[x86] add test for miscompile from wrong min signbits ( #53401 ); NFC
Sanjay Patel [Wed, 26 Jan 2022 14:55:17 +0000 (09:55 -0500)]
[x86] add test for miscompile from wrong min signbits ( #53401 ); NFC

2 years agoRename llvm::array_lengthof into llvm::size to match std::size from C++17
serge-sans-paille [Wed, 26 Jan 2022 15:11:12 +0000 (10:11 -0500)]
Rename llvm::array_lengthof into llvm::size to match std::size from C++17

As a conquence move llvm::array_lengthof from STLExtras.h to
STLForwardCompat.h (which is included by STLExtras.h so no build
breakage expected).

2 years ago[X86] Add 'getSplitVectorSrc' helper to determine if subvectors all come from the...
Simon Pilgrim [Wed, 26 Jan 2022 15:17:09 +0000 (15:17 +0000)]
[X86] Add 'getSplitVectorSrc' helper to determine if subvectors all come from the same source

Helps determine if the subvector ops come from the same larger vector and match the lower/upper extractions

2 years ago[AMDGPUEmitPrintf] Don't require specific pointer element type
Nikita Popov [Wed, 26 Jan 2022 15:15:09 +0000 (16:15 +0100)]
[AMDGPUEmitPrintf] Don't require specific pointer element type

Rather than checking for i8*, simply add a bitcast to i8*, so the
appendString() code sees the expected type.

2 years ago[clang-format] Correctly format lambdas with variadic template parameters.
Marek Kurdej [Wed, 26 Jan 2022 15:00:26 +0000 (16:00 +0100)]
[clang-format] Correctly format lambdas with variadic template parameters.

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

Reviewed By: MyDeveloperDay, owenpan

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

2 years ago[clang][DeclPrinter] Fix printing for noexcept expressions
Kadir Cetinkaya [Wed, 26 Jan 2022 13:50:40 +0000 (14:50 +0100)]
[clang][DeclPrinter] Fix printing for noexcept expressions

We are already building into the final result, no need to append it
again.

Fixes https://github.com/clangd/vscode-clangd/issues/290.

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

2 years ago[mlir][bufferization] Add an option to use memref types without layout maps
Matthias Springer [Wed, 26 Jan 2022 14:53:55 +0000 (23:53 +0900)]
[mlir][bufferization] Add an option to use memref types without layout maps

This is for compatibility with existing bufferization passes. Also clean up memref type generation a bit.

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

2 years ago[Visualizers] Fix SmallVector<T> visualizer for T inside an anonymous namespace....
Marek Kurdej [Wed, 26 Jan 2022 14:59:21 +0000 (15:59 +0100)]
[Visualizers] Fix SmallVector<T> visualizer for T inside an anonymous namespace. Use `value_type` instead of `$T1`.

At least on MSVC 2022, using $T1 does not work.

Reviewed By: RKSimon

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

2 years ago[PowerPC] Fix eq/ne comparison of v2i64 pre-Power8
Nemanja Ivanovic [Mon, 24 Jan 2022 19:19:20 +0000 (13:19 -0600)]
[PowerPC] Fix eq/ne comparison of v2i64 pre-Power8

In commit 1674d9b6b2da, I fixed the bug where we didn't consider
both words of the result of the comparison. However, the logic
needs to be different for eq and ne.
Namely for eq, we need both words of the doubleword to equal so it
is an AND. OTOH for ne, we need either word to be unequal so it
is an OR.

2 years ago[NVPTX] NFC: Remove unused arguments and attribute from test
Christian Sigg [Wed, 26 Jan 2022 14:52:25 +0000 (15:52 +0100)]
[NVPTX] NFC: Remove unused arguments and attribute from test

2 years ago[clang][lex] Include tracking: simplify and move to preprocessor
Jan Svoboda [Wed, 26 Jan 2022 14:20:19 +0000 (15:20 +0100)]
[clang][lex] Include tracking: simplify and move to preprocessor

This patch replaces the exact include count of each file in `HeaderFileInfo` with a set of included files in `Preprocessor`.

The number of includes isn't a property of a header file but rather a preprocessor state. The exact number of includes is not used anywhere except statistic tracking.

Reviewed By: vsapsai

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

2 years ago[CodeCompletion][clangd] Clean __uglified parameter names in completion & hover
Sam McCall [Thu, 30 Dec 2021 00:57:47 +0000 (01:57 +0100)]
[CodeCompletion][clangd] Clean __uglified parameter names in completion & hover

Underscore-uglified identifiers are used in standard library implementations to
guard against collisions with macros, and they hurt readability considerably.
(Consider `push_back(Tp_ &&__value)` vs `push_back(Tp value)`.
When we're describing an interface, the exact names of parameters are not
critical so we can drop these prefixes.

This patch adds a new PrintingPolicy flag that can applies this stripping
when recursively printing pieces of AST.
We set it in code completion/signature help, and in clangd's hover display.
All three features also do a bit of manual poking at names, so fix up those too.

Fixes https://github.com/clangd/clangd/issues/736

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

2 years ago[AMDGPUHSAMetadataStreamer] Do not assume ABI alignment for pointers
Nikita Popov [Wed, 26 Jan 2022 09:53:21 +0000 (10:53 +0100)]
[AMDGPUHSAMetadataStreamer] Do not assume ABI alignment for pointers

AMDGPUHSAMetadataStreamer currently assumes that pointer arguments
without align attribute have ABI alignment of the pointee type.
This is incompatible with opaque pointers, but also plain incorrect:
Pointer arguments without explicit alignment have alignment 1. It is
the responsibility of the frontent to add correct align annotations.

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

2 years ago[lldb] Add option to show memory tags in memory read output
David Spickett [Fri, 29 Oct 2021 15:11:14 +0000 (16:11 +0100)]
[lldb] Add option to show memory tags in memory read output

This adds an option --show-tags to "memory read".

(lldb) memory read mte_buf mte_buf+32 -f "x" -s8 --show-tags
0x900fffff7ff8000: 0x0000000000000000 0x0000000000000000 (tag: 0x0)
0x900fffff7ff8010: 0x0000000000000000 0x0000000000000000 (tag: 0x1)

Tags are printed on the end of each line, if that
line has any tags associated with it. Meaning that
untagged memory output is unchanged.

Tags are printed based on the granule(s) of memory that
a line covers. So you may have lines with 1 tag, with many
tags, no tags or partially tagged lines.

In the case of partially tagged lines, untagged granules
will show "<no tag>" so that the ordering is obvious.
For example, a line that covers 2 granules where the first
is not tagged:

(lldb) memory read mte_buf-16 mte_buf+16 -l32 -f"x" --show-tags
0x900fffff7ff7ff0: 0x00000000 <...> (tags: <no tag> 0x0)

Untagged lines will just not have the "(tags: ..." at all.
Though they may be part of a larger output that does have
some tagged lines.

To do this I've extended DumpDataExtractor to also print
memory tags where it has a valid execution context and
is asked to print them.

There are no special alignment requirements, simply
use "memory read" as usual. All alignment is handled
in DumpDataExtractor.

We use MakeTaggedRanges to find all the tagged memory
in the current dump, then read all that into a MemoryTagMap.

The tag map is populated once in DumpDataExtractor and re-used
for each subsequently printed line (or recursive call of
DumpDataExtractor, which some formats do).

Reviewed By: omjavaid

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

2 years ago[SCEVExpander] Always use i8 GEP for reused value offset
Nikita Popov [Wed, 26 Jan 2022 14:32:11 +0000 (15:32 +0100)]
[SCEVExpander] Always use i8 GEP for reused value offset

We could keep the non-i8 GEP code for non-opaque pointers, but
there's two reasons I'm dropping it: First, this actually appears
to be dead code, at least it isn't hit in any of our tests. I
expect that this is because we usually expand trip counts, and
those are never pointers (anymore). Second, the non-i8 GEP was
actually incorrect in multiple ways, because it used SCEV type
sizes, which don't match DL type sizes (for pointers) and certainly
don't match type alloc sizes (which is what GEPs actually use).
As such, I'm simplifying the code to always use the i8 GEP code
path if it does get hit.

2 years agoImplement correct cost for SVE bitcasts
Alban Bridonneau [Wed, 26 Jan 2022 13:33:38 +0000 (13:33 +0000)]
Implement correct cost for SVE bitcasts

We have some bitcasts which we know will be simplified,
so their cost is zero.

Reviewed By: david-arm, sdesmalen

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

2 years ago[CMake] Disable mvsc warning for new versions
Sebastian Neubauer [Mon, 24 Jan 2022 19:39:54 +0000 (20:39 +0100)]
[CMake] Disable mvsc warning for new versions

Starting with VS 2019, CMake defaults to the x64 host toolchain, so the
warning does not apply anymore.

References:
VS 2017 defaults to x86
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html?highlight=host#toolset-selection
VS 2019 and 2022 default to x64 for x64 targets
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html?highlight=host#toolset-selection
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html?highlight=host#toolset-selection

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

2 years ago[lldb] Correct \params to \param in StackFrame Doxygen comments
David Spickett [Wed, 26 Jan 2022 13:41:03 +0000 (13:41 +0000)]
[lldb] Correct \params to \param in StackFrame Doxygen comments

2 years ago[lldb] Correct some uses of \b in Doxygen documentation
David Spickett [Wed, 26 Jan 2022 13:35:47 +0000 (13:35 +0000)]
[lldb] Correct some uses of \b in Doxygen documentation

2 years ago[SystemZ][z/OS] Add AutoConvert.h header to MemoryBuffer.cpp
Abhina Sreeskantharajan [Wed, 26 Jan 2022 14:01:28 +0000 (09:01 -0500)]
[SystemZ][z/OS] Add AutoConvert.h header to MemoryBuffer.cpp

This commit https://github.com/llvm/llvm-project/commit/75e164f61d391979b4829bf2746a5d74b94e95f2 removed the AutoConvert.h header causing a build break on z/OS. This patch adds it back to fix it.

Reviewed By: zibi

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

2 years ago[gn build] Port 37c4bd0fdbc6
LLVM GN Syncbot [Wed, 26 Jan 2022 13:56:09 +0000 (13:56 +0000)]
[gn build] Port 37c4bd0fdbc6

2 years ago[lldb] Add MemoryTagMap class
David Spickett [Fri, 29 Oct 2021 15:10:36 +0000 (16:10 +0100)]
[lldb] Add MemoryTagMap class

The tag map holds a sparse set of memory tags and allows
you to query ranges for tags.

Granules that do not have tags will be set to llvm::None.
to keep the ordering intact. If there are no tags for the
requested range we'll just return an empty result so that
callers don't need to check that all values are llvm::None.

This will be combined with MemoryTagManager's MakeTaggedRanges:
* MakeTaggedRanges
* Read from all those ranges
* Insert the results into the tag map
* Give the tag map to whatever needs to print tags

Which in this case will be "memory read"/DumpDataExtractor.

Reviewed By: JDevlieghere

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

2 years ago[DSE] Add test with sret argument (NFC)
Nikita Popov [Wed, 26 Jan 2022 13:25:05 +0000 (14:25 +0100)]
[DSE] Add test with sret argument (NFC)

2 years agoCleanup LLVMTextAPI headers
serge-sans-paille [Wed, 26 Jan 2022 13:02:49 +0000 (08:02 -0500)]
Cleanup LLVMTextAPI headers

Based on the output of iwyu. A full rebuild of llvm-project doesn't exhibit any
significant false dependencies.

The impact on preprocessed output is larger than expected, given the small
amount of changes

$ clang++ -E  -Iinclude -I../llvm/include ../llvm/lib/TextAPI/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 635319
After: 643716

Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup

2 years agoRewrite Doxygen comment to resolve -Wdocumentation warning (NFC)
Salman Javed [Wed, 26 Jan 2022 12:30:38 +0000 (01:30 +1300)]
Rewrite Doxygen comment to resolve -Wdocumentation warning (NFC)

Comment change only, no functional change intended.
Example of warning:
https://lab.llvm.org/buildbot/#/builders/188/builds/8696/steps/4/logs/warnings__2_

2 years ago[VE] Packed 32/64bit broadcast isel and tests
Simon Moll [Wed, 26 Jan 2022 09:32:26 +0000 (10:32 +0100)]
[VE] Packed 32/64bit broadcast isel and tests

Packed-mode broadcast of f32/i32 requires the subregister to be
replicated to the full I64 register prior. Add repl_i32 and repl_f32 to
faciliate this.

Reviewed By: kaz7

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

2 years agoFix conditional include in ThreadPool
serge-sans-paille [Wed, 26 Jan 2022 13:15:14 +0000 (14:15 +0100)]
Fix conditional include in ThreadPool

Should fix  https://lab.llvm.org/buildbot#builders/37/builds/10259

2 years ago[DSE] Use helper for unwind check (NFCI)
Nikita Popov [Wed, 26 Jan 2022 12:08:39 +0000 (13:08 +0100)]
[DSE] Use helper for unwind check (NFCI)

This should be no functional change, as the cases supported by the
helper and the cases supported by DSE are currently the same, the
code structure is just slightly different.

2 years ago[AArch64] Add NEON test cases for ISD::ABDS/U.
Paul Walker [Wed, 26 Jan 2022 12:55:15 +0000 (12:55 +0000)]
[AArch64] Add NEON test cases for ISD::ABDS/U.

2 years ago[flang][tco] Remove unneeded dependencies
Andrzej Warzynski [Tue, 25 Jan 2022 09:42:35 +0000 (09:42 +0000)]
[flang][tco] Remove unneeded dependencies

`tco` does not generate machine code, so it does not require (machine)
code-gen related dependencies.

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

2 years ago[demangler] refactor SpecialSubKind
Nathan Sidwell [Mon, 24 Jan 2022 15:59:57 +0000 (07:59 -0800)]
[demangler] refactor SpecialSubKind

Code generating the special substitutions in std is a switch statement
with each case block containing the same conststruction template.  It
is more efficient to commonize that after the switch, having
determined which SubKind to create.  Also, let's sort the cases.

Reviewed By: ChuanqiXu

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

2 years ago[demangler] improve test harness
Nathan Sidwell [Mon, 24 Jan 2022 19:07:29 +0000 (11:07 -0800)]
[demangler] improve test harness

The demangler test harness is a little unclear.  The failed demangling
message always causes me to think about 'reality', changing to a
simple 'Found' seems clearer.

The expected-to-fail tests abort as soon as one passes, rather than
continue, and then abort if any passed.  This changes that loop to
fail at the end, in a similar manner to the expected-to-work loop.

Reviewed By: ChuanqiXu

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

2 years agoCleanup headers for BinaryFormat
serge-sans-paille [Wed, 26 Jan 2022 11:22:41 +0000 (06:22 -0500)]
Cleanup headers for BinaryFormat

A few header removal, some forward declarations. As usual, this can
break your build due to false dependencies, the most notable change are:

- "llvm/BinaryFormat/AMDGPUMetadataVerifier.h" no longer includes "llvm/BinaryFormat/MsgPackDocument.h"

The impact on generated preprocessed lines for LLVMBinaryFormat is
pretty nice:

$ clang++ -E  -Iinclude -I../llvm/include ../llvm/lib/BinaryFormat/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before this patch: 705281
after this patch: 751456

Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup

2 years ago[mlir][LLVM] Add support for operand_attrs to InlineAsmOp
Nicolas Vasilache [Wed, 26 Jan 2022 10:57:09 +0000 (05:57 -0500)]
[mlir][LLVM] Add support for operand_attrs to InlineAsmOp

This revision adds enough support to allow InlineAsmOp to work properly with indirect memory constraints "*m".
These require an explicit "elementtype" TypeAttr on the operands to pass LLVM verification and need to be provided.

Reviewed By: bkramer

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

2 years ago[X86] Extend PR53419 test coverage
Simon Pilgrim [Wed, 26 Jan 2022 12:32:38 +0000 (12:32 +0000)]
[X86] Extend PR53419 test coverage

Test on SSE2/SSE41/AVX1 targets to compare PMOVMSK vs PTEST codegen paths

Add v8i8 reduction case and test on X64 and X86 targets to check 32-bit handling

2 years ago[AMDGPU] Enable divergence-driven XNOR selection
alex-t [Fri, 24 Dec 2021 14:40:49 +0000 (17:40 +0300)]
[AMDGPU] Enable divergence-driven XNOR selection

Currently not (xor_one_use) pattern is always selected to S_XNOR irrelative od the node divergence.
This relies on further custom selection pass which converts to VALU if necessary and replaces with V_NOT_B32 ( V_XOR_B32)
on those targets which have no V_XNOR.
Current change enables the patterns which explicitly select the not (xor_one_use) to appropriate form.
We assume that xor (not) is already turned into the not (xor) by the combiner.

Reviewed By: rampitec

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

2 years ago[gn build] Port 5da7c040030c
LLVM GN Syncbot [Wed, 26 Jan 2022 12:14:21 +0000 (12:14 +0000)]
[gn build] Port 5da7c040030c

2 years ago[lldb] Convert POSIXLog to use the new API
Pavel Labath [Wed, 26 Jan 2022 12:02:48 +0000 (13:02 +0100)]
[lldb] Convert POSIXLog to use the new API

2 years ago[SVE] Use DUPM to handling more splat immediate cases.
Paul Walker [Mon, 24 Jan 2022 12:35:18 +0000 (12:35 +0000)]
[SVE] Use DUPM to handling more splat immediate cases.

NOTE: Only considers i64 based vectors at this time because smaller
element types require extra isel operand parsing.

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

2 years agoRe-land "Cache the locations of NOLINTBEGIN/END blocks" with fix for build bot
Salman Javed [Wed, 26 Jan 2022 12:02:35 +0000 (01:02 +1300)]
Re-land "Cache the locations of NOLINTBEGIN/END blocks" with fix for build bot

2 years ago[gn build] Port 8e29d19b8d29
LLVM GN Syncbot [Wed, 26 Jan 2022 11:52:58 +0000 (11:52 +0000)]
[gn build] Port 8e29d19b8d29

2 years agoRevert "[clang-tidy] Cache the locations of NOLINTBEGIN/END blocks"
Salman Javed [Wed, 26 Jan 2022 11:52:25 +0000 (00:52 +1300)]
Revert "[clang-tidy] Cache the locations of NOLINTBEGIN/END blocks"

Build warning here:
https://lab.llvm.org/buildbot/#/builders/57/builds/14322

2 years ago[gn build] Port 19eaad94c47f
LLVM GN Syncbot [Wed, 26 Jan 2022 11:47:14 +0000 (11:47 +0000)]
[gn build] Port 19eaad94c47f

2 years ago[MemCpyOpt] Use helper for unwind check
Nikita Popov [Wed, 26 Jan 2022 10:27:44 +0000 (11:27 +0100)]
[MemCpyOpt] Use helper for unwind check

This extends support to byval arguments. It would be further
extended to handle the case of non-captured noalias returns.

2 years ago[clang][dataflow] Enable merging distinct values in Environment::join
Stanislav Gatev [Mon, 24 Jan 2022 13:29:06 +0000 (13:29 +0000)]
[clang][dataflow] Enable merging distinct values in Environment::join

Make specializations of `DataflowAnalysis` extendable with domain-specific
logic for merging distinct values when joining environments. This could be
a strict lattice join or a more general widening operation.

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D118038

2 years ago[Dexter] Remove false requirement of lldb for dexter regression tests on Windows
OCHyams [Wed, 26 Jan 2022 11:09:21 +0000 (11:09 +0000)]
[Dexter] Remove false requirement of lldb for dexter regression tests on Windows

Not quite NFC because a little work was required to configure some tests to run
on Windows at all.

Before this patch on Windows:

    $ llvm-lit cross-project-tests\debuginfo-tests\dexter\feature-tests
       Unsupported: 49
       Passed     : 23

After this patch on Windows:

    $ llvm-lit cross-project-tests\debuginfo-tests\dexter\feature-tests
       Unsupported      : 27
       Passed           : 39
       Expectedly failed:  6

There are 3 main changes here. The first is to add a few more substitutions in
cross-project-tests/lit.cfg.py so that tests need to use specific flags can
still use the dexter regression test defaults for the native platform. These
are:

     %dexter_regression_test_debugger
     %dexter_regression_test_builder
     %dexter_regression_test_cflags
     %dexter_regression_test_ldflags

Tests that now use these options and therefore can be run on Windows too
(though the second is still failing for unknown reasons):

    cross-project-tests/debuginfo-tests/dexte/feature_tests
        /subtools/clang-opt-bisect/clang-opt-bisect.cpp
        /subtools/test/source-root-dir.cpp

The second change is to remove spurious `REQUIRES: system-linux, lldb` and
`UNSUPPORTED: system-windows` directives, and make changes to lit.local.cfg
files that have the same effect. I've also added comments to the genuine
REQUIRES, UNSUPPORTED, and XFAIL directives so it's easier to understand
requirements at a glance. The most common reason for a test to not be supported
on Windows is that it uses DexLimitSteps, DexDeclareAddress, or DexCommandLine,
none of which are supported in the dbgeng driver.

There are two failures on Windows that were previously hidden, which I've
XFAILed:

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/dex_finish_test/default_conditional.cpp
        /commands/perfect/dex_finish_test/default_conditional_hit_count.cpp

And two that were easy to fix:

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/dex_finish_test/default_simple.cpp
        /commands/perfect/dex_finish_test/default_hit_count.cpp

Lastly, I've set three directories as unsupported.

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/limit_steps
        /commands/perfect/dex_declare_address
        /commands/perfect/dex_declare_file

The first two are unsupported on Windows because they contains tests for the
DexLimitSteps and DexDeclareAddress commands which aren't supported in the
dbgeng driver. The third is unsupported on all platforms as the tests involve
invoking clang directly, which isn't currently a supported way of building
tests for dexter in lit (it can cause problems for cross compilers that can
target the host, as the tests use the default triple and linker, which may
be aligned for the default target, not host).

Tested on Windows and Linux.

Reviewed By: jmorse

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

2 years agoFix MSVC 'not all control paths return a value' warning. NFC.
Simon Pilgrim [Wed, 26 Jan 2022 11:33:08 +0000 (11:33 +0000)]
Fix MSVC 'not all control paths return a value' warning. NFC.

2 years ago[AMDGPU][GlobalISel] Combine unmerge of undef
Sebastian Neubauer [Tue, 25 Jan 2022 14:20:42 +0000 (15:20 +0100)]
[AMDGPU][GlobalISel] Combine unmerge of undef

Fold (unmerge undef) -> undef, undef, ...

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

2 years ago[AMDGPU][NFC] Pre-commit regenerated test
Sebastian Neubauer [Tue, 25 Jan 2022 14:22:28 +0000 (15:22 +0100)]
[AMDGPU][NFC] Pre-commit regenerated test

2 years ago[lldb][AArch64] Add MakeTaggedRanges to MemoryTagManager
David Spickett [Fri, 29 Oct 2021 15:09:03 +0000 (16:09 +0100)]
[lldb][AArch64] Add MakeTaggedRanges to MemoryTagManager

This is to be used when you want to know what subranges
of a larger range have memory tagging. Like MakeTaggedRange
but memory without tags is skipped and you get a list of ranges back.

Will be used later by DumpDataExtractor to show memory tags.

MakeTaggedRanges assumes that the memory regions it is
given are sorted in ascending order and do not overlap.
For the current use case where you get regions from
GetMemoryRegions and are on some Linux like OS, this is
reasonable to assume.

I've used asserts to check those conditions. In future
any API binding will check them up front to prevent a crash.

Reviewed By: omjavaid

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

2 years ago[Test] Add test for PR53419
Max Kazantsev [Wed, 26 Jan 2022 10:48:32 +0000 (17:48 +0700)]
[Test] Add test for PR53419

These tests demonstrate how suboptimal is the lowering of
equality checks for short vectors.

2 years ago[clang-tidy] Cache the locations of NOLINTBEGIN/END blocks
Salman Javed [Wed, 26 Jan 2022 10:56:27 +0000 (23:56 +1300)]
[clang-tidy] Cache the locations of NOLINTBEGIN/END blocks

Support for NOLINT(BEGIN/END) blocks (implemented in D108560) is
currently costly. This patch aims to improve the performance with the
following changes:

- The use of tokenized NOLINTs instead of a series of repetitive ad-hoc
string operations (`find()`, `split()`, `slice()`, regex matching etc).
- The caching of NOLINT(BEGIN/END) block locations. Determining these
locations each time a new diagnostic is raised is wasteful as it
requires reading and parsing the entire source file.

Move NOLINT-specific code from `ClangTidyDiagnosticConsumer` to new
purpose-built class `NoLintDirectiveHandler`.

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

2 years ago[mlir][Linalg] Add GenericOp self-copy on buffers folding
Nicolas Vasilache [Wed, 26 Jan 2022 10:19:53 +0000 (05:19 -0500)]
[mlir][Linalg] Add GenericOp self-copy on buffers folding

Reviewed By: pifon2a

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

2 years ago[MemCpyOpt] Add additiona call slot unwind tests (NFC)
Nikita Popov [Wed, 26 Jan 2022 10:48:11 +0000 (11:48 +0100)]
[MemCpyOpt] Add additiona call slot unwind tests (NFC)

Test a possibly unwinding call with a byval and sret argument.

2 years agoremove spurious comma [NFC]
Nuno Lopes [Wed, 26 Jan 2022 10:48:43 +0000 (10:48 +0000)]
remove spurious comma [NFC]

2 years ago[LSV] Vectorize loads of vectors by turning it into a larger vector
Benjamin Kramer [Thu, 13 Jan 2022 12:12:50 +0000 (13:12 +0100)]
[LSV] Vectorize loads of vectors by turning it into a larger vector

Use shufflevector to do the subvector extracts. This allows a lot more
load merging on AMDGPU and also on NVPTX when <2 x half> is involved.

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

2 years ago[clang][dataflow] Assign aggregate storage locations to union stmts
Stanislav Gatev [Wed, 26 Jan 2022 09:15:07 +0000 (09:15 +0000)]
[clang][dataflow] Assign aggregate storage locations to union stmts

This patch ensures that the dataflow analysis framework does not crash
when it encounters access to members of union types.

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D118226

2 years ago[mlir][openmp] Custom syntax for `omp.target` operation
Alexander Batashev [Wed, 26 Jan 2022 10:10:50 +0000 (10:10 +0000)]
[mlir][openmp] Custom syntax for `omp.target` operation

Add a custom parser and printer for `omp.target` operation.

Reviewed By: kiranchandramohan

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