platform/upstream/llvm.git
2 years ago[RISCV] Use splat_vector instead of SplatPat in widening FP instruction patterns...
Craig Topper [Mon, 7 Feb 2022 23:52:13 +0000 (15:52 -0800)]
[RISCV] Use splat_vector instead of SplatPat in widening FP instruction patterns. NFCI

We use splat_vector for FP nodes without VL, not SplatPat which handles
splat_vector and integer VMV_V_X_VL.

Reduces isel table size by a few hundred bytes.

2 years ago[VP] llvm.vp.fma intrinsic and LangRef
Craig Topper [Mon, 7 Feb 2022 21:24:36 +0000 (13:24 -0800)]
[VP] llvm.vp.fma intrinsic and LangRef

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

2 years ago[gn build] (manually) port 157bbe6aea22e
Nico Weber [Mon, 7 Feb 2022 23:45:04 +0000 (18:45 -0500)]
[gn build] (manually) port 157bbe6aea22e

2 years ago[libc++] Mark some members private in experimental/functional
Joe Loser [Mon, 7 Feb 2022 00:47:45 +0000 (19:47 -0500)]
[libc++] Mark some members private in experimental/functional

Some members are public but should be private. Nothing requires they are public
right now, so make them private.

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

2 years agoRevert "[mlir][Linalg] NFC: Combine elementwise fusion test passes."
Mahesh Ravishankar [Mon, 7 Feb 2022 22:50:36 +0000 (22:50 +0000)]
Revert "[mlir][Linalg] NFC: Combine elementwise fusion test passes."

This reverts commit d730336411b59622a625510378cec0f9d23807c6.

