platform/upstream/llvm.git
3 years ago[SystemZ] Improve handling of backchain offset.
Jonas Paulsson [Sat, 12 Dec 2020 02:22:08 +0000 (03:22 +0100)]
[SystemZ] Improve handling of backchain offset.

- New function SDValue getBackchainAddress() used by
  lowerDYNAMIC_STACKALLOC() and lowerSTACKRESTORE() to properly handle the
  backchain offset also with packed-stack.

- Make a common function getBackchainOffset() for the computation of the
  backchain offset and use in some places (NFC).

Review: Ulrich Weigand

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

3 years agoRevert "[clang-scan-deps] Support clang-cl"
Sylvain Audi [Mon, 14 Dec 2020 18:32:38 +0000 (13:32 -0500)]
Revert "[clang-scan-deps] Support clang-cl"

Reverting, as it breaks build on mac.

This reverts commit 640ad769110f76d3391667249478ece88c835529.

3 years ago[Wasm][LTO][NPM] Use NPM for LTO with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
Arthur Eubanks [Mon, 14 Dec 2020 17:56:22 +0000 (09:56 -0800)]
[Wasm][LTO][NPM] Use NPM for LTO with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER

Reviewed By: MaskRay

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

3 years ago[amdgpu] Fix a crash case when `V_CNDMASK` could be simplified.
Michael Liao [Sun, 13 Dec 2020 04:49:26 +0000 (23:49 -0500)]
[amdgpu] Fix a crash case when `V_CNDMASK` could be simplified.

- Once an instruction is simplified, foldable candidates from it should
  be invalidated or skipped as the operand index is no longer valid.

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

3 years ago[NFCI][Thumb2] Regenerate MVE tests i missed in 59560e85897afc50090b6c3d920bacfd28b49d06
Roman Lebedev [Mon, 14 Dec 2020 18:00:34 +0000 (21:00 +0300)]
[NFCI][Thumb2] Regenerate MVE tests i missed in 59560e85897afc50090b6c3d920bacfd28b49d06

3 years ago[NFC] Remove trailing whitespace in llvm/CMakeLists.txt
Tony [Mon, 14 Dec 2020 17:45:44 +0000 (17:45 +0000)]
[NFC] Remove trailing whitespace in llvm/CMakeLists.txt

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

3 years ago[TableGen] Fixed 64-bit filters being sliced to 32 bits in FixedLenDecoderEmitter
Cameron Desrochers [Mon, 14 Dec 2020 17:34:55 +0000 (12:34 -0500)]
[TableGen] Fixed 64-bit filters being sliced to 32 bits in FixedLenDecoderEmitter

When using the FixedLenDecoderEmitter, llvm-tblgen emits tables with (OPC_ExtractField, OPC_ExtractFilterValue) opcode sequences to match the contiguous fixed bits of a given instruction's encoding. This encoding is represented in a 64-bit integer. However, the filter values were represented in a 32-bit integer. As such, instructions with fixed 64-bit encodings resulted in a table with an OPC_ExtractField for all 64 bits, followed by an OPC_ExtractFilterValue containing just the low 32 bits of their encoding, causing the filter never to match.

The exact point at which the slicing occurred was during the map insertion at line 630.

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

3 years agolld/ELF: Parse MSP430 BFD/emulation names
LemonBoy [Mon, 14 Dec 2020 17:38:12 +0000 (09:38 -0800)]
lld/ELF: Parse MSP430 BFD/emulation names

Follow the naming set by TI's own GCC-based toolchain.
Also, force the `osabi` field to `ELFOSABI_STANDALONE`, this matches GNU LD's output (the patching is done in `elf32_msp430_post_process_headers`).

Reviewed By: MaskRay

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

3 years ago[PowerPC] Restore stack ptr from frame ptr with setjmp
Nemanja Ivanovic [Mon, 14 Dec 2020 17:33:46 +0000 (11:33 -0600)]
[PowerPC] Restore stack ptr from frame ptr with setjmp

If a function happens to:

- call setjmp
- do a 16-byte stack allocation
- call a function that sets up a stack frame and longjmp's back

The stack pointer that is restores by setjmp will no longer point to a valid
back chain. According to the ABI, stack accesses in such a function are to be
frame pointer based - so it is an error (quite obviously) to restore the stack
from the back chain.
We already restore the stack from the frame pointer when there are calls to
fast_cc functions. We just need to also do that when there are calls to setjmp.
This patch simply does that.

This was pointed out by the Julia team.

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

3 years ago[MLIR][SPIRV] Refactoring serialization and deserialization
ergawy [Mon, 14 Dec 2020 16:40:34 +0000 (11:40 -0500)]
[MLIR][SPIRV] Refactoring serialization and deserialization

This commit splits SPIR-V's serialization and deserialization code
into separate libraries. The motiviation being that the serializer
is used more often the deserializer and therefore lumping them
together unnecessarily increases binary size for the most common
case.

This commit also moves these libraries into the Target/ directory
to follow MLIR convention.

Reviewed By: antiagainst

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

3 years ago[ASTImporter] Fix import of a typedef that has an attribute
Gabor Marton [Wed, 9 Dec 2020 20:40:53 +0000 (21:40 +0100)]
[ASTImporter] Fix import of a typedef that has an attribute

The import of a typedefs with an attribute uses clang::Decl::setAttrs().
But that needs the ASTContext which we can get only from the
TranslationUnitDecl. But we can get the TUDecl only thourgh the
DeclContext, which is not set by the time of the setAttrs call.

Fix: import the attributes only after the DC is surely imported.
Btw, having the attribute import initiated from GetImportedOrCreateDecl was
fundamentally flawed. Now that is implicitly fixed.

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

3 years ago[SimplifyCFG] FoldBranchToCommonDest(): temporairly put back restrictions on liveout...
Roman Lebedev [Mon, 14 Dec 2020 14:44:17 +0000 (17:44 +0300)]
[SimplifyCFG] FoldBranchToCommonDest(): temporairly put back restrictions on liveout uses of bonus instructions (PR48450)

Even though d38205144febf4dc42c9270c6aa3d978f1ef65e1 was mostly a correct
fix for the external non-PHI users, it's not a *generally* correct fix,
because the 'placeholder' values in those trivial PHI's we create
shouldn't be *always* 'undef', but the PHI itself for the backedges,
else we end up with wrong value, as the `@pr48450_2` test shows.

But we can't just do that, because we can't check that the PHI
can be it's own incoming value when coming from certain predecessor,
because we don't have a dominator tree.

So until we can address this correctness problem properly,
ensure that we don't perform the transformation
if there are such problematic external uses.

Making dominator tree available there is going to be involved,
since `-simplifycfg` pass currently does not preserve/update domtree...

3 years ago[NFC][SimplifyCFG] FoldBranchToCommonDest(): pull out 'common successor' into a variable
Roman Lebedev [Mon, 14 Dec 2020 13:37:43 +0000 (16:37 +0300)]
[NFC][SimplifyCFG] FoldBranchToCommonDest(): pull out 'common successor' into a variable

Makes it easier to use it elsewhere

3 years ago[NFC][SimplifyCFG] Add another miscompiled test for PR48450
Roman Lebedev [Mon, 14 Dec 2020 12:30:38 +0000 (15:30 +0300)]
[NFC][SimplifyCFG] Add another miscompiled test for PR48450

3 years ago[libc++] ADL-proof <functional> by adding _VSTD:: qualification on calls.
Arthur O'Dwyer [Tue, 8 Dec 2020 21:15:01 +0000 (16:15 -0500)]
[libc++] ADL-proof <functional> by adding _VSTD:: qualification on calls.

- std::reference_wrapper
- std::function
- std::mem_fn

While I'm here, remove _VSTD:: qualification from calls to `declval`
because it takes no arguments and thus isn't susceptible to ADL.

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

3 years ago[libc++] Consistently replace `::new(__p) T` with `::new ((void*)__p) T`. NFCI.
Arthur O'Dwyer [Sat, 12 Dec 2020 01:30:28 +0000 (20:30 -0500)]
[libc++] Consistently replace `::new(__p) T` with `::new ((void*)__p) T`. NFCI.

Everywhere, normalize the whitespace to `::new (EXPR) T`.
Everywhere, normalize the spelling of the cast to `(void*)EXPR`.

Without the cast to `(void*)`, the expression triggers ADL on GCC.
(I think this is a GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98249)
Even if it doesn't trigger ADL, it still seems incorrect to use any argument
that's not exactly `(void*)` because that opens the possibility of overload
resolution picking a user-defined overload of `operator new`, which would be
wrong.

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

3 years ago[clang-scan-deps] Support clang-cl
Sylvain Audi [Fri, 30 Oct 2020 15:21:58 +0000 (11:21 -0400)]
[clang-scan-deps] Support clang-cl

clang-scan-deps contains some command line parsing and modifications.
This patch adds support for clang-cl command options.

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

3 years ago[libc][Obvious] Include <fenv.h> from DummyFenv.h.
Siva Chandra Reddy [Mon, 14 Dec 2020 16:42:42 +0000 (08:42 -0800)]
[libc][Obvious] Include <fenv.h> from DummyFenv.h.

3 years ago[SLP] Control maximum vectorization factor from TTI
Stanislav Mekhanoshin [Tue, 24 Nov 2020 18:42:43 +0000 (10:42 -0800)]
[SLP] Control maximum vectorization factor from TTI

D82227 has added a proper check to limit PHI vectorization to the
maximum vector register size. That unfortunately resulted in at
least a couple of regressions on SystemZ and x86.

This change reverts PHI handling from D82227 and replaces it with
a more general check in SLPVectorizerPass::tryToVectorizeList().
Moved to tryToVectorizeList() it allows to restart vectorization
if initial chunk fails.

However, this function is more general and handles not only PHI
but everything which SLP handles. If vectorization factor would
be limited to maximum vector register size it would limit much
more vectorization than before leading to further regressions.
Therefore a new TTI callback getMaximumVF() is added with the
default 0 to preserve current behavior and limit nothing. Then
targets can decide what is better for them.

The callback gets ElementSize just like a similar getMinimumVF()
function and the main opcode of the chain. The latter is to avoid
regressions at least on the AMDGPU. We can have loads and stores
up to 128 bit wide, and <2 x 16> bit vector math on some
subtargets, where the rest shall not be vectorized. I.e. we need
to differentiate based on the element size and operation itself.

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

3 years agoRevert "Re-apply "[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins...
Raul Tambre [Mon, 14 Dec 2020 16:41:30 +0000 (18:41 +0200)]
Revert "Re-apply "[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately""

This reverts commit 03ebe1937192c247c4a7b8ec19dde2cf9845c914.

It's still breaking bots, e.g. http://green.lab.llvm.org/green/job/clang-stage1-RA/17027/console although it doesn't change any actual code.
The compile errors don't make much sense either. Revert for now.

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

3 years ago[AMDGPU] Make use of HasSMemRealTime predicate. NFC.
Jay Foad [Thu, 10 Dec 2020 16:49:48 +0000 (16:49 +0000)]
[AMDGPU] Make use of HasSMemRealTime predicate. NFC.

We have this subtarget feature so it makes sense to use it here. This is
NFC because it's always defined by default on GFX8+.

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

3 years ago[VE] Add logical mask intrinsic instructions
Kazushi (Jam) Marukawa [Mon, 7 Dec 2020 11:44:05 +0000 (20:44 +0900)]
[VE] Add logical mask intrinsic instructions

Add andm, orm, xorm, eqvm, nndm, negm, pcvm, lzvm, and tovm intrinsic
instructions, a few pseudo instructions to expand logical intrinsic
using VM512, a mechnism to expand such pseudo instructions, and
regression tests.  Also, assign vector mask types and vector mask
register classes correctly.  This is required to use VM512 registers
as function arguments.

Reviewed By: simoll

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

3 years ago[X86] LowerBUILD_VECTOR - track zero/nonzero elements with APInt masks. NFCI.
Simon Pilgrim [Mon, 14 Dec 2020 14:23:27 +0000 (14:23 +0000)]
[X86] LowerBUILD_VECTOR - track zero/nonzero elements with APInt masks. NFCI.

Prep work for undef/zero 'upper elements' handling as proposed in D92645.

3 years ago[libc++] [P1164] Add tests for create_directories. NFC.
Marek Kurdej [Mon, 14 Dec 2020 16:26:29 +0000 (17:26 +0100)]
[libc++] [P1164] Add tests for create_directories. NFC.

That's a follow-up patch after D92769.

Reviewed By: ldionne, #libc

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

3 years ago[VE] Correct addRegisterClass calls
Kazushi (Jam) Marukawa [Mon, 14 Dec 2020 14:59:16 +0000 (23:59 +0900)]
[VE] Correct addRegisterClass calls

Correct addRegisterClass calls for vector mask registers.

Reviewed By: simoll

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

3 years ago[flang][driver] Fix a small bug (auto vs auto&)
Andrzej Warzynski [Mon, 14 Dec 2020 16:07:24 +0000 (16:07 +0000)]
[flang][driver] Fix a small bug (auto vs auto&)

This bug hasn't affected us yet as our usage is too basic, i.e. we don't
rely on the defaults provided by `SetDefaultFortranOpts` just yet. This
will change shortly.

3 years ago[AIX] Fixed "comparison of unsigned expression >= 0 is always true" gcc warnings.
diggerlin [Mon, 14 Dec 2020 16:08:40 +0000 (11:08 -0500)]
[AIX] Fixed "comparison of unsigned expression >= 0 is always true" gcc warnings.

Summary:

fixed a  Fixed "comparison of unsigned expression >= 0 is always true" gcc warnings.
http://lab.llvm.org:8011/#/builders/5/builds/2407/steps/2/logs/stdio

the error caused by patch https://reviews.llvm.org/D92398

3 years agoReland [DebugInfo] Improve dbg preservation in LSR.
Markus Lavin [Mon, 14 Dec 2020 14:37:34 +0000 (15:37 +0100)]
Reland [DebugInfo] Improve dbg preservation in LSR.

Use SCEV to salvage additional @llvm.dbg.value that have turned into
referencing undef after transformation (and traditional
salvageDebugInfo).  Before rewrite (but after introduction of new
induction variables) use SCEV to compute an equivalent set of values for
each @llvm.dbg.value in the loop body (among the loop header PHI-nodes).
After rewrite (and dead PHI elimination) update those @llvm.dbg.value
now referencing undef by picking a remaining value from its equivalence
set.  Allow match with offset by inserting compensation code in the
DIExpression.

Fixes : PR38815

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

3 years agogenerate_header_tests.py: Sort the header files ASCIIbetically.
Arthur O'Dwyer [Fri, 11 Dec 2020 19:31:54 +0000 (14:31 -0500)]
generate_header_tests.py: Sort the header files ASCIIbetically.

Otherwise they come out in random (inode?) order.

Also `chmod +x` the generator, and re-run it. Somehow on Marek's
machine it produced \r\n line endings?! Open all files with
`newline='\n'` so that (if the Python3 docs are correct)
that won't happen again.

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

3 years ago[libc++] Fix some one-off typos in comments. NFCI.
Arthur O'Dwyer [Sat, 12 Dec 2020 16:57:32 +0000 (11:57 -0500)]
[libc++] Fix some one-off typos in comments. NFCI.

3 years ago[libc++] Remove __is_construct::__nat. NFCI.
Arthur O'Dwyer [Sat, 12 Dec 2020 16:58:26 +0000 (11:58 -0500)]
[libc++] Remove __is_construct::__nat. NFCI.

This type has been unused since commit 5b4cc84b87232e67afb63e2bad429b3211b26964.

3 years ago[libc++] s/insertible/insertable/g. NFCI.
Arthur O'Dwyer [Sat, 12 Dec 2020 16:43:15 +0000 (11:43 -0500)]
[libc++] s/insertible/insertable/g. NFCI.

3 years ago[libc++] s/Birdirectional/Bidirectional/g. NFCI.
Arthur O'Dwyer [Sat, 12 Dec 2020 16:37:36 +0000 (11:37 -0500)]
[libc++] s/Birdirectional/Bidirectional/g. NFCI.

3 years agoRe-apply "[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately"
Raul Tambre [Mon, 14 Dec 2020 14:40:20 +0000 (16:40 +0200)]
Re-apply "[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately"

aa772fc85e0f526615c78b9c3979c2be945a754c (D92530) has landed fixing Apple builds.
Previous quick-fix d9697c2e6b153ac7dc40a69450d9b672f71b1029 (D93198) included in this commit.

Invoking the preprocessor ourselves is fragile and would require us to replicate CMake's handling of definitions, compiler flags, etc for proper compatibility.
In my toolchain builds this notably resulted in a bunch of warnings from unused flags as my CMAKE_C_FLAGS includes CPU-specific optimization options.
Notably this part was already duplicating the logic for VISIBILITY_HIDDEN define.

Instead, symlink the files and set the proper set of defines on each.
This should also be faster as we avoid invoking the compiler multiple times.

Fixes https://llvm.org/PR48494

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

3 years ago[compiler-rt] [builtins] Make lse.S compile on Darwin
Kuba Mracek [Mon, 14 Dec 2020 14:36:41 +0000 (16:36 +0200)]
[compiler-rt] [builtins] Make lse.S compile on Darwin

Reviewed By: ilinpv

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

3 years ago[VPlan] Make VPWidenMemoryInstructionRecipe a VPDef.
Florian Hahn [Mon, 14 Dec 2020 14:13:59 +0000 (14:13 +0000)]
[VPlan] Make VPWidenMemoryInstructionRecipe a VPDef.

This patch updates VPWidenMemoryInstructionRecipe to use VPDef
to manage the value it produces instead of inheriting from VPValue.

Reviewed By: gilr

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

3 years ago[llvm-objdump] Use "--" for long options in --help text
David Spickett [Mon, 30 Nov 2020 11:32:46 +0000 (11:32 +0000)]
[llvm-objdump] Use "--" for long options in --help text

Single dash for these options is not recognised.

Changes found by running this on the --help output
and the user guide:
grep -e ' -[a-zA-Z]\{2,\}'

The user guide was updated in https://reviews.llvm.org/D92305
so no change there.

Reviewed By: jhenderson, MaskRay

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

3 years agoRevert "Consider reference, pointer, and pointer-to-member TemplateArguments to be...
Raphael Isemann [Mon, 14 Dec 2020 13:03:38 +0000 (14:03 +0100)]
Revert "Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types."

This reverts commit 05cdf4acf42acce9ddcff646a5d6ac666710fe6d. It breaks stage-2
compilation of LLVM, see https://reviews.llvm.org/D91488#2451534

3 years ago[SLP] Fix vector element size for the store chains
Anton Afanasyev [Sun, 13 Dec 2020 11:42:25 +0000 (14:42 +0300)]
[SLP] Fix vector element size for the store chains

Vector element size could be different for different store chains.
This patch prevents wrong computation of maximum number of elements
for that case.

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

3 years ago[TableGen] Don't dereference from dyn_cast<> - use cast<> instead. NFCI.
Simon Pilgrim [Mon, 14 Dec 2020 12:12:08 +0000 (12:12 +0000)]
[TableGen] Don't dereference from dyn_cast<> - use cast<> instead. NFCI.

dyn_cast<> can return null if the cast fails, resulting in null dereferences and static analyzer warnings. We should use cast<> instead.

3 years ago[IRCE] Add test case for PR48051
Simon Pilgrim [Mon, 14 Dec 2020 11:39:43 +0000 (11:39 +0000)]
[IRCE] Add test case for PR48051

3 years ago[SVE][CodeGen] Lower scalable floating-point vector reductions
Kerry McLaughlin [Mon, 14 Dec 2020 10:46:32 +0000 (10:46 +0000)]
[SVE][CodeGen] Lower scalable floating-point vector reductions

Changes in this patch:
-  Minor changes to the LowerVECREDUCE_SEQ_FADD function added by @cameron.mcinally
   to also work for scalable types
- Added TableGen patterns for FP reductions with unpacked types (nxv2f16, nxv4f16 & nxv2f32)
- Asserts added to expandFMINNUM_FMAXNUM & expandVecReduceSeq for scalable types

Reviewed By: cameron.mcinally

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

3 years ago[ARM] Improve handling of empty VPT blocks in tail predicated loops
David Green [Mon, 14 Dec 2020 11:17:01 +0000 (11:17 +0000)]
[ARM] Improve handling of empty VPT blocks in tail predicated loops

A vpt block that just contains either VPST;VCTP or VPT;VCTP, once the
VCTP is removed will become invalid. This fixed the first by removing
the now empty block and bails out for the second, as we have no simple
way of converting a VPT to a VCMP.

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

3 years ago[AMDGPU][NFC] Rename opsel/opsel_hi/neg_lo/neg_hi with suffix 0
Carl Ritson [Mon, 14 Dec 2020 11:01:49 +0000 (20:01 +0900)]
[AMDGPU][NFC] Rename opsel/opsel_hi/neg_lo/neg_hi with suffix 0

These parameters set a default value of 0, so I believe they
should include a 0 suffix. This allows for versions which do not
set a default value in future.

Reviewed By: foad

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

3 years ago[AMDGPU][NFC] Remove unused VOP3Mods0Clamp
Carl Ritson [Mon, 14 Dec 2020 11:00:53 +0000 (20:00 +0900)]
[AMDGPU][NFC] Remove unused VOP3Mods0Clamp

This is unused and the selection function does not exist.

Reviewed By: foad

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

3 years ago[XRay] Remove unnecessary <x86intrin.h> include
Raul Tambre [Mon, 14 Dec 2020 09:07:31 +0000 (11:07 +0200)]
[XRay] Remove unnecessary <x86intrin.h> include

It hasn't been necessary since commit 4d4ed0e288bf1f3a90fba6e5b56bc25e2fe961c3 (D43278).

Reviewed By: dberris

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

3 years ago[MLIR] Add atan and atan2 lowerings to CUDA intrinsics
Frederik Gossen [Fri, 11 Dec 2020 16:54:53 +0000 (17:54 +0100)]
[MLIR] Add atan and atan2 lowerings to CUDA intrinsics

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

3 years ago[AMDGPU] Mark amdgpu_gfx functions as module entry function
Sebastian Neubauer [Wed, 9 Dec 2020 16:25:53 +0000 (17:25 +0100)]
[AMDGPU] Mark amdgpu_gfx functions as module entry function

- Allows lds allocations
- Writes resource usage into COMPUTE_PGM_RSRC1 registers in PAL metadata

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

3 years ago[MLIR] Add lowerings for atan and atan2 to ROCDL intrinsics
Frederik Gossen [Fri, 11 Dec 2020 17:00:17 +0000 (18:00 +0100)]
[MLIR] Add lowerings for atan and atan2 to ROCDL intrinsics

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

3 years agoRevert "[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately"
Raul Tambre [Mon, 14 Dec 2020 09:40:24 +0000 (11:40 +0200)]
Revert "[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately"

Causing issues on Apple buildbots.
http://green.lab.llvm.org/green/job/clang-stage1-RA/17019/console

This reverts commit 33b740f8dc3496237619a7bc6722f23655cb1f94.
This reverts commit d9697c2e6b153ac7dc40a69450d9b672f71b1029.

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

3 years ago[compiler-rt][CMake] Define HAS_ASM_LSE on Apple if available
Raul Tambre [Mon, 14 Dec 2020 09:24:02 +0000 (11:24 +0200)]
[compiler-rt][CMake] Define HAS_ASM_LSE on Apple if available

Should hopefully fix 33b740f8dc3496237619a7bc6722f23655cb1f94 (D93178) failing on bots.

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

3 years ago[clang][cli] Port FileSystem options to new option parsing system
Jan Svoboda [Mon, 14 Dec 2020 09:03:18 +0000 (10:03 +0100)]
[clang][cli] Port FileSystem options to new option parsing system

Depends on D84187

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

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

3 years ago[llvm-readobj] - For SHT_REL relocations, don't display an addend.
Georgii Rymar [Thu, 10 Dec 2020 13:12:26 +0000 (16:12 +0300)]
[llvm-readobj] - For SHT_REL relocations, don't display an addend.

This is https://bugs.llvm.org/show_bug.cgi?id=44257.

In LLVM style we always print `0` as addend when dumping
SHT_REL relocations. It is confusing, this patch stops
printing it as the first comment on the bug page suggests.

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

3 years ago[clang][cli] Better defaults for MarshallingInfoString
Jan Svoboda [Mon, 14 Dec 2020 08:49:55 +0000 (09:49 +0100)]
[clang][cli] Better defaults for MarshallingInfoString

Depends on D84018

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[llvm-readelf] - Improve ELF type field dumping.
Georgii Rymar [Fri, 11 Dec 2020 09:46:30 +0000 (12:46 +0300)]
[llvm-readelf] - Improve ELF type field dumping.

This is related to https://bugs.llvm.org/show_bug.cgi?id=40868.

Currently we don't print `OS Specific`/``Processor Specific`/`<unknown>`
prefixes when dumping the ELF file type. This is not consistent
with GNU readelf. The patch fixes it.

Also, this patch removes the `types.test`, because we already have
`file-types.test`, which tests more cases and this patch revealed that
we have such a duplicate.

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

3 years ago[clang][cli] Port Preprocessor and PreprocessorOutput option flags to new option...
Jan Svoboda [Fri, 11 Dec 2020 15:19:03 +0000 (16:19 +0100)]
[clang][cli] Port Preprocessor and PreprocessorOutput option flags to new option parsing system

Depends on D83979

Reviewed By: dexonsmith

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

3 years ago[Flang][OpenMP-5.0] Semantic checks for flush construct.
sameeran joshi [Mon, 14 Dec 2020 08:00:26 +0000 (13:30 +0530)]
[Flang][OpenMP-5.0] Semantic checks for flush construct.

From OMP 5.0 [2.17.8]
Restriction:
If memory-order-clause is release,acquire, or acq_rel, list items must not be specified on the flush directive.

Reviewed By: kiranchandramohan, clementval

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

3 years ago[clangd] Go-to-definition on pure virtual method decls jumps to all overrides.
Haojian Wu [Mon, 14 Dec 2020 07:55:47 +0000 (08:55 +0100)]
[clangd] Go-to-definition on pure virtual method decls jumps to all overrides.

Reviewed By: usaxena95

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

3 years ago[PowerPC][FP128] Fix the incorrect signature for math library call
QingShan Zhang [Mon, 14 Dec 2020 07:39:06 +0000 (07:39 +0000)]
[PowerPC][FP128] Fix the incorrect signature for math library call

The runtime library has two family library implementation for ppc_fp128 and fp128.
For IBM Long double(ppc_fp128), it is suffixed with 'l', i.e(sqrtl). For
IEEE Long double(fp128), it is suffixed with "ieee128" or "f128".
We miss to map several libcall for IEEE Long double.

Reviewed By: qiucf

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

3 years ago[AST][RecoveryExpr] Preserve type for broken overrload member call expr.
Haojian Wu [Mon, 14 Dec 2020 07:45:13 +0000 (08:45 +0100)]
[AST][RecoveryExpr] Preserve type for broken overrload member call expr.

Reviewed By: sammccall

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

3 years ago[Flang][OpenMP] Semantic checks for Atomic construct.
sameeran joshi [Mon, 14 Dec 2020 07:11:39 +0000 (12:41 +0530)]
[Flang][OpenMP] Semantic checks for Atomic construct.

Patch implements restrictions from 2.17.7  of OpenMP 5.0 standard for atomic Construct. Tests for the same are added.

One of the restriction
`OpenMP constructs may not be encountered during execution of an atomic region.`
Is mentioned in 5.0 standard to be a semantic restriction, but given the stricter nature of parser in F18 it's caught at parsing itself.

This patch is a next patch in series from D88965.

Reviewed By: clementval

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

3 years ago[LoopIdiom] Pre-commit tests for D92745. NFC
Craig Topper [Mon, 14 Dec 2020 04:26:00 +0000 (20:26 -0800)]
[LoopIdiom] Pre-commit tests for D92745. NFC

3 years ago[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately
Raul Tambre [Sun, 13 Dec 2020 14:48:26 +0000 (16:48 +0200)]
[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately

Invoking the preprocessor ourselves is fragile and would require us to replicate CMake's handling of definitions, compiler flags, etc for proper compatibility.
In my toolchain builds this notably resulted in a bunch of warnings from unused flags as my CMAKE_C_FLAGS includes CPU-specific optimization options.
Notably this part was already duplicating the logic for VISIBILITY_HIDDEN define.

Instead, symlink the files and set the proper set of defines on each.
This should also be faster as we avoid invoking the compiler multiple times.

Fixes https://llvm.org/PR48494

Reviewed By: ilinpv

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

3 years agoFix test expectation to cope with custom version namespaces.
Richard Smith [Mon, 14 Dec 2020 06:41:19 +0000 (22:41 -0800)]
Fix test expectation to cope with custom version namespaces.

3 years agoConsider reference, pointer, and pointer-to-member TemplateArguments to be different...
Richard Smith [Sun, 15 Nov 2020 01:37:25 +0000 (17:37 -0800)]
Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types.

For the Itanium ABI, this implements the mangling rule suggested in
https://github.com/itanium-cxx-abi/cxx-abi/issues/47, namely mangling
such template arguments as being cast to the parameter type in the case
where the template name is overloadable. This can cause a mangling
change for rare cases, where

 * the template argument declaration is converted from its declared type
   to the type of the template parameter, and
 * the template parameter either has a deduced type or is a parameter of
   a function template.

However, such changes are necessary to avoid mangling collisions. The
ABI changes can be reversed with -fclang-abi-compat=11 or earlier.

Re-commit with a fix for the regression introduced last time: don't
expect parameters and arguments to line up inside an <unresolved-name>
mangling.

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

3 years agoFactor out and centralize repeated 'getExpandedPackSize'.
Richard Smith [Sun, 13 Dec 2020 08:50:01 +0000 (00:50 -0800)]
Factor out and centralize repeated 'getExpandedPackSize'.

3 years ago[SLP][Test] Precommit test for D93192
Anton Afanasyev [Sun, 13 Dec 2020 11:00:08 +0000 (14:00 +0300)]
[SLP][Test] Precommit test for D93192

This test shows failure of combined stores chains vectorization

3 years ago[MachineCombiner][NFC] Add MustReduceRegisterPressure goal
Chen Zheng [Wed, 25 Nov 2020 02:33:13 +0000 (21:33 -0500)]
[MachineCombiner][NFC] Add MustReduceRegisterPressure goal

add a new goal MustReduceRegisterPressure for machine combiner pass.

PowerPC will use this new goal to do some register pressure related optimization.

Reviewed By: spatel

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

3 years ago[CodeGen] Use llvm::erase_value (NFC)
Kazu Hirata [Mon, 14 Dec 2020 04:05:47 +0000 (20:05 -0800)]
[CodeGen] Use llvm::erase_value (NFC)

3 years ago[Target] Use llvm::is_contained (NFC)
Kazu Hirata [Mon, 14 Dec 2020 03:35:10 +0000 (19:35 -0800)]
[Target] Use llvm::is_contained (NFC)

3 years ago[opt][NPM] Pin -lower-amx-type to legacy PM
Arthur Eubanks [Mon, 14 Dec 2020 03:13:48 +0000 (19:13 -0800)]
[opt][NPM] Pin -lower-amx-type to legacy PM

This is part of the codegen pipeline.

3 years agoRe-apply 8904ee8ac7e with missing header included this time.
Lang Hames [Mon, 14 Dec 2020 02:38:00 +0000 (13:38 +1100)]
Re-apply 8904ee8ac7e with missing header included this time.

3 years agoRevert "[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs."
Nico Weber [Mon, 14 Dec 2020 02:30:38 +0000 (21:30 -0500)]
Revert "[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs."

This reverts commit 8904ee8ac7ebcc50a60de0914abc6862e28b6664.
Didn't `git add` llvm/ExecutionEngine/JITLink/JITLinkDylib.h and hence doesn't
build anywhere.

3 years ago[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs.
Lang Hames [Mon, 14 Dec 2020 00:14:25 +0000 (11:14 +1100)]
[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs.

JITLinkDylib represents a target dylib for a JITLink link. By representing this
explicitly we can:
  - Enable JITLinkMemoryManagers to manage allocations on a per-dylib basis
    (e.g by maintaining a seperate allocation pool for each JITLinkDylib).
  - Enable new features and diagnostics that require information about the
    target dylib (not implemented in this patch).

3 years ago[JITLink] Fix include guard end comment.
Lang Hames [Sun, 13 Dec 2020 23:41:07 +0000 (10:41 +1100)]
[JITLink] Fix include guard end comment.

3 years ago[ORC] Prefer preincrement on iterator.
Lang Hames [Sun, 13 Dec 2020 08:53:18 +0000 (19:53 +1100)]
[ORC] Prefer preincrement on iterator.

3 years ago[clangd] Fix locateMacroAt() for macro definition outside preamble
Nathan Ridge [Sun, 8 Nov 2020 07:58:17 +0000 (02:58 -0500)]
[clangd] Fix locateMacroAt() for macro definition outside preamble

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

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

3 years ago[NFC][AMDGPU] Reformat AMD GPU targets in cuda.cpp
Tony [Sun, 13 Dec 2020 00:38:40 +0000 (00:38 +0000)]
[NFC][AMDGPU] Reformat AMD GPU targets in cuda.cpp

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

3 years ago[X86] Add ExeDomain = SSEPackedSingle to cvtss2sd and cvtsd2ss instrutions.
Craig Topper [Sun, 13 Dec 2020 20:35:24 +0000 (12:35 -0800)]
[X86] Add ExeDomain = SSEPackedSingle to cvtss2sd and cvtsd2ss instrutions.

Prep for D92993

3 years ago[X86] Add isel patterns to form VPDPWSSD from (add (vpmaddwd X, Y), Z) when AVXVNNI...
Craig Topper [Sun, 13 Dec 2020 19:44:38 +0000 (11:44 -0800)]
[X86] Add isel patterns to form VPDPWSSD from (add (vpmaddwd X, Y), Z) when AVXVNNI is enabled.

We already have these patterns for AVX512VNNI.

3 years ago[AC] Handle (X+C1)<C2 assumes (PR48408)
Nikita Popov [Sun, 13 Dec 2020 19:56:20 +0000 (20:56 +0100)]
[AC] Handle (X+C1)<C2 assumes (PR48408)

InstCombine canonicalizes X>C && X<C' style comparisons into
(X+C1)<C2. This type of expression is recognized by some analyses
like LVI, but currently not when used inside assumptions, because
AssumptionCache does not track affected values for it.

3 years ago[X86] Extend varargs test
Harald van Dijk [Sun, 13 Dec 2020 18:33:10 +0000 (18:33 +0000)]
[X86] Extend varargs test

This extends the existing x86-64-varargs test by passing enough
arguments that they need to be passed in memory, and by passing them in
reverse order, using va_arg for each argument to retrieve them and
restoring them to the correct order, and by using va_copy to have two
va_lists to use with va_arg.

3 years ago[Analysis] Remove unused declaration replaceEdgeKey (NFC)
Kazu Hirata [Sun, 13 Dec 2020 18:03:45 +0000 (10:03 -0800)]
[Analysis] Remove unused declaration replaceEdgeKey (NFC)

The declaration was introduced without a corresponding definition on
Feb 9, 2017 in commit aaad9f84be2a6a3eb8202ed4eaa5e5e2021d055e.

3 years ago[Transforms] Use llvm::erase_value (NFC)
Kazu Hirata [Sun, 13 Dec 2020 17:48:47 +0000 (09:48 -0800)]
[Transforms] Use llvm::erase_value (NFC)

3 years ago[NFC]{AMDGPU] Update AMDGPUUsage with AMD RDNA 2 reference
Tony [Sun, 13 Dec 2020 01:06:18 +0000 (01:06 +0000)]
[NFC]{AMDGPU] Update AMDGPUUsage with AMD RDNA 2 reference

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

3 years ago[X86][SSE] combineX86ShufflesRecursively - add basic handling for combining shuffles...
Simon Pilgrim [Sun, 13 Dec 2020 17:18:07 +0000 (17:18 +0000)]
[X86][SSE] combineX86ShufflesRecursively - add basic handling for combining shuffles of different widths (PR45974)

If a faux shuffle uses smaller shuffle inputs, try to recursively combine with those inputs directly instead of widening them immediately. Then widen all smaller inputs at the bottom of the recursion.

This will still mean we're generating nodes on the fly (PR45974) even if we don't combine to a new shuffle but it does help AVX2+ targets combine across xmm/ymm/zmm types, mainly as variable shuffles.

3 years ago[X86][AVX] Add additional X86ISD::SUBV_BROADCAST_LOAD test case for D92645
Simon Pilgrim [Sun, 13 Dec 2020 16:43:17 +0000 (16:43 +0000)]
[X86][AVX] Add additional X86ISD::SUBV_BROADCAST_LOAD test case for D92645

Suggested by @yubing - to check whether we can reuse a single subvector broadcast for 128/256/512-bit vectors.

3 years ago[VPlan] Use interleaveComma in printOperands() (NFC).
Florian Hahn [Sun, 13 Dec 2020 16:28:22 +0000 (16:28 +0000)]
[VPlan] Use interleaveComma in printOperands() (NFC).

3 years agoRecommit "[AArch64] Lower calls with rv_marker attribute."
Florian Hahn [Sun, 13 Dec 2020 15:46:13 +0000 (15:46 +0000)]
Recommit "[AArch64] Lower calls with rv_marker attribute."

This recommits a87fccb3ff9c with a fix to mark the destination operand
of the marker instruction as def, to fix a machine verifier failure.

This reverts the revert commit c0f2cea7c0afc7c9688e1633f2a9b25c8ea4a9bd.

3 years ago[X86] Convert fadd/fmul _mm_reduce_* intrinsics to emit llvm.reduction intrinsics...
Simon Pilgrim [Sun, 13 Dec 2020 15:37:35 +0000 (15:37 +0000)]
[X86] Convert fadd/fmul _mm_reduce_* intrinsics to emit llvm.reduction intrinsics (PR47506)

Followup to D87604, having confirmed on PR47506 that we can use the llvm codegen expansion for fadd/fmul as well.

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

3 years ago[X86][SSE] combineReductionToHorizontal - add vXi8 ISD::MUL reduction handling (PR39709)
Simon Pilgrim [Sun, 13 Dec 2020 15:16:21 +0000 (15:16 +0000)]
[X86][SSE] combineReductionToHorizontal - add vXi8 ISD::MUL reduction handling (PR39709)

Default expansion leads to repeated extensions/truncations to/from vXi16 which shuffle combining and demanded elts can't completely unravel.

Better just to promote (any_extend) the input and perform a vXi16 reduction.

We'll be able to remove a lot of this if we ever get decent legalization support for reduction intrinsics in SelectionDAG.

3 years agoDon't emit on op diagnostic in reproducer emission
Jacques Pienaar [Sun, 13 Dec 2020 15:21:32 +0000 (07:21 -0800)]
Don't emit on op diagnostic in reproducer emission

This avoids dumping the module post emitting a reproducer, which results in
many MB logs where a reproducer has already been neatly generated.

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

3 years ago[MLIR][SPIRV] Add support for GLSL F/U/SClamp.
ergawy [Sun, 13 Dec 2020 14:56:37 +0000 (09:56 -0500)]
[MLIR][SPIRV] Add support for GLSL F/U/SClamp.

Adds support for 3 ternary ops from SPIR-V extended instructions for
GLSL. Namely, adds support for FClamp, UClamp, and SClamp.

Reviewed By: antiagainst

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

3 years ago[X86] Regenerate vector-reduce-mul.ll with common check prefixes. NFC.
Simon Pilgrim [Wed, 9 Dec 2020 18:18:50 +0000 (18:18 +0000)]
[X86] Regenerate vector-reduce-mul.ll with common check prefixes. NFC.

Try to merge AVX1/AVX2/AVX512 codegen checks where possible

3 years ago[clang-format] Remove double trim
Björn Schäpers [Sat, 28 Nov 2020 04:58:58 +0000 (05:58 +0100)]
[clang-format] Remove double trim

Lines[i] is already trimmed 3 lines before

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

3 years ago[BasicAA] Handle known non-zero variable index
Nikita Popov [Thu, 10 Dec 2020 21:29:33 +0000 (22:29 +0100)]
[BasicAA] Handle known non-zero variable index

BasicAA currently handles cases like Scale*V0 + (-Scale)*V1 where
V0 != V1, but does not handle the simpler case of Scale*V with
V != 0. Add it based on an isKnownNonZero() call.

I'm not passing a context instruction for now, because the existing
approach of always using GEP1 for context could result in symmetry
issues.

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

3 years ago[VE] Optimize toolchain regression test
Kazushi (Jam) Marukawa [Thu, 10 Dec 2020 08:53:07 +0000 (17:53 +0900)]
[VE] Optimize toolchain regression test

Optimize toolchain regression test for VE by removing not a useful test
(-fuse-init-array test) and merge several tests to one test which checks
default behavior of driver.  Also add sysroot to reduce conflicts.

These are suggested in https://reviews.llvm.org/D92996.
Thank you so much.

Reviewed By: MaskRay

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

3 years ago[lldb] [Process/FreeBSD] Add more 'override' keywords
Michał Górny [Sun, 13 Dec 2020 08:18:41 +0000 (09:18 +0100)]
[lldb] [Process/FreeBSD] Add more 'override' keywords

3 years ago[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation.
Christian Sigg [Sat, 12 Dec 2020 09:50:41 +0000 (10:50 +0100)]
[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation.

This is a preparation step to remove those methods from OpState.

Reviewed By: mehdi_amini

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

3 years ago[AsmParser] Fix support for zero bit integer types.
Chris Lattner [Sun, 13 Dec 2020 05:24:18 +0000 (21:24 -0800)]
[AsmParser] Fix support for zero bit integer types.

Zero bit integer types are supported by IntegerType for consistency,
but the asmparser never got updated. Allow them to be parsed, as
required to fix CIRCT issue #316

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