platform/upstream/llvm.git
3 years agoFix test that was never run.
Paul Robinson [Fri, 30 Jul 2021 14:22:56 +0000 (07:22 -0700)]
Fix test that was never run.

Commit 83df122 (r368334) added 'REQUIRES: linux' to this test, but
because triples are not respected by REQUIRES, that meant it was
invariably Unsupported.  The correct keyword would be 'system-linux'
(checking the host rather than the target).

Because the test was always skipped, commit 0cfd9e5 (r375439) did not
notice that the test modification was incorrect.

This patch corrects the REQUIRES clause and fixes the incorrect
previous patch.

Found after implementing https://reviews.llvm.org/D107162

3 years ago[OpenMP][AMDGCN] Initial math headers support
Pushpinder Singh [Fri, 30 Jul 2021 08:56:40 +0000 (08:56 +0000)]
[OpenMP][AMDGCN] Initial math headers support

With this patch, OpenMP on AMDGCN will use the math functions
provided by ROCm ocml library. Linking device code to the ocml will be
done in the next patch.

Reviewed By: JonChesterfield, jdoerfert, scchan

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

3 years ago[NFC] clang-format OptimizationLevel.h
Mircea Trofin [Fri, 30 Jul 2021 14:44:03 +0000 (07:44 -0700)]
[NFC] clang-format OptimizationLevel.h

3 years ago[PowerPC] Emit error for Altivec vector initializations when -faltivec-src-compat...
Amy Kwan [Fri, 30 Jul 2021 13:50:44 +0000 (08:50 -0500)]
[PowerPC] Emit error for Altivec vector initializations when -faltivec-src-compat=gcc is specified

Under the -faltivec-src-compat=gcc option, AltiVec vector initialization should
be treated as if they were compiled with gcc - which is, to emit an error when
the vectors are initialized in the parenthesized or non-parenthesized manner.
This patch implements this behaviour.

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

3 years ago[mlir][Vector] Add vector to outerproduct lowering for the [reduction, parallel]...
Nicolas Vasilache [Fri, 2 Jul 2021 20:09:29 +0000 (20:09 +0000)]
[mlir][Vector] Add vector to outerproduct lowering for the [reduction, parallel] case.

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

3 years ago[OpenMP][NFC] libomp: silence warnings on unused variables.
AndreyChurbanov [Fri, 30 Jul 2021 14:04:42 +0000 (17:04 +0300)]
[OpenMP][NFC] libomp: silence warnings on unused variables.

Put declarations/definitions of unused variables under corresponding macros
to silence clang build warnings.

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

3 years ago[clang][patch][FPEnv] Fix syntax errors in pragma float_control test
Melanie Blower [Fri, 30 Jul 2021 13:59:26 +0000 (09:59 -0400)]
[clang][patch][FPEnv] Fix syntax errors in pragma float_control test

In a post-commit message to https://reviews.llvm.org/D102343
@MaskRay pointed out syntax errors in one of the test cases. This
patch fixes those problems, I had forgotten the colon after the CHECK- strings.

3 years ago[AMDGPU][OpenMP] Support linking of math libraries
Pushpinder Singh [Wed, 14 Jul 2021 14:07:04 +0000 (14:07 +0000)]
[AMDGPU][OpenMP] Support linking of math libraries

Math libraries are linked only when -lm is specified. This is because
host system could be missing rocm-device-libs.

Reviewed By: JonChesterfield, yaxunl

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

3 years ago[libc++][NFC] Fix copy-paste error in the transform_view tests
Louis Dionne [Fri, 30 Jul 2021 13:51:51 +0000 (09:51 -0400)]
[libc++][NFC] Fix copy-paste error in the transform_view tests

3 years ago[ARM] Attempt to distribute reductions
David Green [Fri, 30 Jul 2021 13:48:31 +0000 (14:48 +0100)]
[ARM] Attempt to distribute reductions

This adds a combine for adds of reductions, distributing them so that
they occur sequentially to enable better use of accumulating VADDVA
instructions. It combines:
  add(X, add(vecreduce(Y), vecreduce(Z))) ->
    add(add(X, vecreduce(Y)), vecreduce(Z))
and
  add(add(A, reduce(B)), add(C, reduce(D))) ->
    add(add(add(A, C), reduce(B)), reduce(D))

These together distribute the add's so that more reductions can be
selected to VADDVA.

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

3 years ago[libomptarget][amdcgn] Add build dependency for opt
Joachim Protze [Fri, 30 Jul 2021 13:43:30 +0000 (15:43 +0200)]
[libomptarget][amdcgn] Add build dependency for opt

This patch should fix the build we observe when building LLVM from scratch.

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

3 years ago[libc++] Handle arrays in std::destroy_at
Louis Dionne [Tue, 27 Jul 2021 19:45:09 +0000 (15:45 -0400)]
[libc++] Handle arrays in std::destroy_at

Also, improve tests for std::destroy and std::destroy_n so that they
check for array support.

These changes are part of http://wg21.link/p0896 (the One Ranges proposal).

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

3 years ago[clangd] Record remote index usage
Kadir Cetinkaya [Mon, 26 Jul 2021 15:08:03 +0000 (17:08 +0200)]
[clangd] Record remote index usage

This is a gauage metric that sets particular remote-index instances as
used. It should enable accumulation of multiple streams to see number of clangd
processes making use of remote index, broken down by remote index address.

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

3 years ago[clangd] Unify compiler invocation creation
Kadir Cetinkaya [Fri, 23 Jul 2021 14:57:33 +0000 (16:57 +0200)]
[clangd] Unify compiler invocation creation

Background-indexing is fine, because it uses GlobalCompilationDatabase
to fetch the compile commands (hence uses CommandMangler), and creates
invocation through buildCompilerInvocation.

Depends on D106639.

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

3 years ago[X86][AVX] Add test case for PR51281
Simon Pilgrim [Fri, 30 Jul 2021 13:10:29 +0000 (14:10 +0100)]
[X86][AVX] Add test case for PR51281

3 years ago[clangd] Make use of diagnostic tags for some clang diags
Kadir Cetinkaya [Tue, 27 Jul 2021 12:25:29 +0000 (14:25 +0200)]
[clangd] Make use of diagnostic tags for some clang diags

It is not great to list diag ids by hand, but I don't see any other
solution unless diagnostics are annotated with these explicitly, which is a
bigger change in clang and I am not sure if would be worth it.

Diagnostics handled by this patch is by no means exhaustive, there might be
other checks that don't mention "unused"/"deprecated" in their names. But it
feels like this should be enough to catch common diagnostics and can be extended
over time.

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

3 years ago[hwasan] Detect use after scope within function.
Florian Mayer [Tue, 27 Jul 2021 08:43:59 +0000 (09:43 +0100)]
[hwasan] Detect use after scope within function.

Reviewed By: vitalybuka

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

3 years agoRevert "[lldb] [DWARF-5] Be lazier about loading .dwo files"
Jan Kratochvil [Fri, 30 Jul 2021 12:54:27 +0000 (14:54 +0200)]
Revert "[lldb] [DWARF-5] Be lazier about loading .dwo files"