2 years ago[libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode
Louis Dionne [Wed, 8 Sep 2021 16:57:58 +0000 (12:57 -0400)]
[libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode

Back in https://reviews.llvm.org/D109459, we stopped using the C++03
emulation for std::nullptr_t by default, which was an ABI break. We
still left a knob for users to turn it back on if they were broken by
the change, with a note that we would remove that knob after one release.

The time has now come to remove the knob and clean up the std::nullptr_t
emulation.

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

2 years ago[mlir][Linalg] NFC: Combine elementwise fusion test passes.
Mahesh Ravishankar [Mon, 7 Feb 2022 17:45:28 +0000 (17:45 +0000)]
[mlir][Linalg] NFC: Combine elementwise fusion test passes.

There are a few different test passes that check elementwise fusion in
Linalg. Consolidate them to a single pass controlled by different pass
options (in keeping with how `TestLinalgTransforms` exists).

2 years ago[lldb] Call __lldb_init_module from __init__
Dave Lee [Mon, 7 Feb 2022 20:24:51 +0000 (12:24 -0800)]
[lldb] Call __lldb_init_module from __init__

Update `__init__.py` generation to implement `__lldb_init_module`, which calls
`__lldb_init_module` on submodules that define it.

This allows the use case where a user runs `command script import lldb.macosx`.
With this change, the `__lldb_init_module` function in `crashlog.py` and
`heap.py` will be run, which is where command registration is occurring.

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

2 years ago[llvm-libtool-darwin] Add -warnings_as_errors
Keith Smiley [Thu, 3 Feb 2022 01:46:11 +0000 (17:46 -0800)]
[llvm-libtool-darwin] Add -warnings_as_errors

libtool can currently produce 2 warnings:

1. No symbols were in the object file
2. An object file with the same basename was specified multiple times

The first warning here is often harmless and may just mean you have some
translation units with no symbols for the target you're building for.
The second warning can lead to real issues like those mentioned in
https://reviews.llvm.org/D113130 where ODR violations can slip in.

This introduces a new -warnings_as_errors flag that can be used by build
systems that want to verify they never hit these warnings. For example
with bazel the libtool caller first uniques names to make sure the
duplicate base name case is not possible, but if that doesn't work as
expected, having it fail would be preferred.

It's also worth noting that llvm-libtool-darwin works around an issue
that cctools libtool experiences related to debug info and duplicate
basenames, the workaround is described here:
https://github.com/llvm/llvm-project/blob/30baa5d2a450d5e302d8cba3fc7a26a59d4b7ae1/llvm/lib/Object/ArchiveWriter.cpp#L424-L465
And it avoids this bug:
https://github.com/keith/radars/tree/f0cbbb1c37126ec6528c132510b29e08566377a7/DuplicateBasenameIssue

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

2 years ago[SDAG] try to fold one-demanded-bit-of-multiply
Sanjay Patel [Mon, 7 Feb 2022 22:14:30 +0000 (17:14 -0500)]
[SDAG] try to fold one-demanded-bit-of-multiply

This is a translation of the transform added to InstCombine with:
D118539

2 years ago[libcxx][test][NFC] Add tests for backward iteration over associative
Ruslan Arutyunyan [Mon, 7 Feb 2022 22:02:57 +0000 (01:02 +0300)]
[libcxx][test][NFC] Add tests for backward iteration over associative
containers

Add test cases for iteration over the ordered associative container from
end to begin using operator--

Reviewed By: Quuxplusone, rarutyun

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

2 years ago[Libomptarget] Replace Value RAII with default value
Joseph Huber [Mon, 7 Feb 2022 21:41:35 +0000 (16:41 -0500)]
[Libomptarget] Replace Value RAII with default value

This patch replaces the ValueRAII pointer with a default 'nullptr'
value. Previously this was initialized as a reference to an existing
variable. The use of this variable caused overhead as the compiler could
not look through the uses and determine that it was unused if 'Active'
was not set. Because of this accesses to the variable would be left in
the runtime once compiled.

Fixes #53641

Reviewed By: jdoerfert

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

2 years agoFix my email address in CODE_OWNERS.TXT
Paul Robinson [Mon, 7 Feb 2022 22:01:49 +0000 (14:01 -0800)]
Fix my email address in CODE_OWNERS.TXT

2 years ago[x86] avoid compile-time warning for parens; NFC
Sanjay Patel [Mon, 7 Feb 2022 21:59:50 +0000 (16:59 -0500)]
[x86] avoid compile-time warning for parens; NFC

2 years ago[mlir][spirv] Fix verification of nested array constants
Sergei Grechanik [Mon, 7 Feb 2022 20:42:23 +0000 (12:42 -0800)]
[mlir][spirv] Fix verification of nested array constants

Fix the verification function of spirv::ConstantOp to allow nesting
array attributes.

Reviewed By: antiagainst

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

2 years ago[Bitstream] Temporarily disable UBSan for invalid bitcode tests. This fixes failing...
Andrew Browne [Mon, 7 Feb 2022 20:21:30 +0000 (12:21 -0800)]
[Bitstream] Temporarily disable UBSan for invalid bitcode tests. This fixes failing sanitizer buildbots.

Tests added by
  https://github.com/llvm/llvm-project/commit/3c86642edd28f1ce970882edaba8dce468ec7401
  https://github.com/llvm/llvm-project/commit/f4fca0fbb052e55935b483c8955c440b59511ce8
cause existing code to exhibit UB:
  https://github.com/llvm/llvm-project/blob/b4c6d1bb379192cb5b712fda9f60cd105f21194f/llvm/include/llvm/Bitstream/BitstreamReader.h#L244

llvm/include/llvm/Bitstream/BitstreamReader.h:244:51:
runtime error: shift exponent 35 is too large for 32-bit type 'unsigned int'

Hitting the UBSan error before the expected error causes the test to fail under UBSan:

Reviewed By: vitalybuka

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

2 years ago[libc] Fix mixed-sign comparison warnings and an out-of-bound access in high_precisio...
Tue Ly [Mon, 7 Feb 2022 17:38:40 +0000 (12:38 -0500)]
[libc] Fix mixed-sign comparison warnings and an out-of-bound access in high_precision_decimal.h

Fix mixed-sign comparison warnings and an out-of-bound access in high_precision_decimal.h

Reviewed By: michaelrj

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

2 years ago[libc][Obvious] Suppress unused-variable warnings from syscall_unittest.
Tue Ly [Mon, 7 Feb 2022 20:54:50 +0000 (15:54 -0500)]
[libc][Obvious] Suppress unused-variable warnings from syscall_unittest.

The unused vararibles in the tests are intentional.

Reviewed By: sivachandra

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

2 years ago[libc] Implement log1pf correctly rounded to all rounding modes.
Tue Ly [Fri, 4 Feb 2022 02:27:26 +0000 (21:27 -0500)]
[libc] Implement log1pf correctly rounded to all rounding modes.

Implement log1pf correctly rounded to all rounding modes relying on logf implementation for exponent > 2^(-8).

Reviewed By: sivachandra, zimmermann6

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

2 years ago[HWASan] Use hwasan_memalign for aligned new.
Matt Morehouse [Mon, 7 Feb 2022 21:10:06 +0000 (13:10 -0800)]
[HWASan] Use hwasan_memalign for aligned new.

Aligned new does not require size to be a multiple of alignment, so
memalign is the correct choice instead of aligned_alloc.

Fixes false reports for unaligned sizes.

Reviewed By: eugenis

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

2 years agoFix address space for function pointers with qualifier
Elizabeth Andrews [Fri, 4 Feb 2022 23:45:35 +0000 (15:45 -0800)]
Fix address space for function pointers with qualifier

This patch fixes a bug introduced in commit 4eaf5846d0e7. Commit
4eaf5846d0e7 sets address space of function type as program
address space unconditionally. This breaks types which have
address space qualifiers. E.g. __ptr32.

This patch fixes the bug by using address space qualifiers if
present.

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

2 years ago[SDAG] SimplifyDemandedBits - generalize fold for 2 LSB of X*X
Sanjay Patel [Mon, 7 Feb 2022 20:22:08 +0000 (15:22 -0500)]
[SDAG] SimplifyDemandedBits - generalize fold for 2 LSB of X*X

This is translated from recent changes to the IR version of this function:
D119060
D119139

2 years ago[AArch64] add tests for demanded bits of multiply; NFC
Sanjay Patel [Mon, 7 Feb 2022 20:09:45 +0000 (15:09 -0500)]
[AArch64] add tests for demanded bits of multiply; NFC

This is adapted from existing tests for instcombine.
We want to keep the backend logic synchronized with
that as much as possible.

See D119139 / D119060 / D118539

2 years ago[lldb] Print message after loading 'crashlog' command
Dave Lee [Mon, 7 Feb 2022 17:31:25 +0000 (09:31 -0800)]
[lldb] Print message after loading 'crashlog' command

Previously, importing `crashlog` resulted in a message being printed. The
message was about other commands (those in heap.py), not `crashlog`. The
changes in D117237 made it so that the heap.py messages were printed only when
importing `lldb.macosx.heap`, not when importing `lldb.macosx.crashlog`. Some
users may see no output and think `crashlog` wasn't successfully loaded. This
ensures users see that `crashlog` is loaded.

rdar://88283132

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

2 years agoUse functions with prototypes when appropriate; NFC
Aaron Ballman [Mon, 7 Feb 2022 20:28:35 +0000 (15:28 -0500)]
Use functions with prototypes when appropriate; NFC

A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the fourth batch of tests being updated (there are a significant
number of other tests left to be updated).

2 years ago[Clang][Docs] Fix some typos in offloading design documentation
Joseph Huber [Mon, 7 Feb 2022 20:23:50 +0000 (15:23 -0500)]
[Clang][Docs] Fix some typos in offloading design documentation

2 years agoCleanup LLVMBitcode headers
serge-sans-paille [Fri, 4 Feb 2022 11:00:40 +0000 (12:00 +0100)]
Cleanup LLVMBitcode headers

Major user-facing changes:
llvm/Bitcode/BitcodeReader.h no longer includes llvm/IR/ModuleSummaryIndex.h

Some statistics:
clang++ -E  -Iinclude -I../llvm/include ../llvm/lib/Bitcode/Reader/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
after: 493335
before: 539640

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

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

2 years ago[OpenMP] Use executable path when searching for lld
Joseph Huber [Mon, 7 Feb 2022 19:59:03 +0000 (14:59 -0500)]
[OpenMP] Use executable path when searching for lld

Summary:
This patch changes the ClangLinkerWrapper to use the executable path
when searching for the lld binary. Previously we relied on the program
name. Also not finding 'llvm-strip' is not considered an error anymore
because it is an optional optimization.

2 years ago[lldb] Fix Lua/watchpoint_callback.test on Apple Silicon
Jonas Devlieghere [Mon, 7 Feb 2022 20:06:30 +0000 (12:06 -0800)]
[lldb] Fix Lua/watchpoint_callback.test on Apple Silicon

As Pavel pointed out, on Apple Silicon "b main" stops at a point after
the variable has already been initialized. This patch updates the test
case to avoids that. I've also split the test into separate files so its
easier to reproduce the individual scenarios without having to build any
shared state.

2 years ago[libc++][CI] Reorder CI runs
Nikolas Klauser [Fri, 4 Feb 2022 23:00:31 +0000 (00:00 +0100)]
[libc++][CI] Reorder CI runs

This patch makes the uncontrovertial changes to the pipeline.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson

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

2 years ago[Bazel] Port e8bff9ae54a55b4dbfeb6ba55f723abbd81bf494 (move LLVM_ENABLE_ZLIB)
Fangrui Song [Mon, 7 Feb 2022 19:45:31 +0000 (11:45 -0800)]
[Bazel] Port e8bff9ae54a55b4dbfeb6ba55f723abbd81bf494 (move LLVM_ENABLE_ZLIB)

2 years ago[LoopVectorizer] Don't perform interleaving of predicated scalar loops
David Green [Mon, 7 Feb 2022 19:34:28 +0000 (19:34 +0000)]
[LoopVectorizer] Don't perform interleaving of predicated scalar loops

The vectorizer will choose at times to "vectorize" loops with a scalar
factor (VF=1) with interleaving (IC > 1). This can occasionally produce
better code than the unroller (notable for reductions where it can
produce independent reduction chains that are combined after the loop).
At times this is not very beneficial though, for example when runtime
checks are needed or when the scalar code requires predication.

This addresses the second point, preventing the vectorizer from
interleaving when the scalar loop will require predication. This
prevents it from making a bit of a mess, that is worse than the original
and better left for the unroller to unroll if beneficial. It helps
reverse some of the regressions from D118090.

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

2 years ago[MLIR][Presburger] Add support for piece-wise multi-affine functions
Arjun P [Mon, 7 Feb 2022 19:01:27 +0000 (00:31 +0530)]
[MLIR][Presburger] Add support for piece-wise multi-affine functions

Add the class MultiAffineFunction which represents functions whose domain is an
IntegerPolyhedron and which produce an output given by a tuple of affine
expressions in the IntegerPolyhedron's ids.

Also add support for piece-wise MultiAffineFunctions, which are defined on a
union of IntegerPolyhedrons, and may have different output affine expressions
on each IntegerPolyhedron. Thus the function is affine on each individual
IntegerPolyhedron piece in the domain.

This is part of a series of patches leading up to parametric integer programming.

Depends on D118778.

Reviewed By: Groverkss

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

2 years ago[AMDGPU] Fix debug values in scheduler not placed correctly when reverting
Vang Thao [Fri, 4 Feb 2022 18:44:20 +0000 (10:44 -0800)]
[AMDGPU] Fix debug values in scheduler not placed correctly when reverting

Debug position data is cleared after ScheduleDAGMILive::schedule() due to it also calling placeDebugValues(). Make it so the data is not cleared after initial call to placeDebugValues since we will call it again after reverting a schedule.

Secondly, since we skip debug instructions when reverting the schedule on AMDGPU, all debug instructions are now moved to the end of the scheduling region. RegionEnd points to the beginning of this chunk of debug instructions since it was not incremented when a debug instruction was skipped. RegionBegin may also point to the same debug instruction if Unsched.front() is a debug instruction thus shrinking the region to 1. Fix RegionBegin and RegionEnd so that they point to the current beginning and ending before calling placeDebugValues() since both vars will be used as reference points to move debug instructions back.

Reviewed By: rampitec

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

2 years ago[BOLT] Refactor heatmap to be standalone tool
Vladislav Khmelevsky [Mon, 7 Feb 2022 18:30:38 +0000 (21:30 +0300)]
[BOLT] Refactor heatmap to be standalone tool

Separate heatmap from bolt and build it as standalone tool.

Reviewed By: maksfb

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

2 years ago[libc++] Disable -Wattributes in GCC
Nikolas Klauser [Mon, 7 Feb 2022 15:07:01 +0000 (16:07 +0100)]
[libc++] Disable -Wattributes in GCC

Currently GCC produces lots of warnings. Most of them are `-Wattributes`, but these warnings are completly ignored by everybody. So let's disable -Wattributes and make the output cleaner.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[NFC] use Range based any_of for more concise code.
Florian Mayer [Mon, 7 Feb 2022 18:38:25 +0000 (10:38 -0800)]
[NFC] use Range based any_of for more concise code.

2 years ago[ELF] Move Symbol::needsTlsLd to config->needsTlsLd
Fangrui Song [Mon, 7 Feb 2022 18:26:16 +0000 (10:26 -0800)]
[ELF] Move Symbol::needsTlsLd to config->needsTlsLd

to decrease sizeof(SymbolUnion) from 72 to 64 on ELF64 platforms.

Use a dummy `Undefined` to prevent null pointer dereference (though unused)
`*rel.sym` in InputSectionBase::relocateAlloc.

The relocation order may shuffle a bit, but otherwise there is no behavior
difference.

2 years ago[LV] Adjust accesses in test to ensure full RT checks are generated.
Florian Hahn [Mon, 7 Feb 2022 18:07:19 +0000 (18:07 +0000)]
[LV] Adjust accesses in test to ensure full RT checks are generated.

Add an additional access so the full runtime checks are still generated,
even after D119078.

2 years ago[libc++][docs] Change some words to use reST inline literals
Fangrui Song [Mon, 7 Feb 2022 18:00:42 +0000 (10:00 -0800)]
[libc++][docs] Change some words to use reST inline literals

Reviewed By: #libc, ldionne, Quuxplusone

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

2 years agoRevert "[ELF] Move Symbol::needsTlsLd to config->needsTlsLd. NFC"
Alexander Kornienko [Mon, 7 Feb 2022 17:46:39 +0000 (18:46 +0100)]
Revert "[ELF] Move Symbol::needsTlsLd to config->needsTlsLd. NFC"

This reverts commit f9e3ca542ec17a0aa706bb51dcddf7fc6f0988ac.

The commit results in internal test failures. Test case provided offline.

2 years ago[LV] Use IRBuilderBase in VPlan.h, remove IRBuilder.h include (NFC).
Florian Hahn [Mon, 7 Feb 2022 17:46:16 +0000 (17:46 +0000)]
[LV] Use IRBuilderBase in VPlan.h, remove IRBuilder.h include (NFC).

By using IRBuilderBase instead of IRBuilder<> a forward declaration can
be used instead of including IRBuilder.h

2 years agoRevert "Add llgs category to all tests in TestLldbGdbServer that attach to the process."
Adrian Prantl [Mon, 7 Feb 2022 17:41:39 +0000 (09:41 -0800)]
Revert "Add llgs category to all tests in TestLldbGdbServer that attach to the process."

This reverts commit d42765b3bea5ee90426c49f35b0b5654de82a4f9.

2 years ago[lldb] Skip part of TestGdbRemoteMemoryAllocation.py on Apple Silicon
Jonas Devlieghere [Mon, 7 Feb 2022 17:40:45 +0000 (09:40 -0800)]
[lldb] Skip part of TestGdbRemoteMemoryAllocation.py on Apple Silicon

Skip the part of TestGdbRemoteMemoryAllocation.py that attempts to
allocate both writable and executable memory.

2 years ago[mlir][SCF] Further simplify affine maps during `for-loop-canonicalization`
Matthias Springer [Mon, 7 Feb 2022 17:25:55 +0000 (02:25 +0900)]
[mlir][SCF] Further simplify affine maps during `for-loop-canonicalization`

* Implement `FlatAffineConstraints::getConstantBound(EQ)`.
* Inject a simpler constraint for loops that have at most 1 iteration.
* Taking into account constant EQ bounds of FlatAffineConstraint dims/symbols during canonicalization of the resulting affine map in `canonicalizeMinMaxOp`.

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

2 years ago[libunwind] Define _Unwind_Backtrace for powerpc, sparc
Sam James [Mon, 7 Feb 2022 17:37:08 +0000 (09:37 -0800)]
[libunwind] Define _Unwind_Backtrace for powerpc, sparc

Add SPARC to the list of platforms for which we provide a full
unwind implementation which leads to _Unwind_Backtrace being defined within
libunwind.so.

Likewise for PPC (see D118320 for background).

Reviewed By: #libunwind, MaskRay, Arfrever

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

2 years ago[lldb] Fix a few lldb-server tests on Apple Silicon
Jonas Devlieghere [Mon, 7 Feb 2022 17:30:20 +0000 (09:30 -0800)]
[lldb] Fix a few lldb-server tests on Apple Silicon

This fixes TestGdbRemoteSingleStep.py and TestGdbRemote_vCont.py. This
patch updates the test to account for the possibility that the constants
are already materialized. This appears to behave differently between
embedded arm64 devices and Apple Silicon.

2 years ago[gn build] Port D119058
Arthur Eubanks [Mon, 7 Feb 2022 17:29:27 +0000 (09:29 -0800)]
[gn build] Port D119058

2 years ago[clang] Cache OpenCL types
Arthur Eubanks [Fri, 4 Feb 2022 17:21:20 +0000 (09:21 -0800)]
[clang] Cache OpenCL types

If we call CGOpenCLRuntime::convertOpenCLSpecificType() multiple times
we should get the same type back.

Reviewed By: svenvh

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

2 years agoFix lld standalone build
Mariusz Ceier [Mon, 7 Feb 2022 17:20:03 +0000 (09:20 -0800)]
Fix lld standalone build

lld/ELF/OutputSections.cpp includes llvm/Config/config.h for
LLVM_ENABLE_ZLIB definition, but llvm/Config/config.h doesn't exist in
standalone build.

To fix this, this patch moves LLVM_ENABLE_ZLIB from config.h to
llvm-config.h and updates OutputSections.cpp to include llvm-config.h
instead of config.h

Reviewed By: MaskRay, mgorny

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

2 years ago[InstCombine] generalize 2 LSB of demanded bits for X*X
Sanjay Patel [Mon, 7 Feb 2022 16:04:22 +0000 (11:04 -0500)]
[InstCombine] generalize 2 LSB of demanded bits for X*X

This is a follow-up suggested in D119060.
Instead of checking each of the bottom 2 bits individually,
we can check them together and handle the possibility that
we demand both together.

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

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

2 years agoAdd llgs category to all tests in TestLldbGdbServer that attach to the process.
Adrian Prantl [Mon, 7 Feb 2022 16:25:54 +0000 (08:25 -0800)]
Add llgs category to all tests in TestLldbGdbServer that attach to the process.

2 years agoReland "[clangd] Properly compute framework-style include spelling"
David Goldman [Mon, 7 Feb 2022 15:20:33 +0000 (10:20 -0500)]
Reland "[clangd] Properly compute framework-style include spelling"

Roll forward of https://reviews.llvm.org/D117056 with a fix. Proper
initialization of `IsPrivateHeader` was missing, causing failures
on Linux.

2 years ago[demangler] Stricter NestedName parsing
Nathan Sidwell [Fri, 21 Jan 2022 19:00:56 +0000 (11:00 -0800)]
[demangler] Stricter NestedName parsing

The parsing of nested names is a little lax.  This corrects that.

1) The 'L' local name prefix cannot appear before a NestedName -- only
within it.  Let's remove that check from parseName, and then adjust
parseUnscopedName to allow it with or without the 'St' prefix.

2) In a nested name, a <template-param>, <decltype> or <substitution>
can only appear as the first element.  Let's enforce that.  Note I do
not remove these from the loop, to make the change easier to follow
(such a change will come later).

