platform/upstream/llvm.git
3 years ago[mlir] Add basic support for dynamic tensor results in TensorToBuffers.cpp.
Alexander Belyaev [Thu, 8 Oct 2020 09:07:36 +0000 (11:07 +0200)]
[mlir] Add basic support for dynamic tensor results in TensorToBuffers.cpp.

The simplest case is when the indexing maps are DimIds in every component. This covers cwise ops.

Also:
* Expose populateConvertLinalgOnTensorsToBuffersPatterns in Transforms.h
* Expose emitLoopRanges in Transforms.h

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

3 years ago[InstCombine] canNarrowShiftAmt - replace custom Constant matching with m_SpecificInt...
Simon Pilgrim [Thu, 8 Oct 2020 09:53:32 +0000 (10:53 +0100)]
[InstCombine] canNarrowShiftAmt - replace custom Constant matching with m_SpecificInt_ICMP

The existing code ignores undef values which matches m_SpecificInt_ICMP, although m_SpecificInt_ICMP returns false for an all-undef constant, I've added test coverage at rGfe0197e194a64f9 to show that undef folding should already have dealt with that case.

3 years agoImport llvm::StringSwitch into mlir namespace.
Christian Sigg [Wed, 7 Oct 2020 14:17:35 +0000 (16:17 +0200)]
Import llvm::StringSwitch into mlir namespace.

Reviewed By: rriddle

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

3 years ago[llvm-readobj][test] - Improve testing in hash-table.test
Georgii Rymar [Mon, 5 Oct 2020 09:29:18 +0000 (12:29 +0300)]
[llvm-readobj][test] - Improve testing in hash-table.test

This makes tests stricter and adds cases to verify what
we do when:

1) there is no `DT_HASH` tag (but there is a `SHT_HASH` section in sections header)
2) the sh_entsize of the `SHT_HASH` section is not equal to 4.

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

3 years ago[Test] Add test showing that we fail to eliminate implied exit conditions
Max Kazantsev [Thu, 8 Oct 2020 09:26:14 +0000 (16:26 +0700)]
[Test] Add test showing that we fail to eliminate implied exit conditions

3 years ago[llvm-readobj] Add --coff-tls-directory flag to print TLS Directory & test.
Luqman Aden [Thu, 8 Oct 2020 08:43:50 +0000 (01:43 -0700)]
[llvm-readobj] Add --coff-tls-directory flag to print TLS Directory & test.

Akin to dumpbin's /TLS option, this will print out the TLS directory, if
present, in the image.

Example output:
```
> llvm-readobj --coff-tls-directory test.exe
File: test.exe
Format: COFF-x86-64
Arch: x86_64
AddressSize: 64bit
TLSDirectory {
  StartAddressOfRawData: 0x140004000
  EndAddressOfRawData: 0x140004040
  AddressOfIndex: 0x140002000
  AddressOfCallBacks: 0x0
  SizeOfZeroFill: 0x0
  Characteristics [ (0x0)
  ]
}
```

Reviewed By: jhenderson, grimar

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

3 years ago[cmake] Fix cmake warning in standalone compiler-rt builds.
Pierre Gousseau [Thu, 8 Oct 2020 08:45:59 +0000 (09:45 +0100)]
[cmake] Fix cmake warning in standalone compiler-rt builds.

```
cd compiler-rt/build
cmake -G Ninja ../ -DCOMPILER_RT_STANDALONE_BUILD=ON
-DLLVM_CONFIG_PATH=<...>llvm-project/build/bin/llvm-config
-DCOMPILER_RT_INCLUDE_TESTS=ON
```

```
-- check-shadowcallstack does nothing.
Traceback (most recent call last):
  File "<string>", line 22, in <module>
  IndexError: list index out of range
  -- Configuring done
  -- Generating done
```

Reviewed By: thakis

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

3 years ago[mlir] Added strides check to rank reducing subview verification
Jakub Lichman [Thu, 8 Oct 2020 07:38:41 +0000 (07:38 +0000)]
[mlir] Added strides check to rank reducing subview verification

Added missing strides check to verification method of rank reducing subview
which enforces strides specification for the resulting type.

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

3 years ago[AMDGPU] Prefer SplitVectorLoad/Store over expandUnalignedLoad/Store
Mirko Brkusanin [Tue, 6 Oct 2020 13:20:29 +0000 (15:20 +0200)]
[AMDGPU] Prefer SplitVectorLoad/Store over expandUnalignedLoad/Store

ExpandUnalignedLoad/Store can sometimes produce unnecessary copies to
temporary stack slot. We should prefer splitting vectors if possible.

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

3 years ago[AMDGPU] Add test with redundant copies to temporary stack slot produced by expandUna...
Mirko Brkusanin [Tue, 6 Oct 2020 13:16:31 +0000 (15:16 +0200)]
[AMDGPU] Add test with redundant copies to temporary stack slot produced by expandUnalignedLoad

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

3 years ago[AST][RecoveryExpr] Support dependent cast-expr in C for error-recovery.
Haojian Wu [Thu, 8 Oct 2020 08:00:29 +0000 (10:00 +0200)]
[AST][RecoveryExpr] Support dependent cast-expr in C for error-recovery.

Suppress spurious "typecheck_cond_expect_scalar_operand" diagnostic.

See whole context: https://reviews.llvm.org/D85025

Reviewed By: sammccall

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

3 years ago[clangd] Fix a typo, NFC.
Haojian Wu [Thu, 8 Oct 2020 07:35:49 +0000 (09:35 +0200)]
[clangd] Fix a typo, NFC.

3 years ago[LV] Collect dead induction truncates
David Green [Thu, 8 Oct 2020 07:28:58 +0000 (08:28 +0100)]
[LV] Collect dead induction truncates