This reverts commit e7b8ba103a8411fb25237727c3822d4c431e4814.

It broke 32-bit ARM - lldb-arm-ubuntu, reported by omjavaid:
  https://lab.llvm.org/buildbot/#/builders/17/builds/9595

3 years ago[SLP]Fix an assertion for the size of user nodes.
Alexey Bataev [Thu, 29 Jul 2021 14:12:15 +0000 (07:12 -0700)]
[SLP]Fix an assertion for the size of user nodes.

For the nodes with reused scalars the user may be not only of the size
of the final shuffle but also of the size of the scalars themselves,
need to check for this. It is safe to just modify the check here, since
the order of the scalars themselves is preserved, only indeces of the
reused scalars are changed. So, the users with the same size as the
number of scalars in the node, will not be affected, they still will get
the operands in the required order.

Reported by @mstorsjo in D105020.

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

3 years ago[SLP]Do not consider deleted instruction as external users.
Alexey Bataev [Thu, 29 Jul 2021 21:29:08 +0000 (14:29 -0700)]
[SLP]Do not consider deleted instruction as external users.

If the instruction was previously deleted, it should not be treated as
an external user. This fixes cost estimation and removes dead
extractelement instructions.

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

3 years ago[clangd] Enable relative configs in check mode
Kadir Cetinkaya [Fri, 30 Jul 2021 05:39:46 +0000 (07:39 +0200)]
[clangd] Enable relative configs in check mode

See https://github.com/clangd/clangd/issues/649#issuecomment-885903316.
Also disables config support in lit tests to make sure tests are not affected by
clangd config files lying around.

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

3 years ago[SLP]Fix a crash in gathered loads analysis.
Alexey Bataev [Thu, 29 Jul 2021 12:05:29 +0000 (05:05 -0700)]
[SLP]Fix a crash in gathered loads analysis.

Need to check that the minimum acceptable vector factor is at least 2,
not 0, to avoid compiler crash during gathered loads analysis.

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

3 years ago[OMPIRBuilder] add minimalist reduction support
Alex Zinenko [Fri, 30 Jul 2021 09:46:26 +0000 (11:46 +0200)]
[OMPIRBuilder] add minimalist reduction support

This introduces a builder function for emitting IR performing reductions in
OpenMP. Reduction variable privatization and initialization to the
reduction-neutral value is expected to be handled separately. The caller
provides the reduction functions. Further commits can provide implementation of
reduction functions for the reduction operators defined in the OpenMP
specification.

This implementation was tested on an MLIR fork targeting OpenMP from C and
produced correct executable code.

Reviewed By: Meinersbur

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

3 years ago[lldb] [DWARF-5] Be lazier about loading .dwo files
Eric Leese [Fri, 30 Jul 2021 11:08:00 +0000 (13:08 +0200)]
[lldb] [DWARF-5] Be lazier about loading .dwo files

This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Review By: jankratochvil, dblaikie

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

3 years agotsan: fix another latent race size bug in test
Dmitry Vyukov [Fri, 30 Jul 2021 10:42:35 +0000 (12:42 +0200)]
tsan: fix another latent race size bug in test

The test contains a race in memset.
The size of reported race depends on how the accessed
memory range split into granules inside of tsan runtime.
The test used to report access of size 8, because presumably
the buffer ended up being aligned to 8 bytes. But after
some unrelated changes this test started to report accesses
of size 1 (presumably .data layout changed), which makes
the test fail.
Guarantee alignment of the buf object explicitly.

Reviewed By: melver

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

3 years agotsan: Support constructor arguments via New
Marco Elver [Fri, 30 Jul 2021 10:22:07 +0000 (12:22 +0200)]
tsan: Support constructor arguments via New

Make New<>() a variadic function template and forward any arguments to
the constructor. std::forward<>() is inlined to avoid including
<utility>.

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

3 years ago[lldb][AArch64] Mark mismatched tags in tag read output
David Spickett [Mon, 12 Apr 2021 10:42:26 +0000 (11:42 +0100)]
[lldb][AArch64] Mark mismatched tags in tag read output

The "memory tag read" command will now tell you
when the allocation tag read does not match the logical
tag.

(lldb) memory tag read mte_buf+(8*16) mte_buf+(8*16)+48
Logical tag: 0x9
Allocation tags:
[0xfffff7ff7080, 0xfffff7ff7090): 0x8 (mismatch)
[0xfffff7ff7090, 0xfffff7ff70a0): 0x9
[0xfffff7ff70a0, 0xfffff7ff70b0): 0xa (mismatch)

The logical tag will be taken from the start address
so the end could have a different tag. You could for example
read from ptr_to_array_1 to ptr_to_array_2. Where the latter
is tagged differently to prevent buffer overflow.

The existing command will read 1 granule if you leave
off the end address. So you can also use it as a quick way
to check a single location.

(lldb) memory tag read mte_buf
Logical tag: 0x9
Allocation tags:
[0xfffff7ff7000, 0xfffff7ff7010): 0x0 (mismatch)

This avoids the need for a seperate "memory tag check" command.

Reviewed By: omjavaid

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

3 years ago[lldb] Correct format of qMemTags type field
David Spickett [Fri, 25 Jun 2021 13:29:12 +0000 (14:29 +0100)]
[lldb] Correct format of qMemTags type field

The type field is a signed integer.
(https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html)

However it's not packed in the packet in the way
you might think. For example the type -1 should be:
qMemTags:<addr>,<len>:ffffffff
Instead of:
qMemTags:<addr>,<len>:-1

This change makes lldb-server's parsing more strict
and adds more tests to check that we handle negative types
correctly in lldb and lldb-server.

We only support one tag type value at this point,
for AArch64 MTE, which is positive. So this doesn't change
any of those interactions. It just brings us in line with GDB.

Also check that the test target has MTE. Previously
we just checked that we were AArch64 with a toolchain
that supports MTE.

Finally, update the tag type check for QMemTags to use
the same conversion steps that qMemTags now does.
Using static_cast can invoke UB and though we do do a limit
check to avoid this, I think it's clearer with the new method.

Reviewed By: omjavaid

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

3 years ago[mlir][affine-loop-fusion] Fix a bug that AffineIfOp prevents fusion of the other...
Tung D. Le [Fri, 30 Jul 2021 09:52:21 +0000 (15:22 +0530)]
[mlir][affine-loop-fusion] Fix a bug that AffineIfOp prevents fusion of the other loops

The presence of AffineIfOp inside AffineFor prevents fusion of the other loops to happen. For example:

```
  affine.for %i0 = 0 to 10 {
    affine.store %cf7, %a[%i0] : memref<10xf32>
  }
  affine.for %i1 = 0 to 10 {
    %v0 = affine.load %a[%i1] : memref<10xf32>
    affine.store %v0, %b[%i1] : memref<10xf32>
  }
  affine.for %i2 = 0 to 10 {
    affine.if #set(%i2) {
      %v0 = affine.load %b[%i2] : memref<10xf32>
    }
  }
```

The first two loops were not be fused because of `affine.if` inside the last `affine.for`.

The issue seems to come from a conservative constraint that does not allow fusion if there are ops whose number of regions != 0 (affine.if is one of them).