3) Given that, there's no need to special case 'St' outside of the
loop, handle it with the other 'S' elements.

4) There's no need to reset 'EndsWithTemplateArgs' after each
non-template-arg component.  Rather, always clear it and then set it
in the template-args case.

5) An template-args cannot immediately follow a template-args.

6) The parsing of a CDtor name with ABITags would attach the tags to
the NestedName node, rather than the CDTor node.  This is different to
how ABITags are attached to an unscopedName.  Make it consistent.

7) We remain with only CDTor and UnscopedName requireing construction
of a NestedName, so let's drop the PushComponent lambda.

8) Add some tests to catch the new rejected manglings.

Reviewed By: ChuanqiXu

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

2 years ago[lldb] Update outdated comment in TestDyldTrieSymbols.py
Jonas Devlieghere [Mon, 7 Feb 2022 16:11:30 +0000 (08:11 -0800)]
[lldb] Update outdated comment in TestDyldTrieSymbols.py

After aed965d55d46 we no longer demangle and store the full name. The
test was updated accordingly but the comment still specified that we
should be able to find the symbol by its full demangled name.

2 years ago[MatrixBuilder] Require explicit element type in CreateColumnMajorLoad()
Nikita Popov [Mon, 7 Feb 2022 15:52:31 +0000 (16:52 +0100)]
[MatrixBuilder] Require explicit element type in CreateColumnMajorLoad()

