platform/upstream/llvm.git
3 years ago[NFC][AIX][XCOFF] Fix compile warning on strncpy
Yang Fan [Sun, 17 Jan 2021 04:35:01 +0000 (12:35 +0800)]
[NFC][AIX][XCOFF] Fix compile warning on strncpy

GCC warning:
```
In file included from /usr/include/string.h:495,
                 from /usr/include/c++/9/cstring:42,
                 from /llvm-project/llvm/include/llvm/ADT/Hashing.h:53,
                 from /llvm-project/llvm/include/llvm/ADT/ArrayRef.h:12,
                 from /llvm-project/llvm/include/llvm/MC/MCAsmBackend.h:12,
                 from /llvm-project/llvm/lib/MC/XCOFFObjectWriter.cpp:14:
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘{anonymous}::Section::Section(const char*, llvm::XCOFF::SectionTypeFlags, bool, {anonymous}::CsectGroups)’ at /llvm-project/llvm/lib/MC/XCOFFObjectWriter.cpp:146:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 8 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Reviewed By: hubert.reinterpretcast

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

3 years ago[libc][NFC][Obvious] Add a missing dep.
Siva Chandra [Tue, 19 Jan 2021 05:59:12 +0000 (21:59 -0800)]
[libc][NFC][Obvious] Add a missing dep.

3 years agoFix a few GCC compiler warnings (NFC)
Mehdi Amini [Tue, 19 Jan 2021 05:59:15 +0000 (05:59 +0000)]
Fix a few GCC compiler warnings (NFC)

3 years ago[libc][NFC] Use ASSERT_EQ instead of EXPECT_EQ in fenv/exception_status_test
Siva Chandra Reddy [Tue, 19 Jan 2021 05:36:40 +0000 (21:36 -0800)]
[libc][NFC] Use ASSERT_EQ instead of EXPECT_EQ in fenv/exception_status_test

3 years ago[ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared.
Lang Hames [Tue, 19 Jan 2021 04:58:42 +0000 (15:58 +1100)]
[ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared.

OrcShared is the correct home for this header since Orc was split in
1d0676b54c4. (It should have been moved in that commit, but was overlooked).

3 years ago[c++20] P1907R1: Support for generalized non-type template arguments of scalar type.
Richard Smith [Sat, 7 Nov 2020 02:14:41 +0000 (18:14 -0800)]
[c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

Previously committed as 9e08e51a20d0d2b1c5724bb17e969d036fced4cd, and
reverted because a dependency commit was reverted. This incorporates the
following follow-on commits that were also reverted:

7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0 by Simon Pilgrim
ed13d8c66781b50ff007cb089c5905f9bb9e8af2 by me
95c7b6cadbc9a3d4376ef44edbeb3c8bb5b8d7fc by Sam McCall
430d5d8429473c2b10b109991d7577a3cea41140 by Dave Zarzycki

3 years agoFollowing up on PR48517, fix handling of template arguments that refer
Richard Smith [Wed, 16 Dec 2020 21:51:56 +0000 (13:51 -0800)]
Following up on PR48517, fix handling of template arguments that refer
to dependent declarations.

Treat an id-expression that names a local variable in a templated
function as being instantiation-dependent.

This addresses a language defect whereby a reference to a dependent
declaration can be formed without any construct being value-dependent.
Fixing that through value-dependence turns out to be problematic, so
instead this patch takes the approach (proposed on the core reflector)
of allowing the use of pointers or references to (but not values of)
dependent declarations inside value-dependent expressions, and instead
treating template arguments as dependent if they evaluate to a constant
involving such dependent declarations.

This ends up affecting a bunch of OpenMP tests, due to OpenMP
imprecisely handling instantiation-dependent constructs, bailing out
early instead of processing dependent constructs to the extent possible
when handling the template.

Previously committed as 8c1f2d15b826591cdf6bd6b468b8a7d23377b29e, and
reverted because a dependency commit was reverted.

3 years agoPR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of
Richard Smith [Fri, 18 Dec 2020 05:27:11 +0000 (21:27 -0800)]
PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of
the nested-name-specifier when determining whether a qualified type is
instantiation-dependent.

Previously reverted in 25a02c3d1a688d3cd18faef96c75fa553efbbac7 due to
causing us to reject some code. It turns out that the rejected code was
ill-formed (no diagnostic required).

3 years agoDR2064: decltype(E) is only a dependent type if E is type-dependent, not
Richard Smith [Thu, 17 Dec 2020 22:36:26 +0000 (14:36 -0800)]
DR2064: decltype(E) is only a dependent type if E is type-dependent, not
if E is merely instantiation-dependent.

Previously reverted in 34e72a146111dd986889a0f0ec8767b2ca6b2913;
re-committed with a fix to an issue that caused name mangling to assert.

3 years ago[X86][AMX] Clear AMX lit test case.
Luo, Yuanke [Mon, 18 Jan 2021 13:24:09 +0000 (21:24 +0800)]
[X86][AMX] Clear AMX lit test case.

Add nounwind attribute to avoid generating cfi instructions. Also make
global buffer 64 bytes align in lit test case.

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

3 years ago[PowerPC] Sign extend comparison operand for signed atomic comparisons
Nemanja Ivanovic [Tue, 19 Jan 2021 03:19:11 +0000 (21:19 -0600)]
[PowerPC] Sign extend comparison operand for signed atomic comparisons

As of 8dacca943af8a53a23b1caf3142d10fb4a77b645, we sign extend the atomic loaded
operand for signed subword comparisons. However, the assumption that the other
operand is correctly sign extended doesn't always hold. This patch sign extends
the other operand if it needs to be sign extended.

This is a second fix for https://bugs.llvm.org/show_bug.cgi?id=30451

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

3 years agoPR48763: Better handling for classes that inherit a default constructor.
Richard Smith [Fri, 15 Jan 2021 23:50:25 +0000 (15:50 -0800)]
PR48763: Better handling for classes that inherit a default constructor.

The C++ standard wording doesn't appear to properly handle the case
where a class inherits a default constructor from a base class. Various
properties of classes are defined in terms of the corresponding property
of the default constructor, and in this case, the class does not have a
default constructor despite being default-constructible, which the
wording doesn't handle properly.

This change implements a tentative fix for these problems, which has
also been proposed to the C++ committee: if a class would inherit a
default constructor, and does not explicitly declare one, then one is
implicitly declared.

3 years ago[X86] Fix tile spill merge issue.
Luo, Yuanke [Fri, 15 Jan 2021 13:57:47 +0000 (21:57 +0800)]
[X86] Fix tile spill merge issue.

This is a additional bug fix for c5be0e0cc0. The distance for
the spill instructions is wrong in previous patch.

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

3 years agoRevert "[NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike."
Chen Zheng [Tue, 19 Jan 2021 02:33:31 +0000 (21:33 -0500)]
Revert "[NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike."

This reverts commit 3bdf4507b66348ad78df4655a8e4f36c3fc10f3c.

Post commit comments need to be addressed first.

3 years agoAddress unused variable warning
Juneyoung Lee [Tue, 19 Jan 2021 00:30:16 +0000 (09:30 +0900)]
Address unused variable warning

3 years ago[InstCombine,InstSimplify] Optimize select followed by and/or/xor
Juneyoung Lee [Tue, 19 Jan 2021 00:00:46 +0000 (09:00 +0900)]
[InstCombine,InstSimplify] Optimize select followed by and/or/xor

This patch adds `A & (A && B)` -> `A && B`  (similarly for or + logical or)

Also, this patch adds `~(select C, (icmp pred X, Y), const)` -> `select C, (icmp pred' X, Y), ~const`.

Alive2 proof:
merge_and: https://alive2.llvm.org/ce/z/teMR97
merge_or: https://alive2.llvm.org/ce/z/b4yZUp
xor_and: https://alive2.llvm.org/ce/z/_-TXHi
xor_or: https://alive2.llvm.org/ce/z/2uYx_a

Reviewed By: nikic

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

3 years agoRegenerate the feature test macro unit-tests. NFCI.
Arthur O'Dwyer [Tue, 19 Jan 2021 00:05:08 +0000 (19:05 -0500)]
Regenerate the feature test macro unit-tests. NFCI.

Somehow commit 1f1250151f222ba391d05dcc173f4b6c65d05ca2 added the
right code but with the wrong whitespace.

3 years ago[OpenMP][Docs] Fix typos in FAQ (NFC)
Kelvin Li [Mon, 18 Jan 2021 23:55:58 +0000 (18:55 -0500)]
[OpenMP][Docs] Fix typos in FAQ (NFC)

3 years ago[SimplifyCFG] Update SimplifyBranchOnICmpChain to recognize select form of and/or
Juneyoung Lee [Mon, 18 Jan 2021 04:32:31 +0000 (13:32 +0900)]
[SimplifyCFG] Update SimplifyBranchOnICmpChain to recognize select form of and/or

This patch teaches SimplifyCFG::SimplifyBranchOnICmpChain to understand select form of
(x == C1 || x == C2 || ...) / (x != C1 && x != C2 && ...) and optimize them into switch if possible.
D93065 has more context about the transition, including links to the list of optimizations being updated.

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

3 years ago[LoopInfo] Fix a typo in compareLoops
Kazu Hirata [Mon, 18 Jan 2021 22:53:21 +0000 (14:53 -0800)]
[LoopInfo] Fix a typo in compareLoops

The code here is checking to see if two sets are identical.
OtherBlocksSet should point to OtherL->getBlocksSet() instead.

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

3 years ago[x86] add cast to avoid compile-time warning; NFC
Sanjay Patel [Mon, 18 Jan 2021 22:46:39 +0000 (17:46 -0500)]
[x86] add cast to avoid compile-time warning; NFC

3 years ago[libc++] NFCI: Refactor allocator_traits
Louis Dionne [Tue, 12 Jan 2021 16:53:24 +0000 (11:53 -0500)]
[libc++] NFCI: Refactor allocator_traits

The implementation had a lot of boilerplate and was more complicated than
necessary. This NFC refactoring introduces a few macros to reduce code
duplication, and uses a consistent style and formatting for the whole file.

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

3 years ago[SLP] match maxnum/minnum intrinsics as FP reduction ops
Sanjay Patel [Mon, 18 Jan 2021 21:18:57 +0000 (16:18 -0500)]
[SLP] match maxnum/minnum intrinsics as FP reduction ops

After much refactoring over the last 2 weeks to the reduction
matching code, I think this change is finally ready.

We effectively broke fmax/fmin vector reduction optimization
when we started canonicalizing to intrinsics in instcombine,
so this should restore that functionality for SLP.

There are still FMF problems here as noted in the code comments,
but we should be avoiding miscompiles on those for fmax/fmin by
restricting to full 'fast' ops (negative tests are included).

Fixing FMF propagation is a planned follow-up.

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

3 years ago[RISCV] Remove empty Sched instantiations from the end of InstAlias defs. NFCI
Craig Topper [Mon, 18 Jan 2021 21:35:26 +0000 (13:35 -0800)]
[RISCV] Remove empty Sched instantiations from the end of InstAlias defs. NFCI

InstAliases don't need scheduling information so I'm not sure what
these lines were even doing. Especially since the records don't
have names.

3 years ago[PredicateInfo] Add more and/or tests (NFC)
Nikita Popov [Mon, 18 Jan 2021 21:14:55 +0000 (22:14 +0100)]
[PredicateInfo] Add more and/or tests (NFC)

3 years ago[OpenMP][NFC] Fix test
AndreyChurbanov [Mon, 18 Jan 2021 21:05:34 +0000 (00:05 +0300)]
[OpenMP][NFC] Fix test

The test fails if memkind library is accessible.

3 years agoNFC: Document current MLIR Python ODS conventions.
Stella Laurenzo [Mon, 18 Jan 2021 20:23:29 +0000 (12:23 -0800)]
NFC: Document current MLIR Python ODS conventions.

* We had let the documentation get stale and catching it up prior to proposing changes.

3 years ago[libc++] improve feature test macro script
Wim Leflere [Mon, 18 Jan 2021 20:17:28 +0000 (15:17 -0500)]
[libc++] improve feature test macro script

I've been playing a bit with the `generate_feature_test_macro_components.py` script and replaced some hardcoded values with extra code generation (generate ALL the things).
The output is the same and it makes updating the script less work for the coming 25 C++ standards (until 2 digit number overflow).

Feel free to 'veto' if you think it's overkill.

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

3 years ago[NFC] Update some mlir python documentation.
Stella Laurenzo [Mon, 18 Jan 2021 19:49:06 +0000 (11:49 -0800)]
[NFC] Update some mlir python documentation.

* Development setup recommendations.
* Test updates to match what we actually do.
* Update cmake variable `PYTHON_EXECUTABLE` -> `Python3_EXECUTABLE` to match the upgrade to python3 repo wide.

3 years ago[libc++] Rename check-cxx-deps to cxx-test-depends for consistency
Louis Dionne [Tue, 12 Jan 2021 15:56:57 +0000 (10:56 -0500)]
[libc++] Rename check-cxx-deps to cxx-test-depends for consistency

Several subprojects have targets that do the same thing, and they all
follow the same naming convention: llvm-test-depends, clang-test-depends,
lld-test-depends, etc.

This makes libc++ consistent with other LLVM projects.
Thanks to Duncan Exon Smith for noticing and suggesting the change.

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

3 years agoRecommit "[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with...
Craig Topper [Mon, 18 Jan 2021 19:05:11 +0000 (11:05 -0800)]
Recommit "[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with multiple scalable vector results."

This recommits 2c51bef76cbf0149101b9e7c7c658b4a58657929.

I've fixed the broken check line from when I renamed the test function.

Original commit message:
This builds on D94142 where scalable vectors are allowed in structs.

I did have to fix one scalable vector issue in the vector type
creation for these intrinsics where we used getVectorNumElements
instead of ElementCount.

3 years agoRevert "[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with...
Craig Topper [Mon, 18 Jan 2021 19:00:20 +0000 (11:00 -0800)]
Revert "[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with multiple scalable vector results."

This reverts commit 2c51bef76cbf0149101b9e7c7c658b4a58657929.

I seem to have messed up the check lines in the test.

3 years ago[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with multiple...
Craig Topper [Mon, 18 Jan 2021 17:39:25 +0000 (09:39 -0800)]
[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with multiple scalable vector results.

This builds on D94142 where scalable vectors are allowed in structs.

I did have to fix one scalable vector issue in the vector type
creation for these intrinsics where we used getVectorNumElements
instead of ElementCount.

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

3 years ago[clang] Allow LifetimeExtendedTemporary to have no access specifier
Adam Czachorowski [Fri, 15 Jan 2021 17:37:25 +0000 (18:37 +0100)]
[clang] Allow LifetimeExtendedTemporary to have no access specifier

The check only runs in debug mode during serialization, but
assert()-fail on:
  struct S { const int& x = 7; };
in C++ mode.

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

3 years ago[llvm] Use the default value of drop_begin (NFC)
Kazu Hirata [Mon, 18 Jan 2021 18:16:36 +0000 (10:16 -0800)]
[llvm] Use the default value of drop_begin (NFC)

3 years ago[STLExtras] Add a default value to drop_begin
Kazu Hirata [Mon, 18 Jan 2021 18:16:34 +0000 (10:16 -0800)]
[STLExtras] Add a default value to drop_begin

This patch adds the default value of 1 to drop_begin.

In the llvm codebase, 70% of calls to drop_begin have 1 as the second
argument.  The interface similar to with std::next should improve
readability.

This patch converts a couple of calls to drop_begin as examples.

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

3 years ago[llvm] Populate std::vector at construction time (NFC)
Kazu Hirata [Mon, 18 Jan 2021 18:16:33 +0000 (10:16 -0800)]
[llvm] Populate std::vector at construction time (NFC)

3 years ago[lldb][docs] Use 'any' as the default role in LLDB's sphinx project
Raphael Isemann [Mon, 18 Jan 2021 18:07:51 +0000 (19:07 +0100)]
[lldb][docs] Use 'any' as the default role in LLDB's sphinx project

sphinx processes text in backticks depending on what 'role' it has (e.g.,
`:code:\`blub\`` -> role is `code`). If no role is provided, the default role is
taken which is right now using the default value of `content`. `content` only
really makes the text cursive which isn't really useful for anything right now.

Sphinx recommends using the `any` role by default [1] as that turns text in
backticks without an explicit roles into some kind of smart reference. If we did
this in LLDB, then we could just reference SB API classes by doing `\`SBValue\``
instead of typing out the rather verbose `:py:class:`/`:py:func:`/... role
before each reference. This would be especially nice when writing the SB API
docs itself as we constantly have to reference other classes.

[1] https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-any

Reviewed By: JDevlieghere

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

3 years ago[AArch64] Revert back to Intrinsic<> for TME instructions.
Florian Hahn [Mon, 18 Jan 2021 17:49:05 +0000 (17:49 +0000)]
[AArch64] Revert back to Intrinsic<> for TME instructions.

This patch reverts back to Intrinsic for the instructions for the
transactional memory extension, so nosync is not included.

3 years ago[LLD][ELF][AArch64] Set _GLOBAL_OFFSET_TABLE_ at the start of .got
Adhemerval Zanella [Fri, 15 Jan 2021 17:58:43 +0000 (17:58 +0000)]
[LLD][ELF][AArch64] Set _GLOBAL_OFFSET_TABLE_ at the start of .got

The commit 18aa0be36ed9 changed the default GotBaseSymInGotPlt to true
for AArch64.  This is different than binutils, where
_GLOBAL_OFFSET_TABLE_ points at the start or .got.

It seems to not intefere with current relocations used by LLVM.  However
as indicated by PR#40357 [1] gcc generates R_AARCH64_LD64_GOTPAGE_LO15
for -pie (in fact it also generated the relocation for -fpic).

This change is requires to correctly handle R_AARCH64_LD64_GOTPAGE_LO15
by lld from objects generated by gcc.

[1] https://bugs.llvm.org/show_bug.cgi?id=40357

3 years ago[AArch64] Make target intrinsics DefaultAttrIntrinsics.
Florian Hahn [Mon, 18 Jan 2021 17:18:58 +0000 (17:18 +0000)]
[AArch64] Make target intrinsics DefaultAttrIntrinsics.

DefaultAttrIntrinsics was introduced to add very common attributes to a
large set of intrinsics.

Currently the added attributes include:

    nofree nosync nounwind willreturn

I think those should hold for most AArch64 target intrinsics, but
there are too many to check manually. This patch makes most AArch64 target
intrinsics DefaultAttrsIntrinsics.

Some notable exceptions I think are exclusive loads and stores as well
as the memory barrier intrinsics, for which nosync does not apply I
think.

Reviewed By: SjoerdMeijer

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

3 years ago[RISCV][NFC] Increase test coverage of Zbt extension
Michael Munday [Mon, 18 Jan 2021 17:30:19 +0000 (17:30 +0000)]
[RISCV][NFC] Increase test coverage of Zbt extension

Add Zbt (ternary) extension code generation to the select lowering
tests since it can have a significant impact on how select is
lowered.

While we are here make the neg-abs commands more consistent with
the other tests.

Reviewed By: lenary

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

3 years ago[SLP] add more FMF tests for fmax/fmin reductions; NFC
Sanjay Patel [Mon, 18 Jan 2021 17:24:57 +0000 (12:24 -0500)]
[SLP] add more FMF tests for fmax/fmin reductions; NFC

3 years ago[AArch64] Add test to check the attributes for some intrinsics.
Florian Hahn [Thu, 14 Jan 2021 14:33:16 +0000 (14:33 +0000)]
[AArch64] Add test to check the attributes for some intrinsics.

3 years ago[MLIR] NFC: simplify PresburgerSet::isEqual
Arjun P [Mon, 18 Jan 2021 16:32:06 +0000 (22:02 +0530)]
[MLIR] NFC: simplify PresburgerSet::isEqual

Reviewed By: ftynse

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

3 years ago[ARM] Don't handle low overhead branches in AnalyzeBranch
David Green [Mon, 18 Jan 2021 17:16:07 +0000 (17:16 +0000)]
[ARM] Don't handle low overhead branches in AnalyzeBranch

It turns our that the BranchFolder and IfCvt does not like unanalyzable
branches that fall-through. This means that removing the unconditional
branches from the end of tail predicated instruction can run into
asserts and verifier issues.

This effectively reverts 372eb2bbb6fb903ce76266e659dfefbaee67722b, but
adds handling to t2DoLoopEndDec which are not branches, so can be safely
skipped.

3 years ago[Coroutine] Do not CoroElide if there are musttail calls
Xun Li [Mon, 18 Jan 2021 17:06:21 +0000 (09:06 -0800)]
[Coroutine] Do not CoroElide if there are musttail calls

This is to address https://bugs.llvm.org/show_bug.cgi?id=48626.
When there are musttail calls that use parameters aliasing the newly created coroutine frame, the existing implementation will fatal.
We simply cannot perform CoroElide in such cases. In theory a precise analysis can be done to check whether the parameters of the musttail call
actually alias the frame, but it's very hard to do it before the transformation happens. Also in most cases the existence of musttail call is
generated due to symmetric transfers, and in those cases alias analysis won't be able to tell that they don't alias anyway.

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

3 years ago[clangd] Derive new signals in CC from ASTSignals.
Utkarsh Saxena [Sun, 10 Jan 2021 15:32:00 +0000 (16:32 +0100)]
[clangd] Derive new signals in CC from ASTSignals.

This patch only introduces new signals but does not use their value
in scoring a CC candidate. Usage of these signals in CC ranking in both
heiristics and ML model will be introduced in later patches.

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

3 years ago[ARM] Update test target triple. NFC
David Green [Mon, 18 Jan 2021 16:36:00 +0000 (16:36 +0000)]
[ARM] Update test target triple. NFC

3 years ago[MLIR] Support checking if two FlatAffineConstraints are equal
Arjun P [Mon, 18 Jan 2021 15:30:21 +0000 (21:00 +0530)]
[MLIR] Support checking if two FlatAffineConstraints are equal

This patch adds support for checking if two PresburgerSets are equal. In particular, one can check if two FlatAffineConstraints are equal by constructing PrebsurgerSets from them and comparing these.

Reviewed By: ftynse

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

3 years agoReland "[AArch64] Attempt to sink mul operands""
Nicholas Guy [Fri, 15 Jan 2021 14:28:23 +0000 (14:28 +0000)]
Reland "[AArch64] Attempt to sink mul operands""

This relands dda60035e9f0769c8907cdf6561489e0435c2275,
which was reverted by dbaa6a1858a42f72b683f700d3bd7a9632f7a518

3 years ago[AArch64] Further restricts when a dup(*ext) can be rearranged
Nicholas Guy [Fri, 15 Jan 2021 14:26:51 +0000 (14:26 +0000)]
[AArch64] Further restricts when a dup(*ext) can be rearranged

In most cases, the dup(*ext) pattern can be rearranged to perform
the extension on the vector side, allowing for further vector-specific
optimisations to be made. However the initial checks for this conversion
were insufficient, allowing invalid encodings to be attempted (causing
compilation to fail).

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

3 years ago[WebAssembly] MC layer writes table symbols to object files
Andy Wingo [Fri, 27 Nov 2020 08:19:46 +0000 (09:19 +0100)]
[WebAssembly] MC layer writes table symbols to object files

Now that the linker handles table symbols, we can allow the frontend to
produce them.

Depends on D91870.

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

3 years ago[WebAssembly] Add support for table linking to wasm-ld
Andy Wingo [Thu, 14 Jan 2021 09:15:56 +0000 (10:15 +0100)]
[WebAssembly] Add support for table linking to wasm-ld

This patch adds support to wasm-ld for linking multiple table references
together, in a manner similar to wasm globals. The indirect function
table is synthesized as needed.

To manage the transitional period in which the compiler doesn't yet
produce TABLE_NUMBER relocations and doesn't residualize table symbols,
the linker will detect object files which have table imports or
definitions, but no table symbols. In that case it will synthesize
symbols for the defined and imported tables.

As a change, relocatable objects are now written with table symbols,
which can cause symbol renumbering in some of the tests. If no object
file requires an indirect function table, none will be written to the
file. Note that for legacy ObjFile inputs, this test is conservative: as
we don't have relocs for each use of the indirecy function table, we
just assume that any incoming indirect function table should be
propagated to the output.

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

3 years ago[X86][AVX] IsElementEquivalent - add matchShuffleWithUNPCK + VBROADCAST/VBROADCAST_LO...
Simon Pilgrim [Mon, 18 Jan 2021 15:54:05 +0000 (15:54 +0000)]
[X86][AVX] IsElementEquivalent - add matchShuffleWithUNPCK + VBROADCAST/VBROADCAST_LOAD handling

Specify LHS/RHS operands in matchShuffleWithUNPCK's calls to isTargetShuffleEquivalent, and handle VBROADCAST/VBROADCAST_LOAD matching in IsElementEquivalent

3 years agoFix for sanitizer issue in 55c557a
Dmitry Preobrazhensky [Mon, 18 Jan 2021 15:38:32 +0000 (18:38 +0300)]
Fix for sanitizer issue in 55c557a

3 years ago[LoopRotate] Precommit test for prepare-for-lto handling.
Florian Hahn [Mon, 18 Jan 2021 15:18:17 +0000 (15:18 +0000)]
[LoopRotate] Precommit test for prepare-for-lto handling.

Precommit test for D94232.

3 years ago[AMDGPU][MC] Refactored parsing of dpp ctrl
Dmitry Preobrazhensky [Mon, 18 Jan 2021 12:16:46 +0000 (15:16 +0300)]
[AMDGPU][MC] Refactored parsing of dpp ctrl

Summary of changes:
- simplified code to improve maintainability;
- replaced lex() with higher level parser functions;
- improved errors handling.

Reviewers: rampitec

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

3 years ago[SLP] rename reduction query for min/max ops; NFC
Sanjay Patel [Mon, 18 Jan 2021 14:28:21 +0000 (09:28 -0500)]
[SLP] rename reduction query for min/max ops; NFC

This will avoid confusion once we start matching
min/max intrinsics. All of these hacks to accomodate
cmp+sel idioms should disappear once we canonicalize
to min/max intrinsics.

3 years ago[SLP] reduce opcode API dependency in reduction cost calc; NFC
Sanjay Patel [Mon, 18 Jan 2021 13:57:09 +0000 (08:57 -0500)]
[SLP] reduce opcode API dependency in reduction cost calc; NFC

The icmp opcode is now hard-coded in the cost model call.
This will make it easier to eventually remove all opcode
queries for min/max patterns as we transition to intrinsics.

3 years ago[CSInfo][MIPS] Update CSInfo in delay slot filler
Djordje Todorovic [Mon, 18 Jan 2021 14:26:40 +0000 (15:26 +0100)]
[CSInfo][MIPS] Update CSInfo in delay slot filler

In MipsDelaySlotFiller, when replacing old call-branch with
the compact branch instruction, an assertion is caused by erasing
the old call with unhandled CSInfo.
The problem was reported in PR48695.
This patch fixes it, by moving call site info from the old call
instruction to its replace.

Patch by Nikola Tesic

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

3 years ago[PowerPC][AIX]Do not emit xxspltd mnemonic on AIX.
Sean Fertile [Fri, 15 Jan 2021 21:36:50 +0000 (16:36 -0500)]
[PowerPC][AIX]Do not emit xxspltd mnemonic on AIX.

A bug in the system assembler can assemble the xxspltd extended
menemonic into the wrong instruction (extracting the wrong element).
Emit the full xxpermdi with all operands to work around the problem.

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

3 years ago[InferAttrs] Mark some library functions as willreturn.
Florian Hahn [Mon, 18 Jan 2021 13:40:21 +0000 (13:40 +0000)]
[InferAttrs] Mark some library functions as willreturn.

This patch marks some library functions as willreturn. On the first pass, I
excluded most functions that interact with streams/the filesystem.

Along with willreturn, it also adds nounwind to a set of math functions.
There probably are a few additional attributes we can add for those, but
that should be done separately.

Reviewed By: nikic

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

3 years ago[NFC]Migrate VectorCombine.cpp to use InstructionCost
Caroline Concatto [Mon, 4 Jan 2021 15:21:21 +0000 (15:21 +0000)]
[NFC]Migrate VectorCombine.cpp to use InstructionCost

This patch changes these functions:
vectorizeLoadInsert
isExtractExtractCheap
foldExtractedCmps
scalarizeBinopOrCmp
getShuffleExtract
foldBitcastShuf
to use the class InstructionCost when calling TTI.get<something>Cost().

This patch is part of a series of patches to use InstructionCost instead of
 unsigned/int for the cost model functions.
See this thread for context:
    http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
See this patch for the introduction of the type:
    https://reviews.llvm.org/D91174

ps.:This patch adds the test || !NewCost.isValid(), because we want to
return false when:
 !NewCost.isValid && !OldCost.isValid()->the cost to transform it expensive
and
 !NewCost.isValid() && OldCost.isValid()
Therefore for simplication we only add  test for !NewCost.isValid()

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

3 years ago[Doc] Fix example in codegen doc.
Kai Nacke [Thu, 14 Jan 2021 13:04:39 +0000 (08:04 -0500)]
[Doc] Fix example in codegen doc.

The attributes in the example are placed wrong:
They belong after the type, not after the parameter name.

Reviewed by: abhina.sreeskantharajan

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

3 years ago[Statepoint] Handle `undef` operands in statepoint.
Denis Antrushin [Thu, 14 Jan 2021 19:35:18 +0000 (22:35 +0300)]
[Statepoint] Handle `undef` operands in statepoint.

Currently when spilling statepoint register operands in FixupStatepoints
we do not pay attention that it might be `undef`. We just generate a
spill, which may lead to verifier error because we have a use without def.

To handle it, let FixupStateponts ignore `undef` register operands
completely and change them to some constant value when generating
stack map. Use same value as used by ISel for this purpose (0xFEFEFEFE).

Reviewed By: reames

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

3 years ago[SystemZ][z/OS] Fix No such file or directory expression error matching in lit tests
Abhina Sreeskantharajan [Mon, 18 Jan 2021 12:14:12 +0000 (07:14 -0500)]
[SystemZ][z/OS] Fix No such file or directory expression error matching in lit tests

On z/OS, the following error message is not matched correctly in lit tests. This patch updates the CHECK expression to match successfully.
```
EDC5129I No such file or directory.
```

Reviewed By: muiez

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

3 years ago[AMDGPU][MC][GFX10] Improved dpp8 errors handling
Dmitry Preobrazhensky [Mon, 18 Jan 2021 11:54:34 +0000 (14:54 +0300)]
[AMDGPU][MC][GFX10] Improved dpp8 errors handling

Reviewers: rampitec

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

3 years agoRevert "[OpenMP] Added the support for hidden helper task in RTL"
Shilei Tian [Mon, 18 Jan 2021 11:57:52 +0000 (06:57 -0500)]
Revert "[OpenMP] Added the support for hidden helper task in RTL"

This reverts commit ed939f853da1f2266f00ea087f778fda88848f73.

3 years ago[VectorUtils] Do not try to add indices matching tombstone/empty values.
Florian Hahn [Mon, 18 Jan 2021 10:34:21 +0000 (10:34 +0000)]
[VectorUtils] Do not try to add indices matching tombstone/empty values.

Keys matching the tombstone/empty special values cannot be inserted in a
DenseMap. Under some circumstances, LV tries to add members to an
interleave group that match the special values. Skip adding such
members. This is unlikely to have any impact in practice, because
interleave groups with such indices are very likely to not be
vectorized, due to gaps.

This issue has been surfaced by fuzzing, see
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11638

3 years agoRevert "[PowerPC] support register pressure reduction in machine combiner."
Tres Popp [Mon, 18 Jan 2021 11:01:27 +0000 (12:01 +0100)]
Revert "[PowerPC] support register pressure reduction in machine combiner."

This reverts commit 26a396c4ef481cb159bba631982841736a125a9c.

See https://reviews.llvm.org/D92071 for a description of the issue.

3 years ago[mlir] Fix cross-compilation (Linalg ODS gen)
Vladislav Vinogradov [Mon, 18 Jan 2021 10:54:06 +0000 (11:54 +0100)]
[mlir] Fix cross-compilation (Linalg ODS gen)

Use cross-compilation approach for `mlir-linalg-ods-gen` application
similar to TblGen tools.

Reviewed By: nicolasvasilache

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

3 years ago[DAG] SimplifyDemandedBits - use KnownBits comparisons to remove ISD::UMIN/UMAX ops
Simon Pilgrim [Mon, 18 Jan 2021 10:29:08 +0000 (10:29 +0000)]
[DAG] SimplifyDemandedBits - use KnownBits comparisons to remove ISD::UMIN/UMAX ops

Use the KnownBits icmp comparisons to determine when a ISD::UMIN/UMAX op is unnecessary should either op be known to be ULT/ULE or UGT/UGE than the other.

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

3 years ago[RISCV] Add scalable vector truncate patterns
Fraser Cormack [Fri, 15 Jan 2021 17:04:52 +0000 (17:04 +0000)]
[RISCV] Add scalable vector truncate patterns

Original patch by @rogfer01.

This patch supports vector truncates, which on RVV must be done in a
series of instructions truncating by one power-of-two at a time. This is
done through custom-lowering and a custom node to avoid LLVM
re-combining the split TRUNCATE nodes.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper

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

3 years ago[X86][SSE] isHorizontalBinOp - reuse any existing horizontal ops.
Simon Pilgrim [Fri, 15 Jan 2021 18:25:16 +0000 (18:25 +0000)]
[X86][SSE] isHorizontalBinOp - reuse any existing horizontal ops.

If we already have similar horizontal ops using the same args, then match that, even if we are on a target with slow horizontal ops.

3 years ago[lldb][docs] Use inline literals for code/paths instead of rendering it with the...
Raphael Isemann [Mon, 18 Jan 2021 10:07:26 +0000 (11:07 +0100)]
[lldb][docs] Use inline literals for code/paths instead of rendering it with the default role

Right now we're using the 'content' role as default which will just render
these things as cursive (which isn't really useful for code examples). It also
prevents us from assigning a more useful default role in the future.

3 years ago[clang-format] Fix documentation of bcc1dee600
Björn Schäpers [Mon, 18 Jan 2021 09:58:20 +0000 (10:58 +0100)]
[clang-format] Fix documentation of bcc1dee600

That was an oversight.

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

3 years ago[Object, llvm-readelf] - Move the API for retrieving symbol versions to ELF.h
Georgii Rymar [Fri, 15 Jan 2021 11:21:00 +0000 (14:21 +0300)]
[Object, llvm-readelf] - Move the API for retrieving symbol versions to ELF.h

`ELFDumper.cpp` implements the functionality that allows to get symbol versions.
It is used for dumping versioned symbols.

This helps to implement https://bugs.llvm.org/show_bug.cgi?id=48670 ("make llvm-nm -D print version names"):
we can move out and reuse the code from `ELFDumper.cpp`.
This is what this patch do: it moves the related functionality to `ELFFile<ELFT>`.

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

3 years ago[lldb][docs] Resolve the remaining sphinx formatter warnings in the SB API docs
Raphael Isemann [Mon, 18 Jan 2021 09:47:16 +0000 (10:47 +0100)]
[lldb][docs] Resolve the remaining sphinx formatter warnings in the SB API docs

With this patch there should no longer be any warnings when generating the
SB API sphinx docs.

3 years ago[RISCV] Use tail agnostic policy for instructions with tied defs if the use operand...
Craig Topper [Mon, 18 Jan 2021 07:46:43 +0000 (23:46 -0800)]
[RISCV] Use tail agnostic policy for instructions with tied defs if the use operand is IMPLICIT_DEF.

The vcompress intrinsic is defined such that it requires a tail
undisturbed policy. This patch makes it so we can use the tail
agnostic policy if the user has passed vundefined to the dest
operand.

We need to do something similar for masked policy, but we need
annotation of which instructions use the mask policy first.

Not sure if this is sufficient for scheduling or if we'll need to
select different pseudos that don't have a tied def.

Reviewed By: evandro

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

3 years ago[IR] Allow scalable vectors in structs to support intrinsics returning multiple values.
Craig Topper [Mon, 18 Jan 2021 07:29:43 +0000 (23:29 -0800)]
[IR] Allow scalable vectors in structs to support intrinsics returning multiple values.

RISC-V would like to use a struct of scalable vectors to return multiple
values from intrinsics. This woud also be needed for target independent
intrinsics like llvm.sadd.overflow.

This patch removes the existing restriction for this. I've modified
StructType::isSized to consider a struct containing scalable vectors
as unsized so the verifier won't allow loads/stores/allocas of these
structs.

Reviewed By: sdesmalen

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

3 years ago[clang-format] Add StatementAttributeLikeMacros option
Björn Schäpers [Wed, 23 Dec 2020 21:03:39 +0000 (22:03 +0100)]
[clang-format] Add StatementAttributeLikeMacros option

This allows to ignore for example Qts emit when
AlignConsecutiveDeclarations is set, otherwise it is parsed as a type
and it results in some misformating:

unsigned char MyChar = 'x';
emit          signal(MyChar);

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

3 years ago[PowerPC] support register pressure reduction in machine combiner.
Chen Zheng [Mon, 18 Jan 2021 04:53:33 +0000 (23:53 -0500)]
[PowerPC] support register pressure reduction in machine combiner.

Reassociating some patterns to generate more fma instructions to
reduce register pressure.

Reviewed By: jsji

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

3 years ago[JITLink][ELF] New ELF skip-debug-sections test requires asserts.
Lang Hames [Mon, 18 Jan 2021 04:27:27 +0000 (15:27 +1100)]
[JITLink][ELF] New ELF skip-debug-sections test requires asserts.

This should fix the failures on Release mode testers.

3 years ago[test] pre commit a couple more tests for vectorizing multiple exit loops
Philip Reames [Mon, 18 Jan 2021 04:29:13 +0000 (20:29 -0800)]
[test] pre commit a couple more tests for vectorizing multiple exit loops

3 years ago[test] Autogen a loop vectorizer test to make future changes visible
Philip Reames [Mon, 18 Jan 2021 04:03:03 +0000 (20:03 -0800)]
[test] Autogen a loop vectorizer test to make future changes visible

3 years ago[Legalizer] Promote result type in expanding FP_TO_XINT
Qiu Chaofan [Mon, 18 Jan 2021 03:56:11 +0000 (11:56 +0800)]
[Legalizer] Promote result type in expanding FP_TO_XINT

This patch promotes result integer type of FP_TO_XINT in expanding.
So crash in conversion from ppc_fp128 to i1 will be fixed.

Reviewed By: steven.zhang

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

3 years ago[PowerPC] [NFC] Add AIX triple to some regression tests
Qiu Chaofan [Mon, 18 Jan 2021 03:44:00 +0000 (11:44 +0800)]
[PowerPC] [NFC] Add AIX triple to some regression tests

As part of the effort to improve AIX support, regression test coverage
misses quite a lot for AIX subtarget. This patch adds AIX triple to
those don't need extra change, and we can cover more cases in following
commits.

Reviewed By: steven.zhang

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

3 years ago[InstCombine] more tests for D94861 (NFC)
Juneyoung Lee [Mon, 18 Jan 2021 02:12:36 +0000 (11:12 +0900)]
[InstCombine] more tests for D94861 (NFC)

3 years ago[JITLink][ELF] Skip DWARF sections in ELF objects.
Lang Hames [Mon, 18 Jan 2021 00:39:32 +0000 (11:39 +1100)]
[JITLink][ELF] Skip DWARF sections in ELF objects.

This matches current JITLink/MachO behavior and avoids processing currently
unsupported relocations.

3 years agoMakefile.rules: Make HOST_OS/OS simply expanded variable to avoid excess uname -s...
Fangrui Song [Mon, 18 Jan 2021 01:19:29 +0000 (17:19 -0800)]
Makefile.rules: Make HOST_OS/OS simply expanded variable to avoid excess uname -s invocations

This decreases the number of runs from 18 to 1.

3 years ago[NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike.
Chen Zheng [Mon, 18 Jan 2021 00:56:42 +0000 (19:56 -0500)]
[NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike.

add one use check to lookThruCopyLike.

The root node is safe to be deleted if we are sure that every
definition in the copy chain only has one use.

Reviewed By: jsji

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

3 years agoFix openmp CMake build on non-Linux AArch64 systems.
Chandler Carruth [Mon, 18 Jan 2021 00:17:07 +0000 (16:17 -0800)]
Fix openmp CMake build on non-Linux AArch64 systems.

This just checks for `/proc/cpuinfo` existing before reading it.

Tested on an ARM macOS machine.

3 years agoMakefile.rules: Delete GCC 4.6 workaround
Fangrui Song [Sun, 17 Jan 2021 21:16:38 +0000 (13:16 -0800)]
Makefile.rules: Delete GCC 4.6 workaround

5.1 is the minimum supported version.

3 years ago[lldb] Skip TestPlatformProcessConnect on windows and darwin
Pavel Labath [Sun, 17 Jan 2021 19:18:55 +0000 (20:18 +0100)]
[lldb] Skip TestPlatformProcessConnect on windows and darwin

The test fails (for different reasons) on these platforms. Skip for now.

3 years ago[ValueTracking] Fix isSafeToSpeculativelyExecute for sdiv (PR48778)
Nikita Popov [Sun, 17 Jan 2021 19:03:22 +0000 (20:03 +0100)]
[ValueTracking] Fix isSafeToSpeculativelyExecute for sdiv (PR48778)

The != -1 check does not work correctly for all bitwidths. Use
isAllOnesValue() instead.

3 years ago[SimplifyCFG] Add test for PR48778 (NFC)
Nikita Popov [Sun, 17 Jan 2021 18:57:59 +0000 (19:57 +0100)]
[SimplifyCFG] Add test for PR48778 (NFC)

The sdiv is incorrectly speculated.

3 years agoNFC: Minor cleanup of function calls
Stephen Kelly [Sun, 17 Jan 2021 18:25:00 +0000 (18:25 +0000)]
NFC: Minor cleanup of function calls

3 years ago[TableGen] Drop redundant const from return types (NFC)
Kazu Hirata [Sun, 17 Jan 2021 18:39:48 +0000 (10:39 -0800)]
[TableGen] Drop redundant const from return types (NFC)

Identified with readability-const-return-type.

3 years ago[IRBuilder] "Zero"-initialize SmallVector (NFC)
Kazu Hirata [Sun, 17 Jan 2021 18:39:47 +0000 (10:39 -0800)]
[IRBuilder] "Zero"-initialize SmallVector (NFC)