We currently collect the ICmp and Add from an induction variable,
marking them as dead so that vplan values are not created for them. This
extends that to include any single use trunk from the ICmp, which allows
the Add to more readily be removed too.

This can help with costing vplan nodes, as the ICmp and Add are more
reliably removed and are not double-counted.

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

3 years ago[ARM] Replace llvm.experimental.vector.reduce.smax with llvm.vector.reduce.smax. NFC
David Green [Thu, 8 Oct 2020 07:05:48 +0000 (08:05 +0100)]
[ARM] Replace llvm.experimental.vector.reduce.smax with llvm.vector.reduce.smax. NFC

This fixes up some newer tests after D88787.

3 years ago[LLD] Ignore ELF tests when ld.lld defaults to MinGW
Mateusz Mikuła [Thu, 8 Oct 2020 06:34:18 +0000 (09:34 +0300)]
[LLD] Ignore ELF tests when ld.lld defaults to MinGW

Follow-up to D87418.

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

3 years ago[LLD] [ELF] Fix up a comment regarding the --wrap option. NFC.
Martin Storsjö [Tue, 6 Oct 2020 10:23:57 +0000 (13:23 +0300)]
[LLD] [ELF] Fix up a comment regarding the --wrap option. NFC.

Add missing leading underscores to the __wrap_<symbol> and
__real_<symbol> names.

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

3 years agoUpdate documentation and implementation of stage3 build
Serge Guelton [Wed, 7 Oct 2020 17:43:55 +0000 (13:43 -0400)]
Update documentation and implementation of stage3 build

Have the build work out of the box by forcing an LLD build.

That way, we don't require an external LTO-aware linker,
as we build one.

Also remove reference to the seemingly dead builder.

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

3 years agoReturn "[SCEV] Prove implicaitons via AddRec start"
Max Kazantsev [Thu, 8 Oct 2020 03:50:44 +0000 (10:50 +0700)]
Return "[SCEV] Prove implicaitons via AddRec start"

The initial version of the patch was reverted because it missed the check that
the predicate being proved is actually guarded by this check on 1st iteration.
If it was not executed on 1st iteration (but possibly executes after that), then
it is incorrect to use reasoning about IV start to prove it.

Added the test where the miscompile was seen. Unfortunately, my attempts
to reduce it with bugpoint did not succeed; it can further be reduced when
we understand how to do it without losing the initial bug's notion.

Returning assuming the miscompiles are now gone.

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

3 years ago[NewPM] Use PassInstrumentation for -verify-each
Arthur Eubanks [Tue, 22 Sep 2020 16:34:46 +0000 (09:34 -0700)]
[NewPM] Use PassInstrumentation for -verify-each

This removes "VerifyEachPass" parameters from a lot of functions which is nice.

Don't verify after special passes or VerifierPass.

This introduces verification on loop and cgscc passes, verifying the corresponding function/module.

Reviewed By: ychen

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

3 years agoRevert "[Support][unittests] Enforce alignment in ConvertUTFTest"
Nico Weber [Thu, 8 Oct 2020 02:23:08 +0000 (22:23 -0400)]
Revert "[Support][unittests] Enforce alignment in ConvertUTFTest"

This reverts commit 53b3873cf428fd78f1d92504cc20adf11181ead7.
Seems to break SupportTests.exe's
ConvertUTFTest.UTF16WrappersForConvertUTF16ToUTF8String
on Windows.

3 years agoBPF: fix incorrect DAG2DAG load optimization
Yonghong Song [Wed, 7 Oct 2020 23:24:33 +0000 (16:24 -0700)]
BPF: fix incorrect DAG2DAG load optimization

Currently, bpf backend Instruction section DAG2DAG phase has
an optimization to replace loading constant struct memeber
or array element with direct values. The reason is that these
locally defined struct or array variables may have their
initial values stored in a readonly section and early bpf
ecosystem is not able to handle such cases.

Bpf ecosystem now can not only handle readonly sections,
but also global variables. global variable can also have
initialized data and global variable may or may not be constant,
i.e., global variable data can be put in .data section or .rodata
section. This exposed a bug in DAG2DAG Load optimization
as it did not check whether the global variable is constant
or not.

This patch fixed the bug by checking whether global variable,
representing the initial data, is constant or not and will not
do optimization if it is not a constant.

Another bug is also fixed in this patch to check whether
the load is simple (not volatile/atomic) or not. If it is
not simple, we will not do optimization. To summary for
globals:
   - struct t var = { ... } ;  // no load optimization
   - const struct t var = { ... }; // load optimization is possible
   - volatile const struct t var = { ... }; // no load optimization

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

3 years ago[X86] Fix bug in -mlvi-cfi that may clobber a live register
Scott Constable [Thu, 8 Oct 2020 01:32:45 +0000 (18:32 -0700)]
[X86] Fix bug in -mlvi-cfi that may clobber a live register

Fix for this bug: https://bugs.llvm.org/show_bug.cgi?id=47740

The fix uses the existing findDeadCallerSavedReg() function instead of a hacky heuristic to find a scratch register to clobber.

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

3 years ago[X86] Move findDeadCallerSavedReg() into X86RegisterInfo
Scott Constable [Thu, 8 Oct 2020 01:30:37 +0000 (18:30 -0700)]
[X86] Move findDeadCallerSavedReg() into X86RegisterInfo

The findDeadCallerSavedReg() function has utility outside of X86FrameLowering.cpp

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

3 years agoRemove unused variables
Geoffrey Martin-Noble [Thu, 8 Oct 2020 01:24:24 +0000 (18:24 -0700)]
Remove unused variables