This makes the method compatible with opaque pointers.

2 years agoRevert "Remove -Wweak-template-vtables"
Hans Wennborg [Mon, 7 Feb 2022 15:47:14 +0000 (16:47 +0100)]
Revert "Remove -Wweak-template-vtables"

Turns out there's still some code referencing this. No harm in keeping it in a
bit longer.

> as it was planned for removal in clang 15 and we're now past the branch point
>
> See https://github.com/llvm/llvm-project/issues/19107
>
> Differential revision: https://reviews.llvm.org/D118762

This reverts commit 564f9be11c9cb8d131f48df07538fab7a19b41a7.

2 years ago[mlir] Remove MatrixBuilder template argument
Nikita Popov [Mon, 7 Feb 2022 15:51:22 +0000 (16:51 +0100)]
[mlir] Remove MatrixBuilder template argument

I dropped this argument in cdc0573f753e639ed78f2a3645179ac2d2718fd0,
but did not adjust mlir. (Or rather I did, but I modified a generated
file ... oops)

2 years ago[demangler] Fix unresolvedname demangling
Nathan Sidwell [Fri, 28 Jan 2022 19:59:03 +0000 (11:59 -0800)]
[demangler] Fix unresolvedname demangling

We were dropping the [gs] modifier by parsing it in parseExpr, but not
forwarding it on to parseUnresolvedName.  This is the straightforwards
fix to forward that flag -- parseExpr must see past it.

