platform/upstream/llvm.git
23 months ago[ELF] Split EhInputSection::pieces into cies and fdes
Fangrui Song [Sun, 31 Jul 2022 23:16:10 +0000 (16:16 -0700)]
[ELF] Split EhInputSection::pieces into cies and fdes

This simplifies code, removes a read32 (for id==0 check), and makes it feasible
to combine some operations in EhInputSection::split and EhFrameSection::addRecords.

Mostly NFC, but fixes "Relocation not in any piece" assertion failure in an
erroneous case when a relocation offset precedes all CIE/FDE pices.

23 months agoUse drop_begin (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:09 +0000 (15:17 -0700)]
Use drop_begin (NFC)

23 months agoUse llvm::any_of (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:08 +0000 (15:17 -0700)]
Use llvm::any_of (NFC)

23 months ago[Hexagon] Remove unused declaration adjustForCalleeSavedRegsSpillCall (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:06 +0000 (15:17 -0700)]
[Hexagon] Remove unused declaration adjustForCalleeSavedRegsSpillCall (NFC)

The function definition was removed on Apr 23, 2015 in commit
876a19d8554510e6689b0a990e5e62af81506d80, but the declaration has
remained since.

23 months ago[BOLT] Remove redundaunt string initialization (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:05 +0000 (15:17 -0700)]
[BOLT] Remove redundaunt string initialization (NFC)

Identified with readability-redundant-string-init.

23 months ago[BOLT] Remove redundant const from return types (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:03 +0000 (15:17 -0700)]
[BOLT] Remove redundant const from return types (NFC)

Identified with readability-const-return-type.

23 months ago[BOLT] Use boolean literals (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:01 +0000 (15:17 -0700)]
[BOLT] Use boolean literals (NFC)

Identified with modernize-use-bool-literals.

23 months ago[Sema] Remove an unused forward declaration (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:00 +0000 (15:17 -0700)]
[Sema] Remove an unused forward declaration (NFC)

23 months ago[ExecutionEngine] Ensure newlines at the end of files (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:16:58 +0000 (15:16 -0700)]
[ExecutionEngine] Ensure newlines at the end of files (NFC)

23 months ago[Bazel] Add JITLink/COFFOptions.td (llvmorg-16-init-398-g88181375a3db)
NAKAMURA Takumi [Sun, 31 Jul 2022 22:03:30 +0000 (07:03 +0900)]
[Bazel] Add JITLink/COFFOptions.td (llvmorg-16-init-398-g88181375a3db)

23 months ago[ELF][test] Merge .eh_frame tests
Fangrui Song [Sun, 31 Jul 2022 21:52:20 +0000 (14:52 -0700)]
[ELF][test] Merge .eh_frame tests

23 months ago[RISCV] Pre-RA expand pseudos pass
Luís Marques [Fri, 29 Jul 2022 23:07:44 +0000 (01:07 +0200)]
[RISCV] Pre-RA expand pseudos pass

Expand load address pseudo-instructions earlier (pre-ra) to allow follow-up
patches to fold the addi of PseudoLLA instructions into the immediate
operand of load/store instructions.

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

23 months ago[mlir][tosa] Switch missed accessors to prefixed form (NFC)
Jacques Pienaar [Sun, 31 Jul 2022 18:33:42 +0000 (11:33 -0700)]
[mlir][tosa] Switch missed accessors to prefixed form (NFC)

23 months ago[ELF][test] Test identical CIE content with different personality
Fangrui Song [Sun, 31 Jul 2022 20:43:07 +0000 (13:43 -0700)]
[ELF][test] Test identical CIE content with different personality

If we change
CieRecord *&rec = cieMap[{cie.data(), personality}];
to
CieRecord *&rec = cieMap[{cie.data(), nullptr}];

The new test can catch the failure.

23 months ago[libc][doc] Update implementation status of exp2f, sinhf, and coshf.
Tue Ly [Sun, 31 Jul 2022 20:32:21 +0000 (16:32 -0400)]
[libc][doc] Update implementation status of exp2f, sinhf, and coshf.

23 months ago[mlir][DCA] Fix visiting call ops when run at function scopes
Jeff Niu [Sun, 31 Jul 2022 02:20:08 +0000 (22:20 -0400)]
[mlir][DCA] Fix visiting call ops when run at function scopes

When dead-code analysis is run at the scope of a function, call ops to
other functions at the same level were being marked as unreachable,
since the analysis optimistically assumes the call op to have no known
predecessors and that all predecessors are known, but the callee would
never get visited.

This patch fixes the bug by checking if a referenced function is above
the top-level op of the analysis, and is thus considered an external
callable.

Fixes #56830

Reviewed By: zero9178

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