These are unused since
https://reviews.llvm.org/rG35cb45c533fb76dcfc9f44b4e8bbd5d8a855ed2a
causing `-Wunused` warnings.

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

3 years ago[IRMover] Avoid materializing global value that belongs to not-yet-linked module
Yuanfang Chen [Thu, 8 Oct 2020 01:13:26 +0000 (18:13 -0700)]
[IRMover] Avoid materializing global value that belongs to not-yet-linked module

We saw the same assertion failure mentioned here
https://bugs.llvm.org/show_bug.cgi?id=42063 in our internal tests.

The failure happens in the same circumstance as D47898 and D66814 where
uniqueing of DICompositeTypes causes `Mapper::mapValue` to be called on
GlobalValues(`G`) from a not-yet-linked module(`M`). The following type-mapping for
`G` may not complete correctly (fail to unique types etc.  depending on the
the complexity of the types) because IRLinker::computeTypeMapping is not done for `M`
in this path.

D47898 and D66814 fixed some type-mapping issue after Mapper::mapValue
is called on `G`. However, it seems it did not handle some complex cases. I
think we should delay linking globals like `G` until its owing module is
linked. In this way, we could save unnecessary type mapping and prune
these corner cases. It is also supposed to reduce the total number of structs
ending up in the combined module.

D47898 is reverted (its test is kept) because it regresses the test case here.
D66814 could also be reverted (the `check-all` looks good). But it looks reasonable
anyway, so I thought I should keep it.

Also tested the patch with clang self-host regularLTO/ThinLTO build, things look
good as well.

Reviewed By: tejohnson

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

3 years ago[libcxx] Use runtime rather then compile-time glibc version check
Petr Hosek [Wed, 23 Sep 2020 22:53:45 +0000 (15:53 -0700)]
[libcxx] Use runtime rather then compile-time glibc version check

glibc supports versioning, so it's possible to build against older
version and run against newer version. This is sometimes relied on
in practice, e.g. in Fuchsia build we build against older sysroot
(equivalent to Ubuntu Trusty) to cover the broadest possible range
of host systems, but that doesn't necessarily match the system that
binary is going to run on which may have newer version, in which case
the compile test used in curr_symbol is going to fail. Using runtime
check is more reliable. This is a follow up to D56702 which addressed
one instance, this patch addresses all of the remaining ones.

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

3 years ago[ImplicitNullChecks] Support complex addressing mode
Anna Thomas [Thu, 24 Sep 2020 15:00:46 +0000 (11:00 -0400)]
[ImplicitNullChecks] Support complex addressing mode

The pass is updated to handle loads through complex addressing mode,
specifically, when we have a scaled register and a scale.
It requires two API updates in TII which have been implemented for X86.

See added IR and MIR testcases.

Tests-Run: make check
Reviewed-By: reames, danstrushin
Differential Revision: https://reviews.llvm.org/D87148

3 years ago[X86] Defer the creation of LCMPXCHG16B_SAVE_RBX until finalize-isel
Craig Topper [Wed, 7 Oct 2020 21:20:18 +0000 (14:20 -0700)]
[X86] Defer the creation of LCMPXCHG16B_SAVE_RBX until finalize-isel

We need to use LCMPXCHG16B_SAVE_RBX if RBX/EBX is being used as
the frame pointer. We previously checked for this during type
legalization, but that's too early to know for sure if the base
pointer is needed.

This patch adds a new pseudo instruction to emit from isel that
uses a virtual register for the RBX input. Then we use the custom
inserter hook to emit LCMPXCHG16B if RBX isn't needed as a base
pointer or LCMPXCHG16B_SAVE_RBX if it is.

Fixes PR42064.

Reviewed By: pengfei

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

3 years agoAdd test for disabling Dead Virtual Function Elimination
Dominic Chen [Sat, 26 Sep 2020 01:46:49 +0000 (21:46 -0400)]
Add test for disabling Dead Virtual Function Elimination

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

3 years ago[sanitizer] Skip stack symbolization when not required for print format
Teresa Johnson [Sat, 26 Sep 2020 06:03:06 +0000 (23:03 -0700)]
[sanitizer] Skip stack symbolization when not required for print format

Adds a check to avoid symbolization when printing stack traces if the
stack_trace_format flag does not need it. While there is a symbolize
flag that can be turned off to skip some of the symbolization,
SymbolizePC() still unconditionally looks up the module name and offset.
Avoid invoking SymbolizePC() at all if not needed.

This is an efficiency improvement when dumping all stack traces as part
of the memory profiler in D87120, for large stripped apps where we want
to symbolize as a post pass.

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

3 years ago[flang][msvc] Avoid dependence on long double
peter klausler [Fri, 2 Oct 2020 19:39:05 +0000 (12:39 -0700)]
[flang][msvc] Avoid dependence on long double

MSVC does not support a distinct 80-bit extended precision
"long double" type.  Rework the I/O runtime to avoid using
native C/C++ type names.  Centralize the mappings between
the KIND= type parameters of REAL and their binary precisions
in the common real.h header file, and use KIND type parameter
values rather than binary precisions for clarity where
appropriate.

This patch, if successful, should obviate the need for
Differential review D88511.

(This patch anticipates a successful review of D88688, which
fixes the function that maps each kind of real to its maximum
number of significant decimal digits.)

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

3 years ago[libc++] Remove unused includes of Availability.h
Louis Dionne [Wed, 7 Oct 2020 22:03:09 +0000 (18:03 -0400)]
[libc++] Remove unused includes of Availability.h

Since ebaf1d5e2b, the macros defined in <Availability.h> are not used
anymore.

3 years agoFix a macOS build break caused by 3dfb94986170.
Jim Ingham [Wed, 7 Oct 2020 22:00:08 +0000 (15:00 -0700)]
Fix a macOS build break caused by 3dfb94986170.