Reviewed By: ChuanqiXu

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

2 years ago[demangler] Remove StdQualifiedName
Nathan Sidwell [Fri, 21 Jan 2022 19:37:01 +0000 (11:37 -0800)]
[demangler] Remove StdQualifiedName

The StdQualifiedName node class is used for names exactly in the std
namespace.  It is not used for nested names that descend further --
those use a NestedName with NameType("std") as the scope.
Representing the compression scheme in the node graph is layer
breaking.  We can use the same structure for those exactly in std too,
and reduce code size a bit.

Reviewed By: ChuanqiXu

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

2 years ago[ARM] Undeprecate complex IT blocks
Mark Murray [Mon, 24 Jan 2022 10:39:03 +0000 (10:39 +0000)]
[ARM] Undeprecate complex IT blocks

AArch32/Armv8A  introduced the performance deprecation of certain patterns
of IT instructions.  After some debate internal to ARM, this is now being
reverted; i.e. no IT instruction patterns are performance deprecated
anymore, as the perfomance degredation is not significant enough.

This reverts the following:

"ARMv8-A deprecates some uses of the T32 IT instruction. All uses of
IT that apply to instructions other than a single subsequent 16-bit
instruction from a restricted set are deprecated, as are explicit
references to the PC within that single 16-bit instruction. This permits
the non-deprecated forms of IT and subsequent instructions to be treated
as a single 32-bit conditional instruction."

