platform/upstream/llvm.git
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.

2 years ago[CSKY] Add inline asm constraints and related codegen support
Zi Xuan Wu [Mon, 7 Feb 2022 09:26:13 +0000 (17:26 +0800)]
[CSKY] Add inline asm constraints and related codegen support

There are kinds of inline asm constraints and corresponding register class or register as following.

 'b': mGPRRegClass
 'v': sGPRRegClass
 'w': sFPR32RegClass or sFPR64RegClass
 'c': C register
 'z': R14 register
 'h': HI register
 'l': LO register
 'y': HI or LO register

It also adds codegen test for inline-asm including constraints, clobbers and abi names.

2 years ago[X86] Add fp80 copysign test coverage
Simon Pilgrim [Mon, 7 Feb 2022 09:43:32 +0000 (09:43 +0000)]
[X86] Add fp80 copysign test coverage

Add PR41749 test coverage

2 years ago[SLPVectorizer] Fix "unused variable" build warning
Djordje Todorovic [Mon, 7 Feb 2022 09:37:55 +0000 (10:37 +0100)]
[SLPVectorizer] Fix "unused variable" build warning

2 years ago[Bitcode] Handle invalid abbrev number error more gracefully
Nikita Popov [Mon, 7 Feb 2022 09:34:34 +0000 (10:34 +0100)]
[Bitcode] Handle invalid abbrev number error more gracefully

Avoid report_fatal_error(), propagate the error upwards instead.

2 years ago[Bitcode] Add fuzzer for bitcode reading
Nikita Popov [Fri, 4 Feb 2022 14:28:44 +0000 (15:28 +0100)]
[Bitcode] Add fuzzer for bitcode reading

Inspired by the discussion on D118694, this adds a straightforward
fuzzer for bitcode reading. Currently it will very quickly run into
OOM, because we do unconditional vector reservations with
user-provided sizes.

2 years ago[Driver][OpenBSD] -r: imply -nostdlib like GCC
Brad Smith [Mon, 7 Feb 2022 09:04:39 +0000 (04:04 -0500)]
[Driver][OpenBSD] -r: imply -nostdlib like GCC

Similar to D116843 for Gnu.cpp

Reviewed By: MaskRay

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

2 years ago[SYCL] Disallow explicit casts between mismatching address spaces
Mariya Podchishchaeva [Thu, 3 Feb 2022 15:37:48 +0000 (18:37 +0300)]
[SYCL] Disallow explicit casts between mismatching address spaces

Reviewed By: bader

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

2 years ago[GlobalIsel] Fix another "unused variable" warning
Djordje Todorovic [Mon, 7 Feb 2022 08:32:09 +0000 (09:32 +0100)]
[GlobalIsel] Fix another "unused variable" warning

2 years agoFix the warning after D118805
Djordje Todorovic [Mon, 7 Feb 2022 08:24:59 +0000 (09:24 +0100)]
Fix the warning after D118805

A variable was used within assert() only.

2 years ago[flang] Add test for quiet with local variable in STOP stmt
Valentin Clement [Fri, 4 Feb 2022 10:58:06 +0000 (11:58 +0100)]
[flang] Add test for quiet with local variable in STOP stmt

Depends on D118978.

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

2 years ago[flang] Basic local variable lowering
Valentin Clement [Mon, 7 Feb 2022 08:12:17 +0000 (09:12 +0100)]
[flang] Basic local variable lowering

This patch add lowering for simple local variable.

- The signatures in `ConvertType.h` have been simplified to take advantage of the `AbstractConverter`.
- The lowering make use of the `allocateLocal` from the `FirOpBuilder`.

This lowering is used in patch D118982

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

Reviewed By: kiranchandramohan, jeanPerier, schweitz

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

2 years ago[X86] Add test cases for fmul/fdiv with select.
Luo, Yuanke [Mon, 7 Feb 2022 07:58:45 +0000 (15:58 +0800)]
[X86] Add test cases for fmul/fdiv with select.

2 years ago[NFC][Analyzer] Use range based for loop.
Jun Zhang [Mon, 7 Feb 2022 04:04:13 +0000 (12:04 +0800)]
[NFC][Analyzer] Use range based for loop.

Use range base loop loop to improve code readability.

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

2 years ago[JITLink] Fix the incorrect relocation behavior for R_RISCV_BRANCH
luxufan [Tue, 25 Jan 2022 16:08:39 +0000 (00:08 +0800)]
[JITLink] Fix the incorrect relocation behavior for R_RISCV_BRANCH

In D116573, the relocation behavior of R_RISCV_BRANCH didn't consider that branch instruction like 'bge' has a branch target address which is given as a PC-relative offset, sign-extend and multiplied by 2.
Although the target address is a 12-bits number, acctually its range is [-4096, 4094].

This patch fix it.

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

2 years ago[llvm] Use = default (NFC)
Kazu Hirata [Mon, 7 Feb 2022 06:18:35 +0000 (22:18 -0800)]
[llvm] Use = default (NFC)

2 years ago[NFC] Precommit test case for PR53357
Chuanqi Xu [Mon, 7 Feb 2022 04:47:14 +0000 (12:47 +0800)]
[NFC] Precommit test case for PR53357

2 years ago[DAGCombiner][AArch64] Enhance to support for scalar CSINC
zhongyunde 00443407 [Mon, 10 Jan 2022 01:18:57 +0000 (09:18 +0800)]
[DAGCombiner][AArch64] Enhance to support for scalar CSINC

Enhance to fold csel into csinc instruction.
Fix https://github.com/llvm/llvm-project/issues/53071

Reviewed By: dmgreen

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

2 years ago[X86] Add pre-commit test for bit test optimization. NFC
Phoebe Wang [Mon, 7 Feb 2022 01:22:19 +0000 (09:22 +0800)]
[X86] Add pre-commit test for bit test optimization. NFC

2 years ago[mlir][bazel] Update post ControlFlow dialect split
Jacques Pienaar [Mon, 7 Feb 2022 01:21:48 +0000 (17:21 -0800)]
[mlir][bazel] Update post ControlFlow dialect split