3 years ago[M680x0] Add google/benchmark's CycleTimer support for M68K
Min-Yih Hsu [Tue, 6 Oct 2020 03:24:33 +0000 (20:24 -0700)]
[M680x0] Add google/benchmark's CycleTimer support for M68K

This is a cherrypick of the upstream fix commit ffe1342 onto
`llvm/utils/benchmark` and `libcxx/utils/google-benchmark`.
This adds CycleTimer implementation for M680x0, which simply
uses `gettimeofday` same as MIPS.

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

3 years ago[NFC][regalloc] Use MCRegister instead of unsigned in InterferenceCache
Mircea Trofin [Tue, 6 Oct 2020 21:38:41 +0000 (14:38 -0700)]
[NFC][regalloc] Use MCRegister instead of unsigned in InterferenceCache

Also changed users of APIs.

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

3 years ago[flang] Semantic checks for bad usage of whole assumed-size arrays
peter klausler [Thu, 1 Oct 2020 19:08:04 +0000 (12:08 -0700)]
[flang] Semantic checks for bad usage of whole assumed-size arrays

The semantics pass currently checks for several constraints
that apply to the use of whole assumed-size arrays in various
contexts, but C1002 wasn't really implemented.  This patch
implements C1002 by disallowing the use of whole assumed-size
arrays in expressions and variables unless specifically
allowed by the context.  This centralizes the error reporting,
which has been improved with a link to the array's declaration.

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

3 years agoPort StripGCRelocates pass to NPM
Reid Kleckner [Fri, 2 Oct 2020 23:31:57 +0000 (16:31 -0700)]
Port StripGCRelocates pass to NPM

Fixes one test under NPM

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

3 years ago[NPM] Port strip nonlinetable debuginfo pass to the new pass manager
Reid Kleckner [Fri, 2 Oct 2020 23:18:47 +0000 (16:18 -0700)]
[NPM] Port strip nonlinetable debuginfo pass to the new pass manager

Fixes a few tests in llvm/test/Transforms/Utils.

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

3 years agoAdd regular expressions to and DWARF Call Frame Information tests in case the archite...
Greg Clayton [Wed, 7 Oct 2020 01:54:20 +0000 (18:54 -0700)]
Add regular expressions to and DWARF Call Frame Information tests in case the architecture specific target is not compiled into LLVM.

This should fix any build bots that avoid compiling some architectures into llvm after https://reviews.llvm.org/D88767.

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

3 years ago[mlir] [sparse] Rename getSparseMatrix to getMatrix
Aart Bik [Wed, 7 Oct 2020 21:13:46 +0000 (14:13 -0700)]
[mlir] [sparse] Rename getSparseMatrix to getMatrix

Rationale:
More consistent with the other names. Also forward looking to reading
in other kinds of matrices. Also fixes lint issue on hard-coded %llu.

Reviewed By: penpornk

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

3 years agoAdd validity assert on entry to CastInst::isNoopCast [NFC]
Philip Reames [Wed, 7 Oct 2020 21:02:10 +0000 (14:02 -0700)]
Add validity assert on entry to CastInst::isNoopCast [NFC]

This required some minor code reorganization to have a version of castIsValid which worked purely in terms of types.

3 years ago[NFC][MLInliner] Getters should return by reference
Mircea Trofin [Wed, 7 Oct 2020 20:53:14 +0000 (13:53 -0700)]
[NFC][MLInliner] Getters should return by reference

3 years ago[BasicBlockSections] Make sure that the labels for address-taken blocks are emitted...
Rahman Lavaee [Wed, 7 Oct 2020 20:21:20 +0000 (13:21 -0700)]
[BasicBlockSections] Make sure that the labels for address-taken blocks are emitted after switching the seciton.

Currently, AsmPrinter code is organized in a way in which the labels of address-taken blocks are emitted in the previous section, which makes the relocation incorrect.
This patch reorganizes the code to switch to the basic block section before handling address-taken blocks.

Reviewed By: snehasish, MaskRay

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

3 years ago[SVE] Add legalisation tests to sve-fixed-length-fp-reduce.ll
Cameron McInally [Wed, 7 Oct 2020 19:36:00 +0000 (14:36 -0500)]
[SVE] Add legalisation tests to sve-fixed-length-fp-reduce.ll

3 years ago[InstCombine] Add checks for and(logicalshift(zext(x),undef),y) cases
Simon Pilgrim [Wed, 7 Oct 2020 19:59:31 +0000 (20:59 +0100)]
[InstCombine] Add checks for and(logicalshift(zext(x),undef),y) cases

Prep work before some cleanup in narrowMaskedBinOp

3 years agoRemove D80713.diff added in 528057c19755ad842052fba3a42dcbf7deafc6de
Ronak Chauhan [Wed, 7 Oct 2020 19:30:10 +0000 (01:00 +0530)]
Remove D80713.diff added in 528057c19755ad842052fba3a42dcbf7deafc6de

The diff file was added by mistake.

3 years agoAdd REQUIRES: x86-registered-target to test as it was failing on build bots without...
Douglas Yung [Wed, 7 Oct 2020 19:23:51 +0000 (12:23 -0700)]
Add REQUIRES: x86-registered-target to test as it was failing on build bots without x86.

This should fix the failure on http://lab.llvm.org:8011/#/builders/91/builds/30

3 years ago[clangd] Add a NewName optional parameter to clangdServer::prepareRename.
Haojian Wu [Wed, 7 Oct 2020 19:16:45 +0000 (21:16 +0200)]
[clangd] Add a NewName optional parameter to clangdServer::prepareRename.

If the NewName is provided, prepareRename would perform a name
validation.