The deprecation no longer applies, but the behaviour may be controlled
by the -arm-restrict-it and -arm-no-restrict-it command-line options,
with the latter being the default. No warnings about complex IT blocks
will be generated.

Reviewed By: dmgreen

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

2 years ago[MatrixBuilder] Remove unnecessary IRBuilder template (NFC)
Nikita Popov [Mon, 7 Feb 2022 15:33:58 +0000 (16:33 +0100)]
[MatrixBuilder] Remove unnecessary IRBuilder template (NFC)

IRBuilderBase exists specifically to avoid the need for this.

2 years agoAdd LLVM Embedded Toolchains call to the table of sync ups.
Volodymyr Turanskyy [Mon, 7 Feb 2022 13:30:16 +0000 (14:30 +0100)]
Add LLVM Embedded Toolchains call to the table of sync ups.

LLVM Embedded Toolchains working group regular sync up calls to start in early
March, adding details to the table of sync ups for general reference.

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

2 years ago[x86] avoid false dependency stall on 'sbb' with same source reg
Sanjay Patel [Mon, 7 Feb 2022 15:12:12 +0000 (10:12 -0500)]
[x86] avoid false dependency stall on 'sbb' with same source reg

This is effectively inverting the transform added with D116804
because the downside of the false dependency of something like
"sbb %eax, %eax" is much greater than the upside of eliminating
a zeroing instruction on (all?) Intel CPUs.

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

2 years ago[InstCombine] add test for demanded 2 low bits of X*X; NFC
Sanjay Patel [Mon, 7 Feb 2022 14:04:33 +0000 (09:04 -0500)]
[InstCombine] add test for demanded 2 low bits of X*X; NFC

2 years agoAMDGPU: Fix clobbering SCC when expanding large offset spill pseudos
Matt Arsenault [Mon, 1 Nov 2021 18:22:10 +0000 (14:22 -0400)]
AMDGPU: Fix clobbering SCC when expanding large offset spill pseudos

If we had a large offset which required materializing in a register,
we would emit an s_add_i32, clobbering SCC. Start checking if SCC is
live, and instead use a VGPR offset. For MUBUF, we switch to using
offen. We would do this anyway in a normal load/store with a frame
index, but not for spills.

The same problem still exists in other contexts where we expand frame
indices.

The nasty edge case is when SGPRs are spilled to memory at a large
frame offset where SCC is also clobbered. This requires a second
scavenging index, and also required several patches in the scavenger
to correctly handle multiple recursive scavenge indexes.

An even nastier edge case we still don't support is if we don't have
any free SGPRs. If SCC is live and we don't have any free SGPRs to
save exec, we have no way of flipping exec back and forth without also
clobbering SCC.

Fixes: SWDEV-309419

2 years ago[AArch64][NEON][SVE] Lower FCOPYSIGN using AArch64ISD::BSP
David Truby [Thu, 27 Jan 2022 16:31:00 +0000 (16:31 +0000)]
[AArch64][NEON][SVE] Lower FCOPYSIGN using AArch64ISD::BSP

This patch modifies the FCOPYSIGN lowering to go through the BSP
pseudo-instruction. This allows the same lowering code for NEON,
SVE and SVE2.

As part of this, lowering for BSP for SVE and SVE2 is also added.

For SVE and NEON this patch is NFC.

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

2 years agoUse functions with prototypes when appropriate; NFC
Aaron Ballman [Mon, 7 Feb 2022 14:24:09 +0000 (09:24 -0500)]
Use functions with prototypes when appropriate; NFC

A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the third batch of tests being updated (there are a significant
number of other tests left to be updated).

2 years ago[clang-format] Fix DefSeparator empty line issues
ksyx [Sun, 6 Feb 2022 02:18:04 +0000 (02:18 +0000)]
[clang-format] Fix DefSeparator empty line issues

- Add or remove empty lines surrounding union blocks.
- Fixes https://github.com/llvm/llvm-project/issues/53229, in which
  keywords like class and struct in a line ending with left brace or
  whose next line is left brace only, will be falsely recognized as
  definition line, causing extra empty lines inserted surrounding blocks
  with no need to be formatted.

Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D119067

2 years agoReformat CastExpr unittest suite; NFC
Kim Gräsman [Mon, 7 Feb 2022 14:21:41 +0000 (09:21 -0500)]
Reformat CastExpr unittest suite; NFC

In preparation for adding new tests. No functional change.

2 years ago[lldb/Platform] s/m_name/m_hostname
Pavel Labath [Mon, 7 Feb 2022 13:52:22 +0000 (14:52 +0100)]
[lldb/Platform] s/m_name/m_hostname

m_name is confusing, as there is a getter called GetName, but it returns
a completely different thing.

2 years ago[clang-tidy] Fixed a compile warning (NFC).
Balázs Kéri [Mon, 7 Feb 2022 13:50:47 +0000 (14:50 +0100)]
[clang-tidy] Fixed a compile warning (NFC).