This patch just removes such a constraint when`affine.if` is inside `affine.for`.  The existing `canFuseLoops` method is able to handle `affine.if` correctly.

Reviewed By: bondhugula, vinayaka-polymage

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

3 years agotsan: introduce New/Alloc/Free helpers
Dmitry Vyukov [Thu, 29 Jul 2021 16:14:22 +0000 (18:14 +0200)]
tsan: introduce New/Alloc/Free helpers

We frequenty allocate sizeof(T) memory and call T ctor on that memory
(C++ new keyword effectively). Currently it's quite verbose and
usually takes 2 lines of code.
Add New<T>() helper that does it much more concisely.

Rename internal_free to Free that also sets the pointer to nullptr.
Shorter and safer.

Rename internal_alloc to Alloc, just shorter.

Reviewed By: vitalybuka, melver

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

3 years ago[mlir][spirv] Fix crash in convert-gpu-to-spirv pass with memrefs with affine maps
Butygin [Wed, 28 Jul 2021 19:31:26 +0000 (22:31 +0300)]
[mlir][spirv] Fix crash in convert-gpu-to-spirv pass with memrefs with affine maps

spirv::getElementPtr can return null (for memrefs with affine map) but patterns didn't handle this.

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

3 years ago[clang] SIGSEGV at DeduceTemplateArgumentsByTypeMatch
Ivan Murashko [Fri, 30 Jul 2021 06:20:38 +0000 (09:20 +0300)]
[clang] SIGSEGV at DeduceTemplateArgumentsByTypeMatch