The motivation is to allow our internal embeder implement the customized
"canRenameInto" functionality on top of prepareRename.

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

3 years agoAdd a clarifying a comment on CastInst::isNoopCast
Philip Reames [Wed, 7 Oct 2020 19:15:16 +0000 (12:15 -0700)]
Add a clarifying a comment on CastInst::isNoopCast

I made exactly the mistake described, so document the precondition.  It would be better to have an assert, but there is (currently) no "castIsValid" with purely type arguments.

3 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Wed, 7 Oct 2020 18:53:39 +0000 (19:53 +0100)]
Fix MSVC "not all control paths return a value" warning. NFCI.

3 years agoFix Wdocumentation warnings due to case mismatch. NFCI.
Simon Pilgrim [Wed, 7 Oct 2020 18:01:04 +0000 (19:01 +0100)]
Fix Wdocumentation warnings due to case mismatch. NFCI.

3 years ago[CodeGen][X86] Cleanup labels on some sse/avx intrinsics tests. NFCI.
Simon Pilgrim [Wed, 7 Oct 2020 16:27:32 +0000 (17:27 +0100)]
[CodeGen][X86] Cleanup labels on some sse/avx intrinsics tests. NFCI.

Add some missing CHECK-LABEL lines.

Remove leading '@' so it'll be possible to match against c and c++ builds in a future patch.

3 years ago[mlir] Fix build after 322d0afd875df66b36e4810a2b95c20a8f22ab9b due to change in...
Amara Emerson [Wed, 7 Oct 2020 18:19:54 +0000 (11:19 -0700)]
[mlir] Fix build after 322d0afd875df66b36e4810a2b95c20a8f22ab9b due to change in intrinsic overloads.

I'd forgottent to run the mlir tests after removing the scalar input overload
on the fadd/fmul reductions. This is a quick fix for the mlir bot.

3 years ago[AMDGPU] Add tied operand to d16 scratch loads
Stanislav Mekhanoshin [Tue, 6 Oct 2020 21:07:44 +0000 (14:07 -0700)]
[AMDGPU] Add tied operand to d16 scratch loads

This is still no-op because there is no selection for these
opcodes.

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

3 years ago[test][MC] Use %python in llvm/test/MC/COFF/bigobj.py
Edd Dawson [Wed, 7 Oct 2020 17:58:12 +0000 (13:58 -0400)]
[test][MC] Use %python in llvm/test/MC/COFF/bigobj.py

... instead of the one on the $PATH.

Reviewed By: hubert.reinterpretcast

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

3 years ago[LAA] Use DL to get element size for bound computation.
Florian Hahn [Wed, 7 Oct 2020 17:50:17 +0000 (18:50 +0100)]
[LAA] Use DL to get element size for bound computation.

Currently LAA uses getScalarSizeInBits to compute the size of an element
when computing the end bound of an access.

This does not work as expected for pointers to pointers, because
getScalarSizeInBits will return 0 for pointer types.

By using DataLayout to get the size of the element we can also correctly
handle pointer element types.

Note the changes to the existing test, which seems to also use the wrong
offset for the end.

Fixes PR47751.

Reviewed By: anemet

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

3 years ago[AMDGPU] Use default zero flag operands in flat scratch
Stanislav Mekhanoshin [Tue, 6 Oct 2020 20:04:11 +0000 (13:04 -0700)]
[AMDGPU] Use default zero flag operands in flat scratch

This is no-op so far because we do not select these yet.

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

3 years agoRename the VECREDUCE_STRICT_{FADD,FMUL} SDNodes to VECREDUCE_SEQ_{FADD,FMUL}.
Amara Emerson [Sun, 4 Oct 2020 05:06:54 +0000 (22:06 -0700)]
Rename the VECREDUCE_STRICT_{FADD,FMUL} SDNodes to VECREDUCE_SEQ_{FADD,FMUL}.

The STRICT was causing unnecessary confusion. I think SEQ is a more accurate
name for what they actually do, and the other obvious option of "ORDERED"
has the issue of already having a meaning in FP contexts.

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

3 years ago[clangd] Disambiguate overloads of std::move for header insertion.
Sam McCall [Tue, 6 Oct 2020 10:51:01 +0000 (12:51 +0200)]
[clangd] Disambiguate overloads of std::move for header insertion.

Up until now, we relied on matching the filename.
This depends on unstable details of libstdc++ and doesn't work well on other
stdlibs. Also we'd like to remove it (see D88204).

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

3 years ago[llvm][mlir] Promote the experimental reduction intrinsics to be first class intrinsics.
Amara Emerson [Sat, 3 Oct 2020 01:30:53 +0000 (18:30 -0700)]
[llvm][mlir] Promote the experimental reduction intrinsics to be first class intrinsics.

This change renames the intrinsics to not have "experimental" in the name.

The autoupgrader will handle legacy intrinsics.

Relevant ML thread: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140729.html

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

3 years ago[NFC] Add contributors names to CREDITS.TXT
Fanbo Meng [Wed, 7 Oct 2020 17:22:55 +0000 (13:22 -0400)]
[NFC] Add contributors names to CREDITS.TXT

3 years ago[mlir][CAPI] Attribute set/remove on operations.
Stella Laurenzo [Wed, 7 Oct 2020 06:01:20 +0000 (23:01 -0700)]
[mlir][CAPI] Attribute set/remove on operations.

* New functions: mlirOperationSetAttributeByName, mlirOperationRemoveAttributeByName
* Also adds some *IsNull checks and standardizes the rest to use "static inline" form, which makes them all non-opaque and not part of the ABI (which is desirable).
* Changes needed to resolve TODOs in npcomp PyTorch capture.

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