Fixed a "override" related warning in SharedPtrArrayMismatchCheck.h.
Related to differential revision: https://reviews.llvm.org/D117306

2 years ago[InstCombine] SimplifyDemandedBits - mul(x,x) is odd iff x is odd
Sanjay Patel [Sat, 5 Feb 2022 15:18:38 +0000 (10:18 -0500)]
[InstCombine] SimplifyDemandedBits - mul(x,x) is odd iff x is odd

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

2 years ago[PPCISelLowering] Avoid use of getPointerElementType()
Nikita Popov [Mon, 7 Feb 2022 13:29:36 +0000 (14:29 +0100)]
[PPCISelLowering] Avoid use of getPointerElementType()

Use the value type instead.

2 years ago[test] Use -passes=instcombine instead of -instcombine in lots of tests. NFC
Bjorn Pettersson [Fri, 4 Feb 2022 12:39:52 +0000 (13:39 +0100)]
[test] Use -passes=instcombine instead of -instcombine in lots of tests. NFC

Another step moving away from the deprecated syntax of specifying
pass pipeline in opt.

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

2 years ago[test] Use -passes=instsimplify instead of -instsimplify in a number of tests. NFC
Bjorn Pettersson [Fri, 4 Feb 2022 10:45:19 +0000 (11:45 +0100)]
[test] Use -passes=instsimplify instead of -instsimplify in a number of tests. NFC

Another step moving away from the deprecated syntax of specifying
pass pipeline in opt.

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

2 years ago[OMPIRBuilder] Avoid use of getPointerElementType()
Nikita Popov [Mon, 7 Feb 2022 13:22:34 +0000 (14:22 +0100)]
[OMPIRBuilder] Avoid use of getPointerElementType()

Looks like I missed this call when removing others in this file.

2 years ago[LV] Remove `LoopVectorizationCostModel::useEmulatedMaskMemRefHack()`
Roman Lebedev [Mon, 7 Feb 2022 13:03:40 +0000 (16:03 +0300)]
[LV] Remove `LoopVectorizationCostModel::useEmulatedMaskMemRefHack()`

D43208 extracted `useEmulatedMaskMemRefHack()` from legality into cost model.
What it essentially does is prevents scalarized vectorization of masked memory operations:
```
  // TODO: Cost model for emulated masked load/store is completely
  // broken. This hack guides the cost model to use an artificially
  // high enough value to practically disable vectorization with such
  // operations, except where previously deployed legality hack allowed
  // using very low cost values. This is to avoid regressions coming simply
  // from moving "masked load/store" check from legality to cost model.
  // Masked Load/Gather emulation was previously never allowed.
  // Limited number of Masked Store/Scatter emulation was allowed.
```

While i don't really understand about what specifically `is completely broken`
was talking about, i believe that at least on X86 with AVX2-or-later,
this is no longer true. (or at least, i would like to know what is still broken).
So i would like to follow suit after D111460, and like wise disable that hack for AVX2+.

But since this was added for X86 specifically, let's just instead completely remove this hack.

Reviewed By: RKSimon

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

2 years ago[clang][Lexer] Fix tests after ff77071a4d67
Kadir Cetinkaya [Mon, 7 Feb 2022 12:12:01 +0000 (13:12 +0100)]
[clang][Lexer] Fix tests after ff77071a4d67

2 years ago[X86][SSE] Add some initial PAVGB/PAVGW tests
Simon Pilgrim [Mon, 7 Feb 2022 12:58:33 +0000 (12:58 +0000)]
[X86][SSE] Add some initial PAVGB/PAVGW tests

Once D119073 has landed, I'll start addressing these

2 years ago[LV] Modernize some runtime check tests a bit.
Florian Hahn [Mon, 7 Feb 2022 12:08:49 +0000 (12:08 +0000)]
[LV] Modernize some runtime check tests a bit.

Update tests to check runtime checks a bit more precisely.

2 years ago[gn build] Port c63522e6ba77
LLVM GN Syncbot [Mon, 7 Feb 2022 11:59:15 +0000 (11:59 +0000)]
[gn build] Port c63522e6ba77

2 years ago[clang-tidy] Add new check 'shared-ptr-array-mismatch'.
Balázs Kéri [Mon, 7 Feb 2022 08:56:24 +0000 (09:56 +0100)]
[clang-tidy] Add new check 'shared-ptr-array-mismatch'.

Reviewed By: LegalizeAdulthood

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

2 years ago[DebugInfo][test] XFAIL DebugInfo/Generic/missing-abstract-variable.ll on SPARC
Rainer Orth [Mon, 7 Feb 2022 11:43:56 +0000 (12:43 +0100)]
[DebugInfo][test] XFAIL DebugInfo/Generic/missing-abstract-variable.ll on SPARC

`DebugInfo/Generic/missing-abstract-variable.ll` `FAIL`s on SPARC.  When
`x` is inlined into `a`, the variable `s` is elided completely, so the
corresponding `CHECK`s fail.  Exactly the same happens on RISCV and the
test has already been `XFAIL`ed there.

This patch does the same on SPARC.

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

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

2 years ago[Bitcode] Replace assertion with check
Nikita Popov [Mon, 7 Feb 2022 11:39:35 +0000 (12:39 +0100)]
[Bitcode] Replace assertion with check

2 years ago[Bitcode] Add missing test file
Nikita Popov [Mon, 7 Feb 2022 11:37:21 +0000 (12:37 +0100)]
[Bitcode] Add missing test file