There is a SIGSEGV at `DeduceTemplateArgumentsByTypeMatch`. The bug [#51171](https://bugs.llvm.org/show_bug.cgi?id=51171) was filled. The reproducer can be found at the bug description.

LIT test for the issue was added:
```
./bin/llvm-lit -v ../clang/test/SemaCXX/pr51171-crash.cpp
```

The debug stack trace is below:
```
 #0 0x00000000055afcb9 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/ivanmurashko/local/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:22
 #1 0x00000000055afd70 PrintStackTraceSignalHandler(void*) /home/ivanmurashko/local/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
 #2 0x00000000055add2d llvm::sys::RunSignalHandlers() /home/ivanmurashko/local/llvm-project/llvm/lib/Support/Signals.cpp:97:20
 #3 0x00000000055af701 SignalHandler(int) /home/ivanmurashko/local/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007ffff7bc2b20 __restore_rt sigaction.c:0:0
 #5 0x00007ffff66a337f raise (/lib64/libc.so.6+0x3737f)
 #6 0x00007ffff668ddb5 abort (/lib64/libc.so.6+0x21db5)
 #7 0x00007ffff668dc89 _nl_load_domain.cold.0 loadmsgcat.c:0:0
 #8 0x00007ffff669ba76 .annobin___GI___assert_fail.end assert.c:0:0
 #9 0x000000000594b210 clang::QualType::getCommonPtr() const /home/ivanmurashko/local/llvm-project/clang/include/clang/AST/Type.h:684:5
#10 0x0000000005a12ca6 clang::QualType::getCanonicalType() const /home/ivanmurashko/local/llvm-project/clang/include/clang/AST/Type.h:6467:36
#11 0x0000000005a137a6 clang::ASTContext::getCanonicalType(clang::QualType) const /home/ivanmurashko/local/llvm-project/clang/include/clang/AST/ASTContext.h:2433:58
#12 0x0000000009204584 DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:1355:54
#13 0x000000000920df0d clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:4354:47
#14 0x0000000009012b09 (anonymous namespace)::AddressOfFunctionResolver::AddMatchingTemplateFunction(clang::FunctionTemplateDecl*, clang::DeclAccessPair const&) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:12026:38
#15 0x0000000009013030 (anonymous namespace)::AddressOfFunctionResolver::FindAllFunctionsThatMatchTargetTypeExactly() /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:12119:9
#16 0x0000000009012679 (anonymous namespace)::AddressOfFunctionResolver::AddressOfFunctionResolver(clang::Sema&, clang::Expr*, clang::QualType const&, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:11931:5
#17 0x0000000009013c91 clang::Sema::ResolveAddressOfOverloadedFunction(clang::Expr*, clang::QualType, bool, clang::DeclAccessPair&, bool*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:12286:42
#18 0x0000000008fed85d IsStandardConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::StandardConversionSequence&, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:1712:49
#19 0x0000000008fec8ea TryImplicitConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:1433:27
#20 0x0000000008ff90ba TryCopyInitialization(clang::Sema&, clang::Expr*, clang::QualType, bool, bool, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:5273:71
#21 0x00000000090024fb clang::Sema::AddBuiltinCandidate(clang::QualType*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, unsigned int) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:7755:32
#22 0x000000000900513f (anonymous namespace)::BuiltinOperatorOverloadBuilder::addGenericBinaryArithmeticOverloads() /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:8633:30
#23 0x0000000009007624 clang::Sema::AddBuiltinOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:9205:51
#24 0x0000000009018734 clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:13469:1
#25 0x0000000009018d56 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:13568:24
#26 0x0000000008b24797 BuildOverloadedBinOp(clang::Sema&, clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaExpr.cpp:14606:65
#27 0x0000000008b24ed5 clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaExpr.cpp:14691:73
#28 0x0000000008b245d4 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaExpr.cpp:14566:1
#29 0x00000000085bfafb clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseExpr.cpp:630:71
#30 0x00000000085bd922 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseExpr.cpp:177:1
#31 0x00000000085cbbcd clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&, llvm::SmallVectorImpl<clang::SourceLocation>&, llvm::function_ref<void ()>) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseExpr.cpp:3368:40
#32 0x000000000857f49c clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseDecl.cpp:2416:5
#33 0x000000000857df16 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseDecl.cpp:2092:65
#34 0x000000000855f07b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/Parser.cpp:1138:1
#35 0x000000000855f136 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/Parser.cpp:1153:57
#36 0x000000000855e644 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/Parser.cpp:975:58
#37 0x000000000855d717 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/Parser.cpp:720:42
#38 0x0000000008558e01 clang::ParseAST(clang::Sema&, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseAST.cpp:158:37
#39 0x000000000627a221 clang::ASTFrontendAction::ExecuteAction() /home/ivanmurashko/local/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1058:11
#40 0x0000000006bdcc31 clang::CodeGenAction::ExecuteAction() /home/ivanmurashko/local/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1045:5
#41 0x0000000006279b4d clang::FrontendAction::Execute() /home/ivanmurashko/local/llvm-project/clang/lib/Frontend/FrontendAction.cpp:955:38
#42 0x00000000061c3fe9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/ivanmurashko/local/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:974:42
#43 0x00000000063f9c5e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/ivanmurashko/local/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#44 0x0000000002603a03 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/ivanmurashko/local/llvm-project/clang/tools/driver/cc1_main.cpp:246:40
#45 0x00000000025f8a39 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /home/ivanmurashko/local/llvm-project/clang/tools/driver/driver.cpp:338:20
#46 0x00000000025f9107 main /home/ivanmurashko/local/llvm-project/clang/tools/driver/driver.cpp:415:26
#47 0x00007ffff668f493 __libc_start_main (/lib64/libc.so.6+0x23493)
#48 0x00000000025f729e _start (/data/users/ivanmurashko/llvm-project/build/bin/clang-13+0x25f729e)
```

Reviewed By: erichkeane

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

3 years agotsan: optimize test-only barrier
Dmitry Vyukov [Fri, 30 Jul 2021 06:35:11 +0000 (08:35 +0200)]
tsan: optimize test-only barrier

The updated lots_of_threads.c test with 300 threads
started running for too long on machines with low
hardware parallelism (e.g. taskset -c 0-1).
On lots of CPUs it finishes in ~2 secs. But with
taskset -c 0-1 it runs for hundreds of seconds
effectively spinning in the barrier in the sleep loop.

We now have the handy futex API in sanitizer_common.
Use it instead of the passive spin loop.
It makes the test run only faster with taskset -c 0-1,
it runs for ~1.5 secs, while with full parallelism
it still runs for ~2 secs (but consumes less CPU time).

Depends on D107131.

Reviewed By: vitalybuka

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

3 years agotsan: fix latent race size bug in test
Dmitry Vyukov [Fri, 30 Jul 2021 06:45:16 +0000 (08:45 +0200)]
tsan: fix latent race size bug in test

The test contains a race in read/write syscalls.
The size of reported race depends on how the accessed
memory range split into granules inside of tsan runtime.
The test used to report access of size 8, because presumably
the buffer ended up being aligned to 8 bytes. But after
some unrelated changes this test started to report accesses
of size 1 (presumably .data layout changed), which makes
the test fail.
Guarantee alignment of the buf object explicitly.

Reviewed By: vitalybuka, melver

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

3 years ago[ARM] Turn vecreduce_add(add(x, y)) into vecreduce(x) + vecreduce(y)
David Green [Fri, 30 Jul 2021 09:10:41 +0000 (10:10 +0100)]
[ARM] Turn vecreduce_add(add(x, y)) into vecreduce(x) + vecreduce(y)

Under MVE we can use VADDV/VADDVA's to perform integer add reductions,
so it can be beneficial to use more reductions than summing subvectors
and reducing once. Especially for VMLAV/VMLAVA the mul can be
incorporated into the reduction, producing less instructions.

Some of the test cases currently get larger due to extra integer adds,
but will be improved in a followup patch.

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

3 years ago[ARM] MVE SLP'd reduction tests. NFC
David Green [Fri, 30 Jul 2021 08:43:29 +0000 (09:43 +0100)]
[ARM] MVE SLP'd reduction tests. NFC

These are generated from SLP vectorization, for example
https://godbolt.org/z/ebxdPh1Kz. These backend tests
show cases that we can produce better code for.

3 years agoRevert "[LLDB][GUI] Expand selected thread tree item by default"
Muhammad Omair Javaid [Thu, 29 Jul 2021 11:15:27 +0000 (16:15 +0500)]
Revert "[LLDB][GUI] Expand selected thread tree item by default"

This reverts commit fed25ddc1c3de59aa1de27e95b349f86896ccb79.

There has been sporadic failures in LLDB AArch64/Arm 32 buildbots since
this commit. I am temporarily reverting it see if it fixes the issue.

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

3 years ago[OpenCL] Add std flag aliases clc++1.0 and CLC++1.0
Anastasia Stulova [Thu, 29 Jul 2021 14:10:13 +0000 (15:10 +0100)]
[OpenCL] Add std flag aliases clc++1.0 and CLC++1.0

Renamed language standard from openclcpp to openclcpp10.
Added new std values i.e. '-cl-std=clc++1.0' and
'-cl-std=CLC++1.0'.

Patch by Topotuna (Justas Janickas)!

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

3 years ago[flang] Fix `flang` (the bash wrapper script for the Flang driver)
Andrzej Warzynski [Fri, 30 Jul 2021 07:59:13 +0000 (08:59 +0100)]
[flang] Fix `flang` (the bash wrapper script for the Flang driver)

Remove erroneous `||` at the end of an `if` condition. This was
introduced in https://reviews.llvm.org/D106871.

3 years ago[AArch64][SME] Introduce feature for streaming mode
Cullen Rhodes [Fri, 30 Jul 2021 07:30:45 +0000 (07:30 +0000)]
[AArch64][SME] Introduce feature for streaming mode

The Scalable Matrix Extension (SME) introduces a new execution mode
called Streaming SVE mode. In streaming mode a substantial subset of the
SVE and SVE2 instruction set is available, along with new outer product,
load, store, extract and insert instructions that operate on the new
architectural register state for the matrix.

To support streaming mode this patch introduces a new subtarget feature
+streaming-sve. If enabled, the subset of SVE(2) instructions are
available. The existing behaviour for SVE(2) remains unchanged, the
subset of instructions that are legal in streaming mode are enabled if
either +sve[2] or +streaming-sve is specified. Instructions that are
illegal in streaming mode remain predicated on +sve[2].

The SME target feature has been updated to imply +streaming-sve rather
than +sve.

The following changes are made to the SVE(2) tests:
  * For instructions that are legal in streaming mode:
    - added RUN line to verify +streaming-sve enables the instruction.
    - updated diagnostic to 'instruction requires: streaming-sve or sve'.
  * For instructions that are illegal in streaming-mode:
    - added RUN line to verify +streaming-sve does not enable the
      instruction.

SVE(2) instructions that are legal in streaming mode have:

  if !HaveSVE[2]() && !HaveSME() then UNDEFINED;

at the top of the pseudocode in the XML.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06/SVE-Instructions

Reviewed By: sdesmalen, david-arm

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

3 years ago[JITLink][ELF][x86-64] Include relocation name in missing relocation errors.
Lang Hames [Fri, 30 Jul 2021 04:26:07 +0000 (14:26 +1000)]
[JITLink][ELF][x86-64] Include relocation name in missing relocation errors.

This saves a level of manual table lookup for those of us who don't remember
ELF relocation numbers off the top of our heads.

3 years agoTake OptimizationLevel class out of Pass Builder
Tarindu Jayatilaka [Fri, 30 Jul 2021 04:42:05 +0000 (21:42 -0700)]
Take OptimizationLevel class out of Pass Builder

Pulled out the OptimizationLevel class from PassBuilder in order to be able to access it from within the PassManager and avoid include conflicts.

Reviewed By: mtrofin

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

3 years ago[OpenCL] opencl-c.h: add CL 3.0 non-generic address space atomics
Dave Airlie [Fri, 30 Jul 2021 04:46:47 +0000 (14:46 +1000)]
[OpenCL] opencl-c.h: add CL 3.0 non-generic address space atomics

CL 2.0 introduced atomics and generic address space so there were
only one set of APIs for doing atomics, however since CL 3.0
makes generic address space optional, there has to be new sets
of atomic interfaces to handle that cases.

Reviewed By: Anastasia

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

3 years agoFix scalar unit tests for all, any, maxloc, etc. that caused the ARM build
Mark Leair [Fri, 30 Jul 2021 04:13:46 +0000 (21:13 -0700)]
Fix scalar unit tests for all, any, maxloc, etc. that caused the ARM build
to fail due to warnings as errors. Note that I could not reproduce the
problem locally, but based on the messages, I think this change will fix
the errors.

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

3 years agoRevert "[OpenCL] Add support of __opencl_c_pipes feature macro."
Anton Zabaznov [Fri, 30 Jul 2021 03:34:17 +0000 (06:34 +0300)]
Revert "[OpenCL] Add support of __opencl_c_pipes feature macro."

This reverts commit d1e4b25756730576996457ba7324e9bf210e3693.

3 years ago[OpenCL] Add support of __opencl_c_pipes feature macro.
Anton Zabaznov [Fri, 30 Jul 2021 01:56:21 +0000 (04:56 +0300)]
[OpenCL] Add support of __opencl_c_pipes feature macro.

'pipe' keyword is introduced in OpenCL C 2.0: so do checks for OpenCL C version while
parsing and then later on check for language options to construct actual pipe. This feature
requires support of __opencl_c_generic_address_space, so diagnostics for that is provided as well.

Reviewed By: Anastasia

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

3 years ago[PowerPC] Fix issue where hint was providing the incorrect regsiter class.
Stefan Pintilie [Thu, 29 Jul 2021 20:06:13 +0000 (15:06 -0500)]
[PowerPC] Fix issue where hint was providing the incorrect regsiter class.

Regsier hints when copying to a UACC register do not always produce VSRp
registers. This patch makes sure that we do not produce hints in cases
where the subregsiter of the UACC is not a VSRp.

Reviewed By: nemanjai, #powerpc

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

3 years ago[yaml2obj] Enable support for parsing 64-bit XCOFF.
Esme-Yi [Fri, 30 Jul 2021 02:06:04 +0000 (02:06 +0000)]
[yaml2obj] Enable support for parsing 64-bit XCOFF.

Summary: Add support for yaml2obj to parse 64-bit XCOFF.

Reviewed By: shchenz

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

3 years ago[nfc][trace] use formatv instead of the old Printf
Walter Erquinigo [Fri, 30 Jul 2021 02:04:27 +0000 (19:04 -0700)]
[nfc][trace] use formatv instead of the old Printf

It was suggested in https://reviews.llvm.org/D105741 and it makes sense.

3 years ago[OpenCL] Add support of __opencl_c_3d_image_writes feature macro
Anton Zabaznov [Fri, 30 Jul 2021 01:19:17 +0000 (04:19 +0300)]
[OpenCL] Add support of __opencl_c_3d_image_writes feature macro

This feature requires support of __opencl_c_images, so diagnostics for that is provided as well.
Also, ensure that cl_khr_3d_image_writes feature macro is set to the same value.

Reviewed By: Anastasia

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

3 years agotsan: Fix the improper argument type in tsan_ilist_test.cpp
Victor Huang [Fri, 30 Jul 2021 01:44:01 +0000 (20:44 -0500)]
tsan: Fix the improper argument type in tsan_ilist_test.cpp

- clang-ppc64le-rhel bot LIT failure: https://lab.llvm.org/buildbot/#/builders/57/builds/8932
- culprit change: https://reviews.llvm.org/D107050

3 years ago[AIX] Include symbol alias in extract_symbols.py
Jinsong Ji [Fri, 30 Jul 2021 01:16:48 +0000 (01:16 +0000)]
[AIX] Include symbol alias in extract_symbols.py

nm does not show size for aliased symbols,
we should still extract them if they are external.

Reviewed By: hubert.reinterpretcast

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

3 years ago[source map] fix relative path breakpoints
Walter Erquinigo [Fri, 30 Jul 2021 01:14:34 +0000 (18:14 -0700)]
[source map] fix relative path breakpoints

https://reviews.llvm.org/D45592 added a nice feature to be able to specify a breakpoint by a relative path. E.g. passing foo.cpp or bar/foo.cpp or zaz/bar/foo.cpp is fine. However, https://reviews.llvm.org/D68671 by mistake disabled the test that ensured this functionality works. With time, someone made a small mistake and fully broke the functionality.

So, I'm making a very simple fix and the test passes.

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

3 years ago[Bazel] Make td_library usable as data
Geoffrey Martin-Noble [Wed, 28 Jul 2021 00:01:19 +0000 (17:01 -0700)]
[Bazel] Make td_library usable as data

This patch makes it possible to list a td_library as a rule's data
attribute and get its source files and all its transitive dependencies
at runtime. This is useful for, e.g. shell tests running tblgen.

Note that this is a bit different from how a "normal" (e.g. C++) library
rule would work because those have actual library outputs and the
td_library rule just bundles some source files and includes. If someone
wanted to make use of the includes, they would have to access the TdInfo
provider, but this keeps simple things simple.

Reviewed By: jpienaar

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

3 years ago[Bazel] Unconditionally define STDC LIMIT/CONSTANT/FORMAT
Geoffrey Martin-Noble [Fri, 30 Jul 2021 00:41:43 +0000 (17:41 -0700)]
[Bazel] Unconditionally define STDC LIMIT/CONSTANT/FORMAT

These are unconditionally included in the CMake build as well and
necessary for some odd platforms (even though the C++11 standard says
they shouldn't be).

Reviewed By: chandlerc

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

3 years ago[Bazel] Derive targets from file presence as in CMake build
Geoffrey Martin-Noble [Thu, 29 Jul 2021 01:39:51 +0000 (18:39 -0700)]
[Bazel] Derive targets from file presence as in CMake build

This makes the logic used to determine if targets have the given
features the same as is used in CMake. Incidentally, it enables these
features for the targets added in https://reviews.llvm.org/D106921
which were missing because this was previously a hardcoded list.

Reviewed By: chandlerc

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

3 years ago[ARC] Add norm/normh instructions with disassembly tests
Mark Schimmel [Fri, 30 Jul 2021 00:51:47 +0000 (17:51 -0700)]
[ARC] Add norm/normh instructions with disassembly tests
Add disassembler support for the NORM and NORMH instructions. These instructions
only exist when the ARC processor is configured with the "norm" extension.

fferential Revision: https://reviews.llvm.org/D107118

3 years ago[MLIR][python] Disable SONAME on extensions.
Stella Laurenzo [Thu, 29 Jul 2021 22:23:32 +0000 (22:23 +0000)]
[MLIR][python] Disable SONAME on extensions.

* Broken out of https://reviews.llvm.org/D106419
* Otherwise, same named modules will conflict with each other.

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

3 years agoOptimize mul in the zba extension with SH*ADD
Ben Shi [Thu, 29 Jul 2021 12:39:54 +0000 (20:39 +0800)]
Optimize mul in the zba extension with SH*ADD

This patch does the following optimization of mul with a constant.

(mul x, 11) -> (SH1ADD (SH2ADD x, x), x)
(mul x, 19) -> (SH1ADD (SH3ADD x, x), x)
(mul x, 13) -> (SH2ADD (SH1ADD x, x), x)
(mul x, 21) -> (SH2ADD (SH2ADD x, x), x)
(mul x, 37) -> (SH2ADD (SH3ADD x, x), x)
(mul x, 25) -> (SH3ADD (SH1ADD x, x), x)
(mul x, 41) -> (SH3ADD (SH2ADD x, x), x)
(mul x, 73) -> (SH3ADD (SH3ADD x, x), x)
(mul x, 27) -> (SH1ADD (SH3ADD x, x), (SH3ADD x, x))
(mul x, 45) -> (SH2ADD (SH3ADD x, x), (SH3ADD x, x))
(mul x, 81) -> (SH3ADD (SH3ADD x, x), (SH3ADD x, x))

Reviewed By: craig.topper

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

3 years ago[RISCV][test] Add new tests for mul optimization in the zba extension with SH*ADD
Ben Shi [Thu, 29 Jul 2021 11:48:09 +0000 (19:48 +0800)]
[RISCV][test] Add new tests for mul optimization in the zba extension with SH*ADD

Reviewed By: craig.topper

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

3 years ago[AVR][clang] Pass '--start-group' and '--end-group' options to avr-ld
Matt Jacobson [Fri, 30 Jul 2021 00:22:53 +0000 (08:22 +0800)]
[AVR][clang] Pass '--start-group' and '--end-group' options to avr-ld

Reviewed By: Ben Shi

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

3 years ago[GlobalISel] Refactor the unmerge artifact value finder code.
Amara Emerson [Fri, 30 Jul 2021 00:07:19 +0000 (17:07 -0700)]
[GlobalISel] Refactor the unmerge artifact value finder code.

I moved the code that tries to combine away each unmerge def into a method in
ArtifactValueFinder class itself. This removes a logically messy lambda and
makes it easier to use the value-finder in more places in future.

3 years ago[compiler-rt] Fix COMPILER_RT_OS_DIR for Android
Shoaib Meenai [Thu, 29 Jul 2021 23:46:38 +0000 (16:46 -0700)]
[compiler-rt] Fix COMPILER_RT_OS_DIR for Android

Android has its own CMAKE_SYSTEM_NAME, but the OS is Linux (Android
target triples look like aarch64-none-linux-android21). The driver will
therefore search for compiler-rt libraries in the "linux" directory and
not the "android" directory, so the default placement of Android
compiler-rt libraries was incorrect. You could fix it by specifying
COMPILER_RT_OS_DIR manually, but it also makes sense to fix the default,
to save others from having to discover and fix the issue for themselves.

3 years ago[ARC] Add additional mov immediate instruction formats with a fix for u6 decoding
Thomas Johnson [Thu, 29 Jul 2021 22:25:48 +0000 (22:25 +0000)]
[ARC] Add additional mov immediate instruction formats with a fix for u6 decoding

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

3 years ago[OpenMP] Adding flags for disabling the following optimizations: Deglobalization...
Joseph Huber [Thu, 29 Jul 2021 19:27:58 +0000 (15:27 -0400)]
[OpenMP] Adding flags for disabling the following optimizations: Deglobalization SPMDization State machine rewrites Folding

This work provides four flags to disable four different sets of OpenMP optimizations. These flags take effect in llvm/lib/Transforms/IPO/OpenMPOpt.cpp and include the following:
 - openmp-opt-disable-deglobalization: Defaults to false, adding this flag sets the variable DisableOpenMPOptDeglobalization to true. This prevents AA registration for HeapToStack and HeapToShared.
 - openmp-opt-disable-spmdization: Defaults to false, adding this flag sets the variable DisableOpenMPOptSPMDization to true. This indicates a pessimistic fixpoint in changeToSPMDMode.
 - openmp-opt-disable-folding: Defaults to false, adding this flag sets the variable DisableOpenMPOptFolding to true. This indicates a pessimistic fixpoint in the attributor init for AAFoldRuntimeCall.
 - openmp-opt-disable-state-machine-rewrite: Defaults to false, adding this flag sets the variable DisableOpenMPOptStateMachineRewrite to true. This first prevents changes to the state machine in rewriteDeviceCodeStateMachine by returning before changes are made, and if a custom state machine is built in buildCustomStateMachine, stops by returning a pessimistic fixpoint.

Reviewed By: jhuber6

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

3 years agoMake testcase more robust against codegen changes
Adrian Prantl [Thu, 29 Jul 2021 23:23:00 +0000 (16:23 -0700)]
Make testcase more robust against codegen changes

3 years agoFix typo
Adrian Prantl [Thu, 29 Jul 2021 23:21:33 +0000 (16:21 -0700)]
Fix typo

3 years ago[InstCombine] add tests for vector cmp-bitcast; NFC
Sanjay Patel [Thu, 29 Jul 2021 21:30:42 +0000 (17:30 -0400)]
[InstCombine] add tests for vector cmp-bitcast; NFC

3 years agoGlobalISel/AArch64: don't optimize away redundant branches at -O0
Adrian Prantl [Wed, 30 Jun 2021 22:40:45 +0000 (15:40 -0700)]
GlobalISel/AArch64: don't optimize away redundant branches at -O0

This patch prevents GlobalISel from optimizing out redundant branch
instructions when compiling without optimizations.

The motivating example is code like the following common pattern in
Swift, where users expect to be able to set a breakpoint on the early
exit:

public func f(b: Bool) {
  guard b else {
    return // I would like to set a breakpoint here.
  }
  ...
}

The patch modifies two places in GlobalISEL: The first one is in
IRTranslator.cpp where the removal of redundant branches is made
conditional on the optimization level. The second one is in
AArch64InstructionSelector.cpp where an -O0 *only* optimization is
being removed.

Disabling these optimizations increases code size at -O0 by
~8%. However, doing so improves debuggability, and debug builds are
the primary reason why developers compile without optimizations. We
thus concluded that this is the right trade-off.

rdar://79515454

This tenatively reapplies the patch without modifications, the LLDB
test that has blocked this from landing previously has since been
modified to hopefully no longer be sensitive to this change.

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

3 years ago[mlir] Set insertion point of vector constant to the top of the vectorized loop body
Amy Zhuang [Thu, 29 Jul 2021 22:39:49 +0000 (15:39 -0700)]
[mlir] Set insertion point of vector constant to the top of the vectorized loop body

When we vectorize a scalar constant, the vector constant is inserted before its
first user if the scalar constant is defined outside the loops to be vectorized.
It is possible that the vector constant does not dominate all its users. To fix
the problem, we find the innermost vectorized loop that encloses that first user
and insert the vector constant at the top of the loop body.

Reviewed By: nicolasvasilache

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

3 years agosecurity: highlight phab accounts; recommend phab for nominations
George Burgess IV [Thu, 29 Jul 2021 22:25:48 +0000 (22:25 +0000)]
security: highlight phab accounts; recommend phab for nominations

This commit contains two mildly separate concepts.

First, sending out reviews for things like this is a bit of a
complicated endeavor, since the reviewer list is relatively long, and I
generally rely on prior CLs in this area to find an authoritative list.
Life's quite a bit easier if phab usernames are readily available on the
doc. So part 1 is making those available.

Second, it seems to me that, at the moment, Phabricator makes the most
sense for membership changes (incl. security group nominations). My
reasoning for this is detailed in the diff, and to some extent in
comment #1 of this bug
<https://bugs.chromium.org/p/llvm/issues/detail?id=12#c1>. This change
adds prose to recommend the use of Phabricator for nominations as a
result.

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

3 years ago[mlir][tosa] Fix tosa.reshape failures due to implicit broadcasting
Rob Suderman [Thu, 29 Jul 2021 21:38:30 +0000 (14:38 -0700)]
[mlir][tosa] Fix tosa.reshape failures due to implicit broadcasting

Make broadcastable needs the output shape to determine whether the operation
includes additional broadcasting. Include some canonicalizations for TOSA
to remove unneeded reshape.

Reviewed By: NatashaKnk

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

3 years ago[MLIR][Python] Use DEST_PREFIX when installing.
Stella Laurenzo [Thu, 29 Jul 2021 20:34:23 +0000 (20:34 +0000)]
[MLIR][Python] Use DEST_PREFIX when installing.

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

3 years agoSimplify testcase to use v instead of p (NFC)
Adrian Prantl [Thu, 29 Jul 2021 22:14:22 +0000 (15:14 -0700)]
Simplify testcase to use v instead of p (NFC)

3 years agoFix unit test checks for the scalar cases of all/any intrinsics. I
Mark Leair [Thu, 29 Jul 2021 22:03:30 +0000 (15:03 -0700)]
Fix unit test checks for the scalar cases of all/any intrinsics. I
accidentally used int64 when they should have been int32. This lead to
a Windows build unit test error (Linux did not catch the problem).

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

3 years ago[ARM] Define a couple more ssub indexes. NFC
David Green [Thu, 29 Jul 2021 22:00:35 +0000 (23:00 +0100)]
[ARM] Define a couple more ssub indexes. NFC

Same as 91bd3ad128f7b3b28bd98242e9a5df214eb04eea, this doesn't really
change anything but gives the registers better names than the ones
tablegen would define. And fills in the missing gaps.

3 years ago[GWP-ASan] Add version header.
Mitch Phillips [Thu, 29 Jul 2021 21:52:33 +0000 (14:52 -0700)]
[GWP-ASan] Add version header.

Adds magic version header to AllocatorState. This can be used by
out-of-process crash handlers, like Crashpad on Fuchsia, to do offline
reconstruction of GWP-ASan crash metadata.

Crashpad on Fuchsia is intending on dumping the AllocationMetadata pool
and the AllocatorState directly into the minidump. Then, using the
version number, they can unpack the data on serverside using a versioned
unpack tool.

Also add some asserts to make sure the version number gets bumped if the
internal structs get changed.

Reviewed By: eugenis, mcgrathr

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

3 years ago[mlir][linalg] Fix pad tensor cast folding with changed type
Yi Zhang [Sun, 25 Jul 2021 01:38:02 +0000 (21:38 -0400)]
[mlir][linalg] Fix pad tensor cast folding with changed type

`PadTensorOp` has verification logic to make sure
result dim must be static if all the padding values are static.
Cast folding might add more static information for the src operand
of `PadTensorOp` which might change a valid operation to be invalid.
Change the canonicalizing pattern to fix this.

3 years ago[ELF] Add -Bsymbolic-non-weak-functions
Fangrui Song [Thu, 29 Jul 2021 21:46:53 +0000 (14:46 -0700)]
[ELF] Add -Bsymbolic-non-weak-functions

This option is a subset of -Bsymbolic-functions. It applies to STB_GLOBAL
STT_FUNC definitions.

The address of a vague linkage function (STB_WEAK STT_FUNC, e.g. an inline
function, a template instantiation) seen by a -Bsymbolic-functions linked
shared object may be different from the address seen from outside the shared
object. Such cases are uncommon. (ELF/Mach-O programs may use
`-fvisibility-inlines-hidden` to break such pointer equality.  On Windows,
correct dllexport and dllimport are needed to make pointer equality work.
Windows link.exe enables /OPT:ICF by default so different inline functions may
have the same address.)

```
// a.cc -> a.o -> a.so (-Bsymbolic-functions)
inline void f() {}
void *g() { return (void *)&f; }

// b.cc -> b.o -> exe
// The address is different!
inline void f() {}
```

-Bsymbolic-non-weak-functions is a safer (C++ conforming) subset of
-Bsymbolic-functions, which can make such programs work.

Implementations usually emit a vague linkage definition in a COMDAT group.  We
could detect the group (with more code) but I feel that we should just check
STB_WEAK for simplicity. A weak definition will thus serve as an escape hatch
for rare cases when users want interposition on definitions.

GNU ld feature request: https://sourceware.org/bugzilla/show_bug.cgi?id=27871

Longer write-up: https://maskray.me/blog/2021-05-16-elf-interposition-and-bsymbolic

If Linux distributions migrate to protected non-vague-linkage external linkage
functions by default, the linker option can still be handy because it allows
rapid experiment without recompilation. Protected function addresses currently
have deep issues in GNU ld.

Reviewed By: peter.smith

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

3 years ago[compiler-rt][hwasan] Check for SANITIZER_POSIX before including sanitizer_posix.h
Leonard Chan [Wed, 28 Jul 2021 18:09:22 +0000 (11:09 -0700)]
[compiler-rt][hwasan] Check for SANITIZER_POSIX before including sanitizer_posix.h

Rather than throwing an error. This way we can still use files like
hwasan_dynamic_shadow.cpp for other platforms without leading to a
preprocessor error.

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

3 years ago[lldb] Remove CPlusPlusLanguage from Mangled
Alex Langford [Tue, 29 Jun 2021 23:43:37 +0000 (16:43 -0700)]
[lldb] Remove CPlusPlusLanguage from Mangled

The only remaining plugin dependency in Mangled is CPlusPlusLanguage which it
uses to extract information from C++ mangled names. The static function
GetDemangledNameWithoutArguments is written specifically for C++, so it
would make sense for this specific functionality to live in a
C++-related plugin. In order to keep this functionality in Mangled
without maintaining this dependency, I added
`Language::GetDemangledFunctionNameWithoutArguments`.

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

3 years ago[GlobalISel] Use GMergeLikeOp to simplify a combine. NFC.
Amara Emerson [Thu, 29 Jul 2021 19:18:45 +0000 (12:18 -0700)]
[GlobalISel] Use GMergeLikeOp to simplify a combine. NFC.

3 years ago[mlir] NFC: split MemRef to SPIR-V conversion into their own files
Lei Zhang [Thu, 29 Jul 2021 20:22:46 +0000 (16:22 -0400)]
[mlir] NFC: split MemRef to SPIR-V conversion into their own files

Reviewed By: hanchung

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

3 years ago[mlir] NFC: split Math to SPIR-V conversion into their own files
Lei Zhang [Thu, 29 Jul 2021 20:21:43 +0000 (16:21 -0400)]
[mlir] NFC: split Math to SPIR-V conversion into their own files

Reviewed By: hanchung

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

3 years ago[mlir] Fix CMake option for enabling SPIR-V CPU runner
Lei Zhang [Thu, 29 Jul 2021 20:21:26 +0000 (16:21 -0400)]
[mlir] Fix CMake option for enabling SPIR-V CPU runner

Reviewed By: hanchung

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

3 years ago[LLDB][GUI] Add Environment Variable Field
Omar Emara [Thu, 29 Jul 2021 20:28:22 +0000 (13:28 -0700)]
[LLDB][GUI] Add Environment Variable Field

This patch adds an environment variable field. This is usually used as
the basic type of a List field. This is needed to create the process
launch form.

Reviewed By: clayborg

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

3 years ago[LLDB][GUI] Add Create Target form
Omar Emara [Thu, 29 Jul 2021 20:27:22 +0000 (13:27 -0700)]
[LLDB][GUI] Add Create Target form

This patch adds a Create Target form for the LLDB GUI. Additionally, an
Arch Field was introduced to input an arch and the file and directory
fields now have a required property.

Reviewed By: clayborg

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

3 years ago[DWARF] Refactor test to remove relocations for DWO
Alexander Yermolovich [Thu, 29 Jul 2021 20:14:10 +0000 (13:14 -0700)]
[DWARF] Refactor test to remove relocations for DWO

The way this test generates object file results in relocation sections for .dwo sections. This is not legal. Re-wrote it to avoid those relocation sections.

Reviewed By: dblaikie

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

3 years agoFix runtime internal error with certain intrinsics that can take a scalar
Mark Leair [Thu, 29 Jul 2021 20:05:08 +0000 (13:05 -0700)]
Fix runtime internal error with certain intrinsics that can take a scalar
result descriptor (e.g., maxloc, minloc, maxval, minval, all, any, count,
parity, findloc, etc.)

Also add a scalar case for these intrinsic unit tests.

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

3 years agoFixing an infinite loop problem in InstCombine
Andy Kaylor [Thu, 29 Jul 2021 18:42:06 +0000 (11:42 -0700)]
Fixing an infinite loop problem in InstCombine

Patch by Mohammad Fawaz

This issues started happening after
https://github.com/llvm/llvm-project/commit/b373b5990d5991a920c421b21a352e4ccf4c4993
Basically, if the memcpy is volatile, the collectUsers() function should
return false, just like we do for volatile loads.

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

3 years agoRevert "[AIX] Pass the -b option to linker on AIX"
Anjan Kumar [Thu, 29 Jul 2021 19:40:25 +0000 (19:40 +0000)]
Revert "[AIX] Pass the -b option to linker on AIX"

This reverts commit 109954410c34434a181f5eb48cbd14f4122101c7.

3 years agoRevert "Revert "[clang][pp] adds '#pragma include_instead'""
Christopher Di Bella [Tue, 27 Jul 2021 15:36:03 +0000 (15:36 +0000)]
Revert "Revert "[clang][pp] adds '#pragma include_instead'""

Includes regression test for problem noted by @hans.
This reverts commit 973de7185606a21fd5e9d5e8c014fbf898c0e72f.

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

3 years ago[OpenMP] libomp: Add new experimental barrier: two-level distributed barrier
Terry Wilmarth [Thu, 15 Jul 2021 15:28:47 +0000 (10:28 -0500)]
[OpenMP] libomp: Add new experimental barrier: two-level distributed barrier

Two-level distributed barrier is a new experimental barrier designed
for Intel hardware that has better performance in some cases than the
default hyper barrier.

This barrier is designed to handle fine granularity parallelism where
barriers are used frequently with little compute and memory access
between barriers. There is no need to use it for codes with few
barriers and large granularity compute, or memory intensive
applications, as little difference will be seen between this barrier
and the default hyper barrier. This barrier is designed to work
optimally with a fixed number of threads, and has a significant setup
time, so should NOT be used in situations where the number of threads
in a team is varied frequently.

The two-level distributed barrier is off by default -- hyper barrier
is used by default. To use this barrier, you must set all barrier
patterns to use this type, because it will not work with other barrier
patterns. Thus, to turn it on, the following settings are required:

KMP_FORKJOIN_BARRIER_PATTERN=dist,dist
KMP_PLAIN_BARRIER_PATTERN=dist,dist
KMP_REDUCTION_BARRIER_PATTERN=dist,dist

Branching factors (set with KMP_FORKJOIN_BARRIER, KMP_PLAIN_BARRIER,
and KMP_REDUCTION_BARRIER) are ignored by the two-level distributed
barrier.

Patch fixed for ITTNotify disabled builds and non-x86 builds

Co-authored-by: Jonathan Peyton <jonathan.l.peyton@intel.com>
Co-authored-by: Vladislav Vinogradov <vlad.vinogradov@intel.com>
Differential Revision: https://reviews.llvm.org/D103121

3 years ago[InstSimplify] Don't assume parent function when simplifying llvm.vscale.
Sander de Smalen [Thu, 29 Jul 2021 16:34:01 +0000 (17:34 +0100)]
[InstSimplify] Don't assume parent function when simplifying llvm.vscale.

D106850 introduced a simplification for llvm.vscale by looking at the
surrounding function's vscale_range attributes. The call that's being
simplified may not yet have been inserted into the IR. This happens for
example during function cloning.

This patch fixes the issue by checking if the instruction is in a
parent basic block.

3 years ago[MLIR][python] Export CAPI headers.
Stella Laurenzo [Thu, 29 Jul 2021 19:06:22 +0000 (19:06 +0000)]
[MLIR][python] Export CAPI headers.

* Adds source targets (not included in the full set that downstreams use by default) to bundle mlir-c/ headers into the mlir/_mlir_libs/include directory.
* Adds a minimal entry point to get include and library directories.
* Used by npcomp to export a full CAPI (which is then used by the Torch extension to link npcomp).

Reviewed By: mikeurbach

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

3 years ago[GlobalISel] Add GPtrAdd and use it in some combines.
Amara Emerson [Thu, 29 Jul 2021 19:03:34 +0000 (12:03 -0700)]
[GlobalISel] Add GPtrAdd and use it in some combines.

3 years agoRefactor AsyncToAsyncRuntime pass to boost understandability.
bakhtiyar [Thu, 29 Jul 2021 18:47:08 +0000 (11:47 -0700)]
Refactor AsyncToAsyncRuntime pass to boost understandability.

Depends On D106730

Reviewed By: ezhulenev

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

3 years ago[clang] Fix a typo in the manual page: s/contraint/constraint.
Frederic Cambus [Tue, 27 Jul 2021 12:36:13 +0000 (14:36 +0200)]
[clang] Fix a typo in the manual page: s/contraint/constraint.

While there, update hardcoded Clang version from 3.5 to 13.

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

3 years ago[clang] Fix typos in Options.td and regen ClangCommandLineReference.rst.
Frederic Cambus [Fri, 23 Jul 2021 13:34:03 +0000 (15:34 +0200)]
[clang] Fix typos in Options.td and regen ClangCommandLineReference.rst.

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

3 years agoRorder mmt4d iteration domain
Ahmed S. Taei [Wed, 28 Jul 2021 00:35:22 +0000 (00:35 +0000)]
Rorder mmt4d iteration domain

Move tile iterators to outer most dim

Reviewed By: rsuderman

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