3 years ago[WebAssembly] Rename Emscripten EH functions
Heejin Ahn [Mon, 28 Sep 2020 10:57:37 +0000 (03:57 -0700)]
[WebAssembly] Rename Emscripten EH functions

Renaming for some Emscripten EH functions has so far been done in
wasm-emscripten-finalize tool in Binaryen. But recently we decided to
make a compilation/linking path that does not rely on
wasm-emscripten-finalize for modifications, so here we move that
functionality to LLVM.

Invoke wrappers are generated in LowerEmscriptenEHSjLj pass, but final
wasm types are not available in the IR pass, we need to rename them at
the end of the pipeline.

This patch also removes uses of `emscripten_longjmp_jmpbuf` in
LowerEmscriptenEHSjLj pass, replacing that with `emscripten_longjmp`.
`emscripten_longjmp_jmpbuf` is lowered to `emscripten_longjmp`, but
previously we generated calls to `emscripten_longjmp_jmpbuf` in
LowerEmscriptenEHSjLj pass because it takes `jmp_buf*` instead of `i32`.
But we were able use `ptrtoint` to make it use `emscripten_longjmp`
directly here.

Addresses:
https://github.com/WebAssembly/binaryen/issues/3043
https://github.com/WebAssembly/binaryen/issues/3081

Companions:
https://github.com/WebAssembly/binaryen/pull/3191
https://github.com/emscripten-core/emscripten/pull/12399

Reviewed By: dschuff, tlively, sbc100

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

3 years ago[json] Provide a means to delegate writing a value to another API
Daniel Sanders [Tue, 6 Oct 2020 11:50:41 +0000 (13:50 +0200)]
[json] Provide a means to delegate writing a value to another API

(Based on D87170 by dsanders)

I recently had need to call out to an external API to emit a JSON object as part
of one an LLVM tool was emitting. However, our JSON support didn't provide a way
to delegate part of the JSON output to that API.

Add rawValueBegin() and rawValueEnd() to maintain and check the internal state
while something else is writing to the stream. It's the users responsibility to
ensure that the resulting JSON output is still valid.

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

3 years agoReapply [ADT] function_ref's constructor is unavailable if the argument is not callable.
Sam McCall [Wed, 7 Oct 2020 14:37:53 +0000 (16:37 +0200)]
Reapply [ADT] function_ref's constructor is unavailable if the argument is not callable.

This reverts commit 281703e67ffaee8e26efef86e0df3e145477f4cb.

GCC 5.4 bugs are worked around by avoiding use of variable templates.

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

3 years ago[clang-format][tests] Fix MacroExpander lexer not parsing C++ keywords
Alex Richardson [Wed, 7 Oct 2020 15:29:22 +0000 (16:29 +0100)]
[clang-format][tests] Fix MacroExpander lexer not parsing C++ keywords

While debugging a different clang-format failure, I tried to reuse the
MacroExpander lexer, but was surprised to see that it marks all C++
keywords (e.g. const, decltype) as being of type identifier. After stepping
through the ::format() code, I noticed that the difference between these
two is that the identifier table was not being initialized based on the
FormatStyle, so only basic tokens such as tok::semi, tok::plus, etc. were
being handled.

Reviewed By: klimek

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

3 years ago[clang-format][NFC] Store FormatToken::Type as an enum instead of bitfield
Alex Richardson [Wed, 7 Oct 2020 15:29:10 +0000 (16:29 +0100)]
[clang-format][NFC] Store FormatToken::Type as an enum instead of bitfield

This improves the debugging experience since LLDB will print the enumerator
name instead of a decimal number. This changes TokenType to have uint8_t
as the underlying type and moves it after the remaining bitfields to avoid
increasing the size of FormatToken.

Reviewed By: MyDeveloperDay

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

3 years ago[MemCpyOpt] Add additional callslot test cases (NFC)
Nikita Popov [Tue, 6 Oct 2020 20:10:10 +0000 (22:10 +0200)]
[MemCpyOpt] Add additional callslot test cases (NFC)

For cases where the destination is captured.

3 years ago[NFC][InstCombine] Autogenerate a few tests being affected by upcoming patch
Roman Lebedev [Wed, 7 Oct 2020 15:59:40 +0000 (18:59 +0300)]
[NFC][InstCombine] Autogenerate a few tests being affected by upcoming patch

3 years ago[Tests] Precommit test showing gap around load forwarding of vectors in instcombine
Philip Reames [Wed, 7 Oct 2020 15:56:13 +0000 (08:56 -0700)]
[Tests] Precommit test showing gap around load forwarding of vectors in instcombine

3 years ago[gn build] Port ddf1864ace4
LLVM GN Syncbot [Wed, 7 Oct 2020 15:50:43 +0000 (15:50 +0000)]
[gn build] Port ddf1864ace4

3 years agoBPF: add AdjustOpt IR pass to generate verifier friendly codes
Yonghong Song [Thu, 6 Aug 2020 16:06:43 +0000 (09:06 -0700)]
BPF: add AdjustOpt IR pass to generate verifier friendly codes

Add an IR phase right before main module optimization.
This is to modify IR to restrict certain downward optimizations
in order to generate verifier friendly code.
  > prevent certain instcombine optimizations, handling both
    in-block/cross-block instcombines.
  > avoid speculative code motion if the variable used in
    condition is also used in the later blocks.

Internally, a bpf IR builtin
  result = __builtin_bpf_passthrough(seq_num, result)
is used to enforce ordering. This builtin is only used
during target independent IR optimizations and it will
be removed at the beginning of target dependent IR
optimizations.

For example, removing the following workaround,
  --- a/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c
  +++ b/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c
  @@ -47,7 +47,7 @@ int sysctl_tcp_mem(struct bpf_sysctl *ctx)
          /* a workaround to prevent compiler from generating
           * codes verifier cannot handle yet.
           */
  -       volatile int ret;
  +       int ret;
this patch is able to generate code which passed the verifier.

To disable optimization, users need to use "opt" command like below:
  clang -target bpf -O2 -S -emit-llvm -Xclang -disable-llvm-passes test.c
  // disable icmp serialization
  opt -O2 -bpf-disable-serialize-icmp test.ll | llvm-dis > t.ll
  // disable avoid-speculation
  opt -O2 -bpf-disable-avoid-speculation test.ll | llvm-dis > t.ll
  llc t.ll

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

3 years ago[SystemZ][z/OS] Add test of zero length bitfield type size larger than target zero...
Fanbo Meng [Wed, 7 Oct 2020 15:33:19 +0000 (11:33 -0400)]
[SystemZ][z/OS] Add test of zero length bitfield type size larger than target zero length bitfield boundary

Reviewed By: hubert.reinterpretcast

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

3 years agoIntroduce subtraction for FlatAffineConstraints
Arjun P [Wed, 7 Oct 2020 15:16:11 +0000 (17:16 +0200)]
Introduce subtraction for FlatAffineConstraints

Subtraction is a foundational arithmetic operation that is often used when computing, for example, data transfer sets or cache hits. Since the result of subtraction need not be a convex polytope, a new class `PresburgerSet` is introduced to represent unions of convex polytopes.

Reviewed By: ftynse, bondhugula

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

3 years ago[clangd] Fix argument type (bool->float).
Adam Czachorowski [Wed, 7 Oct 2020 15:02:16 +0000 (17:02 +0200)]
[clangd] Fix argument type (bool->float).

The default value is 1.3f, but it was cast to true, which is not a good
base for code completion score.

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

3 years ago[AMDGPU] Support disassembly for AMDGPU kernel descriptors
Ronak Chauhan [Wed, 7 Oct 2020 02:44:46 +0000 (08:14 +0530)]
[AMDGPU] Support disassembly for AMDGPU kernel descriptors

Decode AMDGPU Kernel descriptors as assembler directives.

Reviewed By: scott.linder, jhenderson, kzhuravl

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

3 years ago[SVE] Lower fixed length VECREDUCE_OR operation
Cameron McInally [Wed, 7 Oct 2020 14:26:53 +0000 (09:26 -0500)]
[SVE] Lower fixed length VECREDUCE_OR operation

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

3 years ago[AMDGPU] Use @LINE for error checking in gfx10.3 assembler tests
Jay Foad [Wed, 7 Oct 2020 14:48:01 +0000 (15:48 +0100)]
[AMDGPU] Use @LINE for error checking in gfx10.3 assembler tests

3 years agoRevert "[ADT] function_ref's constructor is unavailable if the argument is not callable."
Sam McCall [Wed, 7 Oct 2020 14:36:38 +0000 (16:36 +0200)]
Revert "[ADT] function_ref's constructor is unavailable if the argument is not callable."

This reverts commit 4cae6228d129d4c4dfb156c043977bb6b5690031.

Breaks GCC build:
http://lab.llvm.org:8011/#/builders/8/builds/33/steps/6/logs/stdio

3 years ago[gn build] (manually) port ce1365f8f7e
Nico Weber [Wed, 7 Oct 2020 14:33:40 +0000 (10:33 -0400)]
[gn build] (manually) port ce1365f8f7e

3 years ago[ADT] function_ref's constructor is unavailable if the argument is not callable.
Sam McCall [Tue, 6 Oct 2020 14:35:35 +0000 (16:35 +0200)]
[ADT] function_ref's constructor is unavailable if the argument is not callable.

This allows overload sets containing function_ref arguments to work correctly
Otherwise they're ambiguous as anything "could be" converted to a function_ref.

This matches proposed std::function_ref, absl::function_ref, etc.

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

3 years ago[mlir] fix the types used during the generation of the kernel param array
Tobias Gysi [Wed, 7 Oct 2020 14:18:46 +0000 (16:18 +0200)]
[mlir] fix the types used during the generation of the kernel param array

The patch fixes the types used to access the elements of the kernel parameter structure from a pointer to the structure to a pointer to the actual parameter type.

Reviewed By: csigg

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

3 years ago[obj2yaml] - Rename `Group` to `GroupSection`. NFC.
Georgii Rymar [Tue, 6 Oct 2020 13:04:15 +0000 (16:04 +0300)]
[obj2yaml] - Rename `Group` to `GroupSection`. NFC.

The `Group` class represents a group section and it is
named inconsistently with other sections which all has
the "Section" suffix. It is sometimes confusing,
this patch addresses the issue.

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

3 years ago[llvm-readelf] - Implement --addrsig option.
Georgii Rymar [Mon, 5 Oct 2020 13:51:58 +0000 (16:51 +0300)]
[llvm-readelf] - Implement --addrsig option.

We have `--addrsig` implemented for `llvm-readobj`.
Usually it is convenient to use a single tool for dumping,
so it seems we might want to implement `--addrsig` for `llvm-readelf` too.

I've selected a simple output format which is a bit similar to one,
used for dumping of the symbol table. It looks like:

```
Address-significant symbols section '.llvm_addrsig' contains 2 entries:
   Num: Name
     1: foo
     2: bar
```

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

3 years ago[AMDGPU][MC] Improved diagnostics for instructions with missing features
Dmitry Preobrazhensky [Wed, 7 Oct 2020 13:11:37 +0000 (16:11 +0300)]
[AMDGPU][MC] Improved diagnostics for instructions with missing features

Reviewers: rampitec

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

3 years ago[libc++] Use the existing CMake caches when running build bots
Louis Dionne [Wed, 7 Oct 2020 13:27:19 +0000 (09:27 -0400)]
[libc++] Use the existing CMake caches when running build bots

3 years ago[lldb] Check for and use ptsname_r if available
Pavel Labath [Fri, 2 Oct 2020 11:38:09 +0000 (13:38 +0200)]
[lldb] Check for and use ptsname_r if available

ptsname is not thread-safe. ptsname_r is available on most (but not all)
systems -- use it preferentially.

In the patch I also improve the thread-safety of the ptsname fallback
path by wrapping it in a mutex. This should guarantee the safety of a
typical ptsname implementation using a single static buffer, as long as
all callers go through this function.

I also remove the error arguments, as the only way this function can
fail is if the "primary" fd is not valid. This is a programmer error as
this requirement is documented, and all callers ensure that is the case.

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

3 years ago[lldb/docs] Clarify python/swig version incompatibility
Pavel Labath [Tue, 6 Oct 2020 15:39:08 +0000 (17:39 +0200)]
[lldb/docs] Clarify python/swig version incompatibility

The problematic combo is a debug python>=3.7 && swig<4.0.

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

3 years ago[libc++] Add a CMake option to control whether the debug mode is supported
Louis Dionne [Tue, 6 Oct 2020 20:46:58 +0000 (16:46 -0400)]
[libc++] Add a CMake option to control whether the debug mode is supported

Some libc++ builds may want to disable support for the debug mode,
for example to reduce code size or because the current implementation
of the debug mode requires a global map. This commit adds the
LIBCXX_ENABLE_DEBUG_MODE CMake option and ties it into the test
suite.

It also adds a CI job to test this configuration going forward.

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

3 years ago[libc++] Make sure __clear_and_shrink() maintains string invariants
Louis Dionne [Mon, 5 Oct 2020 20:16:13 +0000 (16:16 -0400)]
[libc++] Make sure __clear_and_shrink() maintains string invariants

__clear_and_shrink() was added in D41976, and a test was added alongside
it to make sure that the string invariants were maintained. However, it
appears that the test never ran under UBSan before, which would have
highlighted the fact that it doesn't actually maintain the string
invariants.

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

3 years ago[mlir] Add support for diagnostics in C API.
Alex Zinenko [Wed, 7 Oct 2020 12:38:10 +0000 (14:38 +0200)]
[mlir] Add support for diagnostics in C API.

Add basic support for registering diagnostic handlers with the context
(actually, the diagnostic engine contained in the context) and processing
diagnostic messages from the C API.

Reviewed By: stellaraccident

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

3 years ago[LLD] [MinGW] Move an option definitions to alphabetical order, wrap a line. NFC.
Martin Storsjö [Tue, 6 Oct 2020 10:03:49 +0000 (13:03 +0300)]
[LLD] [MinGW] Move an option definitions to alphabetical order, wrap a line. NFC.

3 years agoInstCombine: Negator: don't rely on complexity sorting already being performed (PR47752)
Roman Lebedev [Wed, 7 Oct 2020 10:52:25 +0000 (13:52 +0300)]
InstCombine: Negator: don't rely on complexity sorting already being performed (PR47752)

In some cases, we can negate instruction if only one of it's operands
negates. Previously, we assumed that constants would have been
canonicalized to RHS already, but that isn't guaranteed to happen,
because of InstCombine worklist visitation order,
as the added test (previously-hanging) shows.

So if we only need to negate a single operand,
we should ensure ourselves that we try constant operand first.
Do that by re-doing the complexity sorting ourselves,
when we actually care about it.

Fixes https://bugs.llvm.org/show_bug.cgi?id=47752

3 years ago[AMDGPU] Implement hardware bug workaround for image instructions
Rodrigo Dominguez [Fri, 3 Apr 2020 21:37:51 +0000 (17:37 -0400)]
[AMDGPU] Implement hardware bug workaround for image instructions

Summary:
This implements a workaround for a hardware bug in gfx8 and gfx9,
where register usage is not estimated correctly for image_store and
image_gather4 instructions when D16 is used.

Change-Id: I4e30744da6796acac53a9b5ad37ac1c2035c8899

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

3 years ago[InstCombine] Tweak funnel by constant tests for better shl/lshr commutation coverage
Simon Pilgrim [Wed, 7 Oct 2020 10:46:46 +0000 (11:46 +0100)]
[InstCombine] Tweak funnel by constant tests for better shl/lshr commutation coverage

3 years ago[ARM] Regenerate vldlane tests
Simon Pilgrim [Wed, 7 Oct 2020 10:45:52 +0000 (11:45 +0100)]
[ARM] Regenerate vldlane tests

To help make the diffs in D88569 clearer

3 years ago[LAA] Add test for PR47751, which currently uses wrong bounds.
Florian Hahn [Wed, 7 Oct 2020 10:14:55 +0000 (11:14 +0100)]
[LAA] Add test for PR47751, which currently uses wrong bounds.

3 years ago[SDag] SimplifyDemandedBits: simplify to FP constant if all bits known
Jay Foad [Wed, 30 Sep 2020 17:50:34 +0000 (18:50 +0100)]
[SDag] SimplifyDemandedBits: simplify to FP constant if all bits known

We were already doing this for integer constants. This patch implements
the same thing for floating point constants.

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

3 years ago[Test] Add one more test where we can avoid creating trunc
Max Kazantsev [Wed, 7 Oct 2020 08:04:40 +0000 (15:04 +0700)]
[Test] Add one more test where we can avoid creating trunc

3 years ago[mlir][NFC] Style cleanup in comments
Tres Popp [Wed, 7 Oct 2020 08:04:45 +0000 (10:04 +0200)]
[mlir][NFC] Style cleanup in comments