This was supposed to be part of
ec18030f5fc1f4a08326e65fe06c6f265a829f4c.

2 years ago[Bitcode] Handle invalid data layout gracefully
Nikita Popov [Mon, 7 Feb 2022 11:26:12 +0000 (12:26 +0100)]
[Bitcode] Handle invalid data layout gracefully

2 years ago[flang] Handle character constant for error code in STOP stmt
Valentin Clement [Mon, 7 Feb 2022 11:18:24 +0000 (12:18 +0100)]
[flang] Handle character constant for error code in STOP stmt

Handle character constant ofr error code in the STOP statement.

Depends on D118992

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan, schweitz

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

2 years ago[flang] Add lowering for ASCII character constant
Valentin Clement [Mon, 7 Feb 2022 11:17:02 +0000 (12:17 +0100)]
[flang] Add lowering for ASCII character constant

Lower character constant of KIND = 1 with the
`createStringLiteral` helper function.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan, schweitz

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

2 years ago[Bitcode] Guard against out of bounds value reference
Nikita Popov [Mon, 7 Feb 2022 10:51:19 +0000 (11:51 +0100)]
[Bitcode] Guard against out of bounds value reference

We should make sure that the value ID is in bounds, otherwise
we will assert / read out of bounds.

2 years ago[Bitstream] Check that there is enough space for blob
Nikita Popov [Mon, 7 Feb 2022 10:43:29 +0000 (11:43 +0100)]
[Bitstream] Check that there is enough space for blob

Instead of simply assuming that it will be zero. I double checked
that the bitstream reader doesn't have any special handling for
all-zero blobs, it will always write out the full contents.

2 years ago[Bitcode] Don't assert on invalid attribute group record
Nikita Popov [Mon, 7 Feb 2022 10:15:43 +0000 (11:15 +0100)]
[Bitcode] Don't assert on invalid attribute group record

Report an error instead.

2 years ago[Bitstream] Reject implausibly large reservations
Nikita Popov [Mon, 7 Feb 2022 09:56:14 +0000 (10:56 +0100)]
[Bitstream] Reject implausibly large reservations

If we're trying to reserve more memory than bits in the stream,
reject this early to avoid OOM.

2 years ago[flang] Remove unused converter for now
Valentin Clement [Mon, 7 Feb 2022 10:40:37 +0000 (11:40 +0100)]
[flang] Remove unused converter for now

AbstractConverter private variable is currently not used
and triggers a buildbot failure.

https://lab.llvm.org/buildbot/#/builders/180/builds/3119

This fixes the buildbot.

2 years ago[OpenCL] opencl-c.h: make attribute order consistent; NFC
Sven van Haastregt [Mon, 7 Feb 2022 10:54:55 +0000 (10:54 +0000)]
[OpenCL] opencl-c.h: make attribute order consistent; NFC

For most builtins, `__purefn` always comes after `__ovld`, but the
read_image functions did not follow this pattern.

2 years ago[OpenMP] kmp_atomic_float10_max_min.c test should only be executed on x86 platform
Igor Kirillov [Fri, 4 Feb 2022 13:26:10 +0000 (13:26 +0000)]
[OpenMP] kmp_atomic_float10_max_min.c test should only be executed on x86 platform

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

2 years ago[TSan] Handle FreeBSD specific indirection of libpthread functions
Dimitry Andric [Fri, 4 Feb 2022 20:53:09 +0000 (21:53 +0100)]
[TSan] Handle FreeBSD specific indirection of libpthread functions

Similar to 60cc1d3218fc for NetBSD, add aliases and interceptors for the
following pthread related functions:

- pthread_cond_init(3)
- pthread_cond_destroy(3)
- pthread_cond_signal(3)
- pthread_cond_broadcast(3)
- pthread_cond_wait(3)
- pthread_mutex_init(3)
- pthread_mutex_destroy(3)
- pthread_mutex_lock(3)
- pthread_mutex_trylock(3)
- pthread_mutex_unlock(3)
- pthread_rwlock_init(3)
- pthread_rwlock_destroy(3)
- pthread_rwlock_rdlock(3)
- pthread_rwlock_tryrdlock(3)
- pthread_rwlock_wrlock(3)
- pthread_rwlock_trywrlock(3)
- pthread_rwlock_unlock(3)
- pthread_once(3)
- pthread_sigmask(3)

In FreeBSD's libc, a number of internal aliases of the pthread functions
are invoked, typically with an additional prefixed underscore, e.g.
_pthread_cond_init() and so on.

ThreadSanitizer needs to intercept these aliases too, otherwise some
false positive reports about data races might be produced.

Reviewed By: dvyukov

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

2 years ago[DAG] visitINSERT_VECTOR_ELT - break if-else chain as they both return (style). NFC.
Simon Pilgrim [Mon, 7 Feb 2022 09:58:47 +0000 (09:58 +0000)]
[DAG] visitINSERT_VECTOR_ELT - break if-else chain as they both return (style). NFC.

2 years ago[X86] combineShiftRightArithmetic - break if-else chain as they all return (style...
Simon Pilgrim [Mon, 7 Feb 2022 09:54:34 +0000 (09:54 +0000)]
[X86] combineShiftRightArithmetic - break if-else chain as they all return (style). NFC.

2 years ago[GlobalISel] Move getOpcode() calls inside assert() to avoid (void)s. NFC.
Simon Pilgrim [Mon, 7 Feb 2022 09:50:09 +0000 (09:50 +0000)]
[GlobalISel] Move getOpcode() calls inside assert() to avoid (void)s. NFC.

Tidier solution to the unused variable warnings - we already do this in other places in this file.