23 months agoRevert "Revert "[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterfa...
Alexander Belyaev [Sun, 31 Jul 2022 19:44:24 +0000 (21:44 +0200)]
Revert "Revert "[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp.""

This reverts commit e78d7637fbb08ec2c2e59939c015faadd47e32e7.

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

23 months agoRevert "[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp."
Alexander Belyaev [Sun, 31 Jul 2022 19:25:20 +0000 (21:25 +0200)]
Revert "[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp."

This reverts commit e8c2877565149587fd66fbee591b7d44eecd667d.

23 months ago[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp.
Alexander Belyaev [Sun, 31 Jul 2022 16:04:46 +0000 (18:04 +0200)]
[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp.

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

23 months ago[ELF] Move EhInputSection out of inputSections. NFC
Fangrui Song [Sun, 31 Jul 2022 18:58:08 +0000 (11:58 -0700)]
[ELF] Move EhInputSection out of inputSections. NFC

inputSections temporarily contains EhInputSection objects mainly for
combineEhSections. Place EhInputSection objects into a new vector
ehInputSections instead of inputSections.

23 months ago[InstSimplify] fold FP rounding intrinsic with rounded operand
Sanjay Patel [Sat, 30 Jul 2022 19:37:00 +0000 (15:37 -0400)]
[InstSimplify] fold FP rounding intrinsic with rounded operand

issue #56775

I rearranged the Thumb2 codegen test to avoid simplifying the chain
of rounding instructions. I'm assuming the intent of the test is
to verify lowering of each of those intrinsics.

23 months ago[InstSimplify] add tests for FP rounding intrinsics; NFC
Sanjay Patel [Sat, 30 Jul 2022 19:24:09 +0000 (15:24 -0400)]
[InstSimplify] add tests for FP rounding intrinsics; NFC

See issue #56775

23 months ago[libcxx] [test] Cover i386 & sparc64 in string.capacity test
Michał Górny [Sun, 31 Jul 2022 11:02:57 +0000 (13:02 +0200)]
[libcxx] [test] Cover i386 & sparc64 in string.capacity test

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

23 months ago[X86] getFauxShuffleMask - use DemandedElts variant of getTargetShuffleInputs. NFCI.
Simon Pilgrim [Sun, 31 Jul 2022 11:14:58 +0000 (12:14 +0100)]
[X86] getFauxShuffleMask - use DemandedElts variant of getTargetShuffleInputs. NFCI.

We don't specify the demanded elts yet, this patch just rewires the getTargetShuffleInputs calls and gives an "all demanded elts" mask.

23 months ago[clang-repl] Fix incorrect return code
Jun Zhang [Sun, 31 Jul 2022 09:49:13 +0000 (17:49 +0800)]
[clang-repl] Fix incorrect return code

Without this patch, clang-repl incorrectly pass some tests when there's
error occured.

Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D130422

23 months ago[X86] combineX86ShufflesRecursively - determine demanded elts to pass to getTargetShu...
Simon Pilgrim [Sun, 31 Jul 2022 10:30:40 +0000 (11:30 +0100)]
[X86] combineX86ShufflesRecursively - determine demanded elts to pass to getTargetShuffleInputs

Only PACKSS/PACKUS faux shuffles make use of the demanded elts at the moment, but this at least improves the handling of a couple of truncation patterns.

23 months ago[NFC] Remove redundant CalculateSmallVectorDefaultInlinedElements usage from to_vecto...
Dawid Jurczak [Sun, 31 Jul 2022 08:51:01 +0000 (10:51 +0200)]
[NFC] Remove redundant CalculateSmallVectorDefaultInlinedElements usage from to_vector utility

CalculateSmallVectorDefaultInlinedElements<..>::value is already used as default value for second template parameter in SmallVector class declaration.
There is no need to pass it explicitly in to_vector.

Extracted from: https://reviews.llvm.org/D129781

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

23 months ago[CodeGen][NFC] Use isa_and_nonnull instead of explicit check
Jun Zhang [Sun, 31 Jul 2022 05:03:24 +0000 (13:03 +0800)]
[CodeGen][NFC] Use isa_and_nonnull instead of explicit check

Signed-off-by: Jun Zhang <jun@junz.org>
23 months ago[lld] Change vector to SmallVector. NFC
Fangrui Song [Sun, 31 Jul 2022 01:11:21 +0000 (18:11 -0700)]
[lld] Change vector to SmallVector. NFC

My lld executable is 1.6KiB smaller and some functions are now more efficient.

23 months ago[ELF] Move SyntheticSections to InputSection.h. NFC
Fangrui Song [Sun, 31 Jul 2022 00:42:08 +0000 (17:42 -0700)]
[ELF] Move SyntheticSections to InputSection.h. NFC

Keep the main SectionBase hierarchy in InputSection.h.
And inline MergeInputSection::getParent.

23 months ago[JITLink][COFF] Remove unused variable.
Sunho Kim [Sun, 31 Jul 2022 00:19:17 +0000 (09:19 +0900)]
[JITLink][COFF] Remove unused variable.

23 months ago[JITLink][COFF] Handle COMDAT symbol with offset.
Sunho Kim [Sun, 31 Jul 2022 00:09:22 +0000 (09:09 +0900)]
[JITLink][COFF] Handle COMDAT symbol with offset.

Handles COMDAT symbol with an offset and refactor the code to only generated symbol if the second symbol was encountered. This happens very infrequently but happens in recursive_mutex implementation of MSVC STL library.

Reviewed By: lhames

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

23 months ago[JITLink][COFF][x86_64] Implement remaining IMAGE_REL_AMD64_REL32_*.
Sunho Kim [Sun, 31 Jul 2022 00:02:23 +0000 (09:02 +0900)]
[JITLink][COFF][x86_64] Implement remaining IMAGE_REL_AMD64_REL32_*.

Implements remaining IMAGE_REL_AMD64_REL32_*. We only need IMAGE_REL_AMD64_REL32_4 for now but doing all remaining ones for completeness. (clang only uses IMAGE_REL_AMD64_REL32_1 and IMAGE_REL_AMD64_REL32)

Reviewed By: lhames

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

23 months ago[JITLink] Relax zero-fill edge assertions.
Sunho Kim [Sat, 30 Jul 2022 23:33:42 +0000 (08:33 +0900)]
[JITLink] Relax zero-fill edge assertions.

Relax zero-fill edge assertions to only consider relocation edges. Keep-alive edges to zero-fill blocks can cause this assertion which is too strict.

Reviewed By: lhames

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

23 months ago[ELF] Simplify getRankProximity. NFC
Fangrui Song [Sat, 30 Jul 2022 23:32:42 +0000 (16:32 -0700)]
[ELF] Simplify getRankProximity. NFC

23 months ago[gn build] Port 88181375a3db more
Nico Weber [Sat, 30 Jul 2022 23:30:53 +0000 (19:30 -0400)]
[gn build] Port 88181375a3db more

23 months ago[MLIR] Add a utility to sort the operands of commutative ops
srishti-cb [Sat, 30 Jul 2022 16:53:15 +0000 (12:53 -0400)]
[MLIR] Add a utility to sort the operands of commutative ops

Added a commutativity utility pattern and a function to populate it. The pattern sorts the operands of an op in ascending order of the "key" associated with each operand iff the op is commutative. This sorting is stable.

The function is intended to be used inside passes to simplify the matching of commutative operations. After the application of the above-mentioned pattern, since the commutative operands now have a deterministic order in which they occur in an op, the matching of large DAGs becomes much simpler, i.e., requires much less number of checks to be written by a user in her/his pattern matching function.

The "key" associated with an operand is the list of the "AncestorKeys" associated with the ancestors of this operand, in a breadth-first order.

The operand of any op is produced by a set of ops and block arguments. Each of these ops and block arguments is called an "ancestor" of this operand.

Now, the "AncestorKey" associated with:
1. A block argument is `{type: BLOCK_ARGUMENT, opName: ""}`.
2. A non-constant-like op, for example, `arith.addi`, is `{type: NON_CONSTANT_OP, opName: "arith.addi"}`.
3. A constant-like op, for example, `arith.constant`, is `{type: CONSTANT_OP, opName: "arith.constant"}`.

So, if an operand, say `A`, was produced as follows:

```
`<block argument>`  `<block argument>`
             \          /
              \        /
              `arith.subi`           `arith.constant`
                         \            /
                         `arith.addi`
                                |
                           returns `A`
```

Then, the block arguments and operations present in the backward slice of `A`, in the breadth-first order are:
`arith.addi`, `arith.subi`, `arith.constant`, `<block argument>`, and `<block argument>`.

Thus, the "key" associated with operand `A` is:
```
{
 {type: NON_CONSTANT_OP, opName: "arith.addi"},
 {type: NON_CONSTANT_OP, opName: "arith.subi"},
 {type: CONSTANT_OP, opName: "arith.constant"},
 {type: BLOCK_ARGUMENT, opName: ""},
 {type: BLOCK_ARGUMENT, opName: ""}
}
```

Now, if "keyA" is the key associated with operand `A` and "keyB" is the key associated with operand `B`, then:
"keyA" < "keyB" iff:
1. In the first unequal pair of corresponding AncestorKeys, the AncestorKey in operand `A` is smaller, or,
2. Both the AncestorKeys in every pair are the same and the size of operand `A`'s "key" is smaller.

AncestorKeys of type `BLOCK_ARGUMENT` are considered the smallest, those of type `CONSTANT_OP`, the largest, and `NON_CONSTANT_OP` types come in between. Within the types `NON_CONSTANT_OP` and `CONSTANT_OP`, the smaller ones are the ones with smaller op names (lexicographically).

---

Some examples of such a sorting:

Assume that the sorting is being applied to `foo.commutative`, which is a commutative op.

Example 1:

> %1 = foo.const 0
> %2 = foo.mul <block argument>, <block argument>
> %3 = foo.commutative %1, %2

Here,
1. The key associated with %1 is:
```
    {
     {CONSTANT_OP, "foo.const"}
    }
```
2. The key associated with %2 is:
```
    {
     {NON_CONSTANT_OP, "foo.mul"},
     {BLOCK_ARGUMENT, ""},
     {BLOCK_ARGUMENT, ""}
    }
```

The key of %2 < the key of %1
Thus, the sorted `foo.commutative` is:
> %3 = foo.commutative %2, %1

Example 2:

> %1 = foo.const 0
> %2 = foo.mul <block argument>, <block argument>
> %3 = foo.mul %2, %1
> %4 = foo.add %2, %1
> %5 = foo.commutative %1, %2, %3, %4

Here,
1. The key associated with %1 is:
```
    {
     {CONSTANT_OP, "foo.const"}
    }
```
2. The key associated with %2 is:
```
    {
     {NON_CONSTANT_OP, "foo.mul"},
     {BLOCK_ARGUMENT, ""}
    }
```
3. The key associated with %3 is:
```
    {
     {NON_CONSTANT_OP, "foo.mul"},
     {NON_CONSTANT_OP, "foo.mul"},
     {CONSTANT_OP, "foo.const"},
     {BLOCK_ARGUMENT, ""},
     {BLOCK_ARGUMENT, ""}
    }
```
4. The key associated with %4 is:
```
    {
     {NON_CONSTANT_OP, "foo.add"},
     {NON_CONSTANT_OP, "foo.mul"},
     {CONSTANT_OP, "foo.const"},
     {BLOCK_ARGUMENT, ""},
     {BLOCK_ARGUMENT, ""}
    }
```

Thus, the sorted `foo.commutative` is:
> %5 = foo.commutative %4, %3, %2, %1

Signed-off-by: Srishti Srivastava <srishti.srivastava@polymagelabs.com>
Reviewed By: Mogball

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

23 months ago[JITLink][COFF] Remove obsolete FIXMEs. (NFC)
Sunho Kim [Sat, 30 Jul 2022 23:10:14 +0000 (08:10 +0900)]
[JITLink][COFF] Remove obsolete FIXMEs. (NFC)

23 months ago[JITLInk][COFF] Remove unnecessary unique_ptr. (NFC)
Sunho Kim [Sat, 30 Jul 2022 23:08:19 +0000 (08:08 +0900)]
[JITLInk][COFF] Remove unnecessary unique_ptr. (NFC)

23 months ago[JITLink][COFF] Add explicit std::move.
Sunho Kim [Sat, 30 Jul 2022 23:00:19 +0000 (08:00 +0900)]
[JITLink][COFF] Add explicit std::move.

Since ArgList is not copyable we need to make sure it's moved explicitly.

23 months ago[gn build] Port 88181375a3db
Nico Weber [Sat, 30 Jul 2022 22:58:10 +0000 (18:58 -0400)]
[gn build] Port 88181375a3db

23 months ago[JITLink][COFF] Implement include/alternatename linker directive.
Sunho Kim [Sat, 30 Jul 2022 22:49:37 +0000 (07:49 +0900)]
[JITLink][COFF] Implement include/alternatename linker directive.

Implements include/alternatename linker directive. Alternatename is used by static msvc runtime library. Alias symbol is technically incorrect (we have to search for external definition) but we don't have a way to represent this in jitlink/orc yet, this is solved in the following up patch.

Inlcude linker directive is used in ucrt to forcelly lookup the static initializer symbols so that they will be emitted. It's implemented as extenral symbols with live flag on that cause the lookup of these symbols.

Reviewed By: lhames

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

23 months ago[clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.
Sunho Kim [Sat, 30 Jul 2022 20:42:16 +0000 (05:42 +0900)]
[clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.

We have seen random symbol not found "__cxa_throw" error in fuschia build bots and out-of-tree users. The understanding have been that they are built without exception support, but it turned out that these platforms have LLVM_STATIC_LINK_CXX_STDLIB ON so that they link libstdc++ to llvm statically. The reason why this is problematic for clang-repl is that by default clang-repl tries to find symbols from symbol table of executable and dynamic libraries loaded by current process. It needs to load another libstdc++, but the platform that had LLVM_STATIC_LINK_CXX_STDLIB turned on is usally those with missing or obsolate shared libstdc++ in the first place -- trying to load it again would be destined to fail eventually with a risk to introuduce mixed libstdc++ versions.

A proper solution that doesn't take a workaround is statically link the same libstdc++ by clang-repl side, but this is not possible with old JIT linker runtimedyld. New just-in-time linker JITLink handles this relatively well, but it's not availalbe in majority of platforms. For now, this patch just disables the building of clang-repl when LLVM_STATIC_LINK_CXX_STDLIB is ON and removes the "__cxa_throw" check in exception unittest as well as reverting previous exception check flag patch.

Reviewed By: v.g.vassilev

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

23 months ago[Libomptarget] Disable testing map_back_race.cpp
Joseph Huber [Fri, 29 Jul 2022 17:51:15 +0000 (13:51 -0400)]
[Libomptarget] Disable testing map_back_race.cpp

This test hasn't been fixed and causes spurious failures when testing.
This patch sets it as unsupported until we have a reliable fix.

Reviewed By: ronlieb

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

23 months ago[RISCV] Remove vmerges from vector ceil, floor, trunc lowering.
Craig Topper [Sat, 30 Jul 2022 17:33:52 +0000 (10:33 -0700)]
[RISCV] Remove vmerges from vector ceil, floor, trunc lowering.

Use masked operations to suppress spurious exception bits being
set in fflags. Unfortunately, doing this adds extra copies.

23 months ago[X86] Use std::tie so we can have more meaningful variable names for demanded bits...
Simon Pilgrim [Sat, 30 Jul 2022 17:57:11 +0000 (18:57 +0100)]
[X86] Use std::tie so we can have more meaningful variable names for demanded bits/elts pairs. NFCI.

*.first + *.second were proving difficult to keep track of.

23 months ago[ELF] Support missing relocations in RISCV::getImplicitAddend()
Fangrui Song [Sat, 30 Jul 2022 17:55:59 +0000 (10:55 -0700)]
[ELF] Support missing relocations in RISCV::getImplicitAddend()

23 months ago[ELF] Support missing relocations in PPC64::getImplicitAddend()
Fangrui Song [Sat, 30 Jul 2022 17:46:58 +0000 (10:46 -0700)]
[ELF] Support missing relocations in PPC64::getImplicitAddend()

23 months agoRevert "[BOLT] Ignore functions accessing false positive jump tables"
Amir Ayupov [Sat, 30 Jul 2022 17:35:10 +0000 (10:35 -0700)]
Revert "[BOLT] Ignore functions accessing false positive jump tables"

This diff uncovers an ASAN leak in getOrCreateJumpTable:
```
Indirect leak of 264 byte(s) in 1 object(s) allocated from:
    #1 0x4f6e48c in llvm::bolt::BinaryContext::getOrCreateJumpTable ...
```
The removal of an assertion needs to be accompanied by proper deallocation of
a `JumpTable` object for which `analyzeJumpTable` was unsuccessful.

This reverts commit 52cd00cabf479aa7eb6dbb063b7ba41ea57bce9e.

23 months agoUse any_of (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:56 +0000 (10:35 -0700)]
Use any_of (NFC)

23 months agoUse is_contained (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:54 +0000 (10:35 -0700)]
Use is_contained (NFC)

23 months agoConvert for_each to range-based for loops (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:52 +0000 (10:35 -0700)]
Convert for_each to range-based for loops (NFC)

23 months ago[bolt] Remove redundaunt virtual specifiers (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:51 +0000 (10:35 -0700)]
[bolt] Remove redundaunt virtual specifiers (NFC)

Identified with modernize-use-override.

23 months ago[bolt] Remove redundaunt control-flow statements (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:49 +0000 (10:35 -0700)]
[bolt] Remove redundaunt control-flow statements (NFC)

Identified with readability-redundant-control-flow.

23 months agoUse nullptr instead of 0 (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:48 +0000 (10:35 -0700)]
Use nullptr instead of 0 (NFC)

Identified with modernize-use-nullptr.

23 months ago[lld] Remove unused forward declarations (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:46 +0000 (10:35 -0700)]
[lld] Remove unused forward declarations (NFC)

23 months ago[IR] Fix a header guard (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:45 +0000 (10:35 -0700)]
[IR] Fix a header guard (NFC)

Identified with llvm-header-guard.

23 months ago[ExecutionEngine] Ensure a newline at the end of a file (NFC)
Kazu Hirata [Sat, 30 Jul 2022 17:35:43 +0000 (10:35 -0700)]
[ExecutionEngine] Ensure a newline at the end of a file (NFC)

23 months ago[RISCV] Add merge operands to more RISCVISD::*_VL opcodes.
Craig Topper [Sat, 30 Jul 2022 16:58:31 +0000 (09:58 -0700)]
[RISCV] Add merge operands to more RISCVISD::*_VL opcodes.

This adds a merge operand to all of the binary _VL nodes. Including
integer and widening. They all share multiclasses in tablegen
so doing them all at once was easiest.

I plan to use FADD_VL in an upcoming patch. The rest are just for
consistency to keep tablegen working.

This does reduce the isel table size by about 25k so that's nice.

Reviewed By: reames

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

23 months ago[RISCV] Swap the merge and mask operand order for VRGATHER*_VL and FCOPYSIGN_VL nodes.
Craig Topper [Sat, 30 Jul 2022 16:56:16 +0000 (09:56 -0700)]
[RISCV] Swap the merge and mask operand order for VRGATHER*_VL and FCOPYSIGN_VL nodes.

Based on review feedback from D130816.

23 months ago[X86] computeKnownBitsForTargetNode - out of range X86ISD::VSRAI doesn't fold to...
Simon Pilgrim [Sat, 30 Jul 2022 16:55:34 +0000 (17:55 +0100)]
[X86] computeKnownBitsForTargetNode - out of range X86ISD::VSRAI doesn't fold to zero

Noticed by inspection and I can't seem to make a test case, but SSE arithmetic bit shifts clamp to the max shift amount (i.e. create a sign splat) - combineVectorShiftImm already does something similar.

23 months ago[CodeGen] Fixed undeclared MISchedCutoff in case of NDEBUG and LLVM_ENABLE_ABI_BREAKI...
Dmitry Vassiliev [Sat, 30 Jul 2022 16:24:50 +0000 (18:24 +0200)]
[CodeGen] Fixed undeclared MISchedCutoff in case of NDEBUG and LLVM_ENABLE_ABI_BREAKING_CHECKS

This patch fixes the error llvm/lib/CodeGen/MachineScheduler.cpp(755): error C2065: 'MISchedCutoff': undeclared identifier in case of NDEBUG and LLVM_ENABLE_ABI_BREAKING_CHECKS.
Note MISchedCutoff is declared under #ifndef NDEBUG.

Reviewed By: RKSimon

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

23 months ago[InstCombine] canonicalize more zext-and-of-bool compare to narrow and
Sanjay Patel [Sat, 30 Jul 2022 15:20:13 +0000 (11:20 -0400)]
[InstCombine] canonicalize more zext-and-of-bool compare to narrow and

https://alive2.llvm.org/ce/z/vBNiiM

This matches variants of patterns that were folded with:
b5a9361c90ca

23 months ago[AMDGPU] Remove unused function
Austin Kerbow [Sat, 30 Jul 2022 14:41:46 +0000 (07:41 -0700)]
[AMDGPU] Remove unused function

23 months agoOMPIRBuilder.h - fix Wdocumentation warning. NFC.
Simon Pilgrim [Sat, 30 Jul 2022 14:43:41 +0000 (15:43 +0100)]
OMPIRBuilder.h - fix Wdocumentation warning. NFC.

23 months agoFix Wdocumentation warning. NFC.
Simon Pilgrim [Sat, 30 Jul 2022 14:41:13 +0000 (15:41 +0100)]
Fix Wdocumentation warning. NFC.

warning: '\returns' command used in a comment that is attached to a function returning void

23 months ago[X86] combineSelect fold 'smin' style pattern select(pcmpgt(RHS, LHS), LHS, RHS)...
Simon Pilgrim [Sat, 30 Jul 2022 14:31:31 +0000 (15:31 +0100)]
[X86] combineSelect fold 'smin' style pattern select(pcmpgt(RHS, LHS), LHS, RHS) -> select(pcmpgt(LHS, RHS), RHS, LHS) if pcmpgt(LHS, RHS) already exists

Avoids repeated commuted comparisons when we're performing min/max and clamp patterns

23 months agoConstantFolding: fold OOB accesses to poison instead of undef
Nuno Lopes [Sat, 30 Jul 2022 14:20:32 +0000 (15:20 +0100)]
ConstantFolding: fold OOB accesses to poison instead of undef

23 months ago[InstCombine] avoid splitting a constant expression with div/rem fold
Sanjay Patel [Sat, 30 Jul 2022 13:43:09 +0000 (09:43 -0400)]
[InstCombine] avoid splitting a constant expression with div/rem fold

Follow-up to d4940c0f3d43 to further limit the transform
to avoid an unintended pattern/fold of a constant expression.

23 months ago[DAG] Pull out repeated getOperand() calls for shuffle ops. NFC.
Simon Pilgrim [Sat, 30 Jul 2022 12:59:47 +0000 (13:59 +0100)]
[DAG] Pull out repeated getOperand() calls for shuffle ops. NFC.

23 months ago[AMDGPU] Fix || vs && precedence warning. NFC.
Simon Pilgrim [Sat, 30 Jul 2022 11:19:21 +0000 (12:19 +0100)]
[AMDGPU] Fix || vs && precedence warning. NFC.

23 months ago[NFC] Switch a few uses of undef to poison as placeholders for unreachable code
Nuno Lopes [Sat, 30 Jul 2022 12:55:56 +0000 (13:55 +0100)]
[NFC] Switch a few uses of undef to poison as placeholders for unreachable code

23 months ago[X86] Add test cases for D129537
Luo, Yuanke [Sat, 30 Jul 2022 11:39:03 +0000 (19:39 +0800)]
[X86] Add test cases for D129537

23 months agoSelectionDAGNodes.h - fix Wdocumentation warnings. NFC.
Simon Pilgrim [Sat, 30 Jul 2022 10:05:33 +0000 (11:05 +0100)]
SelectionDAGNodes.h - fix Wdocumentation warnings. NFC.

23 months agoDependencyScanningTool.h - fix Wdocumentation warning. NFC.
Simon Pilgrim [Sat, 30 Jul 2022 10:00:35 +0000 (11:00 +0100)]
DependencyScanningTool.h - fix Wdocumentation warning. NFC.

23 months agoSema.h - fix Wdocumentation warnings. NFC.
Simon Pilgrim [Sat, 30 Jul 2022 10:00:16 +0000 (11:00 +0100)]
Sema.h - fix Wdocumentation warnings. NFC.

23 months ago[libc++][ranges] Implement `std::ranges::partial_sort_copy`.
Konstantin Varlamov [Sat, 30 Jul 2022 09:42:05 +0000 (02:42 -0700)]
[libc++][ranges] Implement `std::ranges::partial_sort_copy`.

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

23 months ago[InstCombine] Add fold for redundant sign bits count comparison
Alexander Shaposhnikov [Sat, 30 Jul 2022 09:06:37 +0000 (09:06 +0000)]
[InstCombine] Add fold for redundant sign bits count comparison

For power-of-2 C:
((X s>> ShiftC) ^ X) u< C --> (X + C) u< (C << 1)
((X s>> ShiftC) ^ X) u> (C - 1) --> (X + C) u> ((C << 1) - 1)

(https://github.com/llvm/llvm-project/issues/56479)

Test plan:
0/ ninja check-llvm check-clang + bootstrap LLVM/Clang
1/ https://alive2.llvm.org/ce/z/eEUfx3

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

23 months ago[libc++] Fix reverse_iterator::iterator_concept
Nikolas Klauser [Sun, 24 Jul 2022 14:46:57 +0000 (16:46 +0200)]
[libc++] Fix reverse_iterator::iterator_concept

Fixes https://github.com/llvm/llvm-project/issues/56504

Reviewed By: ldionne, Mordante, huixie90, #libc

Spies: libcxx-commits, hewillk

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

23 months ago[ELF] Support missing relocations in AArch64::getImplicitAddend()
Fangrui Song [Sat, 30 Jul 2022 08:24:55 +0000 (01:24 -0700)]
[ELF] Support missing relocations in AArch64::getImplicitAddend()

23 months ago[InstCombine] Add baseline tests for redundant sign bits count folds
Alexander Shaposhnikov [Sat, 30 Jul 2022 08:23:45 +0000 (08:23 +0000)]
[InstCombine] Add baseline tests for redundant sign bits count folds

Add baseline tests. NFC.
(https://github.com/llvm/llvm-project/issues/56479)

Test plan:
ninja check-all

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

23 months ago[ELF] Write R_AARCH64_IRELATIVE addends with -z rel
Fangrui Song [Sat, 30 Jul 2022 08:19:59 +0000 (01:19 -0700)]
[ELF] Write R_AARCH64_IRELATIVE addends with -z rel

23 months ago[NFC] Use more appropriate SmallVectorImpl::append call in std::initializer_list...
Dawid Jurczak [Sat, 30 Jul 2022 07:15:11 +0000 (09:15 +0200)]
[NFC] Use more appropriate SmallVectorImpl::append call in std::initializer_list SmallVector constructor

Since we are in constructor there is no need to perform redundant call to SmallVectorImpl::clear() inside assign function.
Although calling cheaper append function instead assign doesn't make any difference on optimized builds
(DSE does the job removing stores), we still save some cycles for debug binaries.

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

23 months ago[X86][FP16] Regenerate test cases. NFC.
Phoebe Wang [Sat, 30 Jul 2022 05:13:21 +0000 (13:13 +0800)]
[X86][FP16] Regenerate test cases. NFC.

23 months ago[llvm] Use is_contained (NFC)
Kazu Hirata [Sat, 30 Jul 2022 04:18:44 +0000 (21:18 -0700)]
[llvm] Use is_contained (NFC)

23 months agoUse is_sorted (NFC)
Kazu Hirata [Sat, 30 Jul 2022 04:18:42 +0000 (21:18 -0700)]
Use is_sorted (NFC)

23 months agoUse value instead of getValue (NFC)
Kazu Hirata [Sat, 30 Jul 2022 04:18:41 +0000 (21:18 -0700)]
Use value instead of getValue (NFC)

23 months ago[clang] Use has_value instead of value (NFC)
Kazu Hirata [Sat, 30 Jul 2022 04:18:39 +0000 (21:18 -0700)]
[clang] Use has_value instead of value (NFC)

23 months ago[LLDB][RISCV] Add DWARF Registers
Emmmer [Thu, 28 Jul 2022 07:38:33 +0000 (15:38 +0800)]
[LLDB][RISCV] Add DWARF Registers

According to [RISC-V DWARF Specification](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-dwarf.adoc) add RISCV DWARF Registers.

Don't worry about the difference between riscv32 and riscv64, they just have different bytes of registers.

Reviewed By: DavidSpickett

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

23 months ago[libc] Compile integration tests with -ffreestanding to avoid mixup with system libc.
Siva Chandra Reddy [Sat, 30 Jul 2022 01:37:55 +0000 (01:37 +0000)]
[libc] Compile integration tests with -ffreestanding to avoid mixup with system libc.

23 months agoPreserve qualifiers when getting fully qualified type
Weverything [Sat, 30 Jul 2022 02:17:20 +0000 (19:17 -0700)]
Preserve qualifiers when getting fully qualified type

15f3cd6bfc670ba6106184a903eb04be059e5977 moved the handling of UsingType
to a later point in the function getFullyQualifiedType.  This moved it
after the removal of an ElaboratedType and its qualifiers.  However,
the qualifiers were not added back, causing the fully qualified type to
have a qualifier mismatch with the original type.  Make sure the
qualifers are added before continuing to fully qualify the type.

23 months ago[AMDGPU] Extend SILoadStoreOptimizer to s_load instructions
Carl Ritson [Sat, 30 Jul 2022 02:13:20 +0000 (11:13 +0900)]
[AMDGPU] Extend SILoadStoreOptimizer to s_load instructions

Apply merging to s_load as is done for s_buffer_load.

Reviewed By: foad

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

23 months ago[InstCombine] Refactor foldICmpMulConstant
Alexander Shaposhnikov [Sat, 30 Jul 2022 01:43:25 +0000 (01:43 +0000)]
[InstCombine] Refactor foldICmpMulConstant

This is a follow-up to 2ebfda2417
(replace "if" with "else if" since the cases nuw/nsw
were meant to be handled separately).

Test plan:
1/ ninja check-llvm check-clang check-lld
2/ Bootstrapped LLVM/Clang pass tests

23 months ago[Clang] Fix handling of Max from getValueRange(...) in IntExprEvaluator::VisitCastExp...
Shafik Yaghmour [Sat, 30 Jul 2022 02:17:42 +0000 (19:17 -0700)]
[Clang] Fix handling of Max from getValueRange(...) in IntExprEvaluator::VisitCastExpr(...)

This is a follow-up to D130058 to fix how we handle the Max value we obtain from
getValueRange(...) in IntExprEvaluator::VisitCastExpr(...) which in the case of
an enum that contains an enumerator with the max integer value will overflow by
one.

The fix is to decrement the value of Max and use slt and ult for comparison Vs
sle and ule.`

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

23 months agoFix lack of cc1 flag in llvmcmd sections when assertions are enabled
Aiden Grossman [Sat, 30 Jul 2022 01:38:34 +0000 (18:38 -0700)]
Fix lack of cc1 flag in llvmcmd sections when assertions are enabled

Currently when assertions are enabled, the cc1 flag is not
inserted into the llvmcmd section of object files with embedded
bitcode. This deviates from the normal behavior where this is
the first flag that is inserted. This error stems from incorrect
use of the function generateCC1CommandLine() which requires
manually adding in the -cc1 flag which is currently not done.

Reviewed By: jansvoboda11

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

23 months ago[MLIR] Fix getCommonBlock utility in affine analysis
Uday Bondhugula [Sat, 30 Jul 2022 01:39:02 +0000 (07:09 +0530)]
[MLIR] Fix getCommonBlock utility in affine analysis

Fix the hardcoded check for `FuncOp` in `getCommonBlock` utility: the
check should have been for an op that starts an affine scope. The
incorrect block returned in turn causes dependence analysis to function
incorrectly.

This change allows affine store-load forwarding to work correctly inside
any ops that start an affine scope.

Reviewed By: ftynse, dcaballe

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

23 months agoRevert "[compiler-rt] [builtins] Detect _Float16 support at compile time"
Phoebe Wang [Sat, 30 Jul 2022 01:41:33 +0000 (09:41 +0800)]
Revert "[compiler-rt] [builtins] Detect _Float16 support at compile time"

This reverts commit ce6d40f5c23923a807388c58b82b4c343eced0ce.

Revert due to it broke the sanitizer-windows buildbot: https://lab.llvm.org/buildbot/#/builders/127/builds/33583/steps/4/logs/stdio

23 months ago[libc] Implement cosf function that is correctly rounded to all rounding modes.
Tue Ly [Wed, 27 Jul 2022 16:22:27 +0000 (12:22 -0400)]
[libc] Implement cosf function that is correctly rounded to all rounding modes.

Implement cosf function that is correctly rounded to all rounding
modes.

Performance benchmark using perf tool from CORE-MATH project

(https://gitlab.inria.fr/core-math/core-math/-/tree/master) on Ryzen 1700:
Before this patch (not correctly rounded):
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh cosf
CORE-MATH reciprocal throughput   : 19.043
System LIBC reciprocal throughput : 26.328
LIBC reciprocal throughput        : 30.955

$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh cosf --latency
GNU libc version: 2.31
GNU libc release: stable
CORE-MATH latency   : 49.995
System LIBC latency : 59.286
LIBC latency        : 60.174

```
After this patch (correctly rounded):
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh cosf
GNU libc version: 2.31
GNU libc release: stable
CORE-MATH reciprocal throughput   : 19.072
System LIBC reciprocal throughput : 26.286
LIBC reciprocal throughput        : 13.631

$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh cosf --latency
GNU libc version: 2.31
GNU libc release: stable
CORE-MATH latency   : 49.872
System LIBC latency : 59.468
LIBC latency        : 56.119
```

Reviewed By: orex, zimmermann6

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

23 months ago[flang] Add semantics test for EVENT WAIT statement
Naje George [Mon, 25 Jul 2022 23:07:07 +0000 (16:07 -0700)]
[flang] Add semantics test for EVENT WAIT statement

Reviewed By: ktras

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

23 months ago[ELF] Move addDependentLibrary/handleSectionGroup. NFC
Fangrui Song [Sat, 30 Jul 2022 00:07:09 +0000 (17:07 -0700)]
[ELF] Move addDependentLibrary/handleSectionGroup. NFC

To reduce diff for my upcoming parallel input section initialization patch.