platform/upstream/llvm.git
2 years ago[Pipeliner] Fix comment typo
Thomas Preud'homme [Mon, 4 Apr 2022 15:09:07 +0000 (16:09 +0100)]
[Pipeliner] Fix comment typo

2 years agoAttempt to re-enable demangle test in mangle-nttp-anon-union
Erich Keane [Mon, 4 Apr 2022 14:28:29 +0000 (07:28 -0700)]
Attempt to re-enable demangle test in mangle-nttp-anon-union

@thakis believes the problem was the lack of -n on my llvm-cxxfilt call,
so hopefully this is the only problem. Committing to see if this makes
all the buildbots happy.

2 years ago[InstSimplify] Fold (ctpop(X) == N) || (X != 0) into X != 0 where N > 0
Hirochika Matsumoto [Wed, 30 Mar 2022 18:53:11 +0000 (03:53 +0900)]
[InstSimplify] Fold (ctpop(X) == N) || (X != 0) into X != 0 where N > 0

(ctpop(X) == N) || (X != 0) --> (X != 0) https://alive2.llvm.org/ce/z/udgUVV
(ctpop(X) != N) && (X == 0) --> (X == 0) https://alive2.llvm.org/ce/z/9dq-cR

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

2 years agofix comment typos to cycle bots
Nico Weber [Mon, 4 Apr 2022 14:18:08 +0000 (10:18 -0400)]
fix comment typos to cycle bots

2 years ago[gn build] Always make symlinks target explicitly depend on base binary
Nico Weber [Mon, 4 Apr 2022 13:23:15 +0000 (09:23 -0400)]
[gn build] Always make symlinks target explicitly depend on base binary

This is a no-op in these files since the symlinks array is never empty
and the dependency to the base binary is added through the loop in these
cases.

But adding them doesn't hurt either, and it:
1. Makes all symlinks targets look the same, independent of symlinks
   are created always or just conditionally based on gn args
2. Makes it less likely that bugs like the one fixed by b0abada8fe7e
   are introduced by copy-pasting an existing symlink target and then
   not being careful enough when tweaking it.

No behavior change.

2 years ago[gn build] Port 980c3e6dd223
LLVM GN Syncbot [Mon, 4 Apr 2022 13:48:25 +0000 (13:48 +0000)]
[gn build] Port 980c3e6dd223

2 years agoReapply"[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs"
Erich Keane [Mon, 4 Apr 2022 13:25:07 +0000 (06:25 -0700)]
Reapply"[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs"

AND the followups that fixed builds.

I attempted to get 'cute' and use llvm-cxxfilt to make the test look
nicer, but apparently some of the bots have a version of llvm-cxxfilt
that is not the in-tree one, so it fails to properly demangle the stuff.
I've disabled this "RUN" line.

This reverts commit 50186b63d1807d389f31c515377d94185795ab44.

2 years ago[CodeGen] Async unwind - add a pass to fix CFI information
Momchil Velikov [Mon, 4 Apr 2022 09:01:30 +0000 (10:01 +0100)]
[CodeGen] Async unwind - add a pass to fix CFI information

This pass inserts the necessary CFI instructions to compensate for the
inconsistency of the call-frame information caused by linear (non-CFG
aware) nature of the unwind tables.

Unlike the `CFIInstrInserer` pass, this one almost always emits only
`.cfi_remember_state`/`.cfi_restore_state`, which results in smaller
unwind tables and also transparently handles custom unwind info
extensions like CFA offset adjustement and save locations of SVE
registers.

This pass takes advantage of the constraints that LLVM imposes on the
placement of save/restore points (cf. `ShrinkWrap.cpp`):

  * there is a single basic block, containing the function prologue

  * possibly multiple epilogue blocks, where each epilogue block is
    complete and self-contained, i.e. CSR restore instructions (and the
    corresponding CFI instructions are not split across two or more
    blocks.

  * prologue and epilogue blocks are outside of any loops

Thus, during execution, at the beginning and at the end of each basic
block the function can be in one of two states:

  - "has a call frame", if the function has executed the prologue, or
     has not executed any epilogue

  - "does not have a call frame", if the function has not executed the
    prologue, or has executed an epilogue

These properties can be computed for each basic block by a single RPO
traversal.

In order to accommodate backends which do not generate unwind info in
epilogues we compute an additional property "strong no call frame on
entry" which is set for the entry point of the function and for every
block reachable from the entry along a path that does not execute the
prologue. If this property holds, it takes precedence over the "has a
call frame" property.

From the point of view of the unwind tables, the "has/does not have
call frame" state at beginning of each block is determined by the
state at the end of the previous block, in layout order.

Where these states differ, we insert compensating CFI instructions,
which come in two flavours:

- CFI instructions, which reset the unwind table state to the
    initial one.  This is done by a target specific hook and is
    expected to be trivial to implement, for example it could be:
```
     .cfi_def_cfa <sp>, 0
     .cfi_same_value <rN>
     .cfi_same_value <rN-1>
     ...
```
where `<rN>` are the callee-saved registers.

- CFI instructions, which reset the unwind table state to the one
    created by the function prologue. These are the sequence:
```
       .cfi_restore_state
       .cfi_remember_state
```
In this case we also insert a `.cfi_remember_state` after the
last CFI instruction in the function prologue.

Reviewed By: MaskRay, danielkiss, chill

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

2 years ago[demangler] Parenthesize >> inside template args
Nathan Sidwell [Fri, 25 Mar 2022 11:34:19 +0000 (04:34 -0700)]
[demangler] Parenthesize >> inside template args

Both > and >> expressions need to be parenthesized inside template
argument lists.

Reviewed By: dblaikie, rjmccall

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

2 years ago[pseudo] respect CLANG_INCLUDE_TESTS
Sam McCall [Mon, 4 Apr 2022 13:30:11 +0000 (15:30 +0200)]
[pseudo] respect CLANG_INCLUDE_TESTS

2 years ago[gn build] llvm-lipo, llvm-libtool-darwin symlink targets now dep on binary
Nico Weber [Mon, 4 Apr 2022 13:18:24 +0000 (09:18 -0400)]
[gn build] llvm-lipo, llvm-libtool-darwin symlink targets now dep on binary

This fixes a regression from 69cde915e923d: If llvm_install_cctools_symlinks
is false, depending llvm-lipo:symlinks didn't actually depend on llvm-lipo
and the binary didn't get built as dependency of `check-lld` (because the
`symlinks` array ended up empty).

2 years ago[libc++][NFC] Rename generate_assertion_tests.py to generate_header_tests.py
Louis Dionne [Mon, 4 Apr 2022 13:10:52 +0000 (09:10 -0400)]
[libc++][NFC] Rename generate_assertion_tests.py to generate_header_tests.py

2 years ago[libc++] Implement all public header tests using the new generator
Louis Dionne [Fri, 25 Mar 2022 21:06:46 +0000 (17:06 -0400)]
[libc++] Implement all public header tests using the new generator

Note that `generate_assertion_tests.py` will be renamed to
`generate_header_tests.py` separately to facilitate change tracking.

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

2 years agofix comment typos to cycle bots
Nico Weber [Mon, 4 Apr 2022 12:56:07 +0000 (08:56 -0400)]
fix comment typos to cycle bots

2 years ago[DAG] SimplifySetCC - clang-format add/xor/sub with constant handling. NFC.
Simon Pilgrim [Mon, 4 Apr 2022 12:30:04 +0000 (13:30 +0100)]
[DAG] SimplifySetCC - clang-format add/xor/sub with constant handling. NFC.

2 years ago[clang][dataflow] Add support for clang's `__builtin_expect`.
Yitzhak Mandelbaum [Fri, 1 Apr 2022 12:51:23 +0000 (12:51 +0000)]
[clang][dataflow] Add support for clang's `__builtin_expect`.

This patch adds basic modeling of `__builtin_expect`, just to propagate the
(first) argument, making the call transparent.

Driveby: adds tests for proper handling of other builtins.

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

2 years ago[clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member
Pavel Samolysov [Mon, 4 Apr 2022 08:23:24 +0000 (11:23 +0300)]
[clang][NFC] Extract the EmitAssemblyHelper::TargetTriple member

Few times in different methods of the EmitAssemblyHelper class the following
code snippet is used to get the TargetTriple and then use it's single method
to check some conditions:

TargetTriple(TheModule->getTargetTriple())

The parsing of a target triple string is not a trivial operation and it takes
time to repeat the parsing many times in different methods of the class and
even numerous times in one method just to call a getter
(llvm::Triple(TheModule->getTargetTriple()).getVendor()), for example.
The patch extracts the TargetTriple member of the EmitAssemblyHelper class to
parse the triple only once in the class' constructor.

Reviewed By: tejohnson

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

2 years ago[Thumb2] Regenerate thumb2-teq2 tests
Simon Pilgrim [Mon, 4 Apr 2022 11:48:20 +0000 (12:48 +0100)]
[Thumb2] Regenerate thumb2-teq2 tests

2 years ago[mlir] Fix the build error in OpenMPToLLVMIRTranslation.cpp
PeixinQiao [Mon, 4 Apr 2022 11:46:16 +0000 (19:46 +0800)]
[mlir] Fix the build error in OpenMPToLLVMIRTranslation.cpp

Fix the build error with "-Werror,-Wcovered-switch-default".

Reviewed By: hpmorgan

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

2 years ago[AArch64] Teach the costmodel about widening muls
David Green [Mon, 4 Apr 2022 11:45:04 +0000 (12:45 +0100)]
[AArch64] Teach the costmodel about widening muls

A vector mul(sext, sext) or mul(zext, zext) will be code generated as a
single smull or umull instruction. This most notably effects v2i64
multiplies, which are otherwise not legal and need to be expanded.

The oneuse check has also been slightly changed, as it is already
checked from the use of isWideningInstruction in getCastInstrCost.

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

2 years ago[Thumb2] Regenerate thumb2-teq tests
Simon Pilgrim [Mon, 4 Apr 2022 11:24:30 +0000 (12:24 +0100)]
[Thumb2] Regenerate thumb2-teq tests

2 years ago[lldb][AArch64] Update disassembler feature list and add tests for all extensions
David Spickett [Fri, 18 Mar 2022 11:48:54 +0000 (11:48 +0000)]
[lldb][AArch64] Update disassembler feature list and add tests for all extensions

This updates the disassembler to enable every optional extension.
Previously we had added things that we added "support" for in lldb.
(where support means significant work like new registers, fault types, etc.)

Something like TME (transactional memory) wasn't added because
there are no new lldb features for it. However we should still be
disassembling the instructions.

So I went through the AArch64 extensions and added all the missing
ones. The new test won't prevent us missing a new extension but it
does at least document our current settings.

Reviewed By: labath

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

2 years ago[MIPS] Regenerate countleading tests with common check prefixes
Simon Pilgrim [Mon, 4 Apr 2022 11:19:31 +0000 (12:19 +0100)]
[MIPS] Regenerate countleading tests with common check prefixes

2 years ago[AArch64] Add widening arithmetic cost tests. NFC
David Green [Mon, 4 Apr 2022 11:19:45 +0000 (12:19 +0100)]
[AArch64] Add widening arithmetic cost tests. NFC

2 years ago[ConstantFold] Fold zero-index GEPs with opaque pointers
Nikita Popov [Mon, 4 Apr 2022 10:59:17 +0000 (12:59 +0200)]
[ConstantFold] Fold zero-index GEPs with opaque pointers

With opaque pointers, we can eliminate zero-index GEPs even if
they have multiple indices, as this no longer impacts the result
type of the GEP.

This optimization is already done for instructions in InstSimplify,
but we were missing the corresponding constant expression handling.

The constexpr transform is a bit more powerful, because it can
produce a vector splat constant and also handles undef values --
it is an extension of an existing single-index transform.

2 years ago[InstSimplify] Add tests for zero-offset opaque ptr constexpr GEP (NFC)
Nikita Popov [Mon, 4 Apr 2022 11:00:00 +0000 (13:00 +0200)]
[InstSimplify] Add tests for zero-offset opaque ptr constexpr GEP (NFC)

2 years ago[X86] Regenerate peep tests checks
Simon Pilgrim [Mon, 4 Apr 2022 11:02:23 +0000 (12:02 +0100)]
[X86] Regenerate peep tests checks

2 years agoRevert "[NFCI] Regenerate PhaseOrdering test checks"
Muhammad Omair Javaid [Mon, 4 Apr 2022 10:30:57 +0000 (15:30 +0500)]
Revert "[NFCI] Regenerate PhaseOrdering test checks"

This reverts commit e91fe08999d5f5d7e7777837c529bac692d06c1b.

Breaks following buildbots: https://lab.llvm.org/buildbot/#/builders/171

2 years ago[flang] Update the conversion code for fir.coordinate_of
Andrzej Warzynski [Mon, 28 Mar 2022 16:13:59 +0000 (16:13 +0000)]
[flang] Update the conversion code for fir.coordinate_of

These are mostly small changes to make the code a bit clearer and more
consistent. Summary of changes:
  * add missing namespace qualifiers (that's the preference in Flang)
  * replace const member methods with static methods (to avoid passing
    the *this pointer unnecessarily)
  * rename `currentObjTy` (current object type) as `cpnTy` (component
    type) - the latter feels more fitting
  * remove redundant `return failure();` calls (` return
    mlir::emitError` gives the same result)
  * updated a few comments

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

2 years ago[DebugInfo] Correctly recognize bitfields when emitting dwarf
Jeremy Morse [Mon, 4 Apr 2022 10:11:24 +0000 (11:11 +0100)]
[DebugInfo] Correctly recognize bitfields when emitting dwarf

Use the "isBitfield" flag for debug types to determine whether something is
a bitfield, rather than trying to guess from it's layout. Fixes
https://bugs.llvm.org/show_bug.cgi?id=44601

Patch by: mahkoh

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

2 years ago[X86] Support optional NOT stages in the AND(SRL(X,Y),1) -> SETCC(BT(X,Y)) fold
Simon Pilgrim [Mon, 4 Apr 2022 09:51:26 +0000 (10:51 +0100)]
[X86] Support optional NOT stages in the AND(SRL(X,Y),1) -> SETCC(BT(X,Y)) fold

Extension to D122891, peek through NOT() ops, adjusting the condcode as we go.

2 years ago[X86] Add additional test cases for NOT(AND(SRL(X,Y),1))/AND(SRL(NOT(X(,Y),1) ->...
Simon Pilgrim [Mon, 4 Apr 2022 09:29:20 +0000 (10:29 +0100)]
[X86] Add additional test cases for NOT(AND(SRL(X,Y),1))/AND(SRL(NOT(X(,Y),1) -> SETCC(BT(X,Y))

As suggested in post review on D122891

2 years ago[VPlan] Update VPInterleavedAccessInfo to use getVectorLoopRegion.
Florian Hahn [Mon, 4 Apr 2022 09:26:01 +0000 (10:26 +0100)]
[VPlan] Update VPInterleavedAccessInfo to use getVectorLoopRegion.

Update VPInterleavedAccessInfo  to use the generic getVectorLoopRegion
helper instead of relying on the entry block being the top-most vector
loop region.

2 years ago[SimplifyLibCalls] Optimize memchr() with known char+str and unknown length
Martin Sebor [Mon, 4 Apr 2022 08:31:03 +0000 (10:31 +0200)]
[SimplifyLibCalls] Optimize memchr() with known char+str and unknown length

If both the character and string are known, but the length
potentially isn't, we can optimize the memchr() call to a select
of either the known position of the character or null.

Split off from https://reviews.llvm.org/D122836.

2 years ago[SimplifyLibCalls] Move handling of constant char earlier (NFC)
Martin Sebor [Mon, 4 Apr 2022 08:47:59 +0000 (10:47 +0200)]
[SimplifyLibCalls] Move handling of constant char earlier (NFC)

Handle the simple constant char case before the bitmask optimization.
This will allow extending the code to handle a non-constant size
argument in a followup change.

Split out from https://reviews.llvm.org/D122836.

2 years ago[flang][NFC] Add tests for array-value-copy pass with array with pointers
Valentin Clement [Mon, 4 Apr 2022 08:44:21 +0000 (10:44 +0200)]
[flang][NFC] Add tests for array-value-copy pass with array with pointers

This patch adds tests for the array-value-copy pass with array assignment
involving Fortran pointers.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

2 years ago[SimplifyLibCalls] Fold memchr() with size 1
Martin Sebor [Mon, 4 Apr 2022 08:36:57 +0000 (10:36 +0200)]
[SimplifyLibCalls] Fold memchr() with size 1

If the memchr() size is 1, then we can convert the call into a
single-byte comparison. This works even if both the string and the
character are unknown.

Split off from https://reviews.llvm.org/D122836.

2 years ago[InstCombine] Add additional memchr test (NFC)
Martin Sebor [Mon, 4 Apr 2022 08:32:40 +0000 (10:32 +0200)]
[InstCombine] Add additional memchr test (NFC)

And fix some test names / comments.

2 years ago[VPlan] Remember previous loop and reset vector loop.
Florian Hahn [Mon, 4 Apr 2022 08:27:15 +0000 (09:27 +0100)]
[VPlan] Remember previous loop and reset vector loop.

At the moment this is NFC, but will be needed once nested loops are also
modeled as regions. Preparation for D123005.

2 years ago[MemCpyOpt] Work around PR54682
Nikita Popov [Fri, 1 Apr 2022 14:33:35 +0000 (16:33 +0200)]
[MemCpyOpt] Work around PR54682

As discussed on https://github.com/llvm/llvm-project/issues/54682,
MemorySSA currently has a bug when computing the clobber of calls
that access loop-varying locations. I think a "proper" fix for this
on the MemorySSA side might be non-trivial, but we can easily work
around this in MemCpyOpt:

Currently, MemCpyOpt uses a location-less getClobberingMemoryAccess()
call to find a clobber on either the src or dest location, and then
refines it for the src and dest clobber. This was intended as an
optimization, as the location-less API is cached, while the
location-affected APIs are not.

However, I don't think this really makes a difference in practice,
because I don't think anything will use the cached clobbers on
those calls later anyway. On CTMark, this patch seems to be very
mildly positive actually.

So I think this is a reasonable way to avoid the problem for now,
though MemorySSA should also get a fix.

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

2 years ago[Float2Int] Make sure dependent ranges are calculated first (PR54669)
Nikita Popov [Fri, 1 Apr 2022 10:28:21 +0000 (12:28 +0200)]
[Float2Int] Make sure dependent ranges are calculated first (PR54669)

The range calculation in walkForwards() assumes that the ranges of
the operands have already been calculated. With the used visit
order, this is not necessarily the case when there are multiple
roots. (There is nothing guaranteeing that instructions are visited
in topological order.)

Fix this by queuing instructions for reprocessing if the operand
ranges haven't been calculated yet.

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

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

2 years ago[flang] Fold instantiated PDT character component length when needed
Jean Perier [Mon, 4 Apr 2022 07:47:03 +0000 (09:47 +0200)]
[flang] Fold instantiated PDT character component length when needed

In case a character component PDT length only depends on kind parameters,
fold it while instantiating the PDT. This is especially important if the
component has an initializer because later semantic phases (offset
computation or runtime type info generation) might get confused and
generate offset/type info that will lead to crashes in lowering.

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

2 years ago[flang][NFC] Add tests for fir.address_of
Valentin Clement [Mon, 4 Apr 2022 07:25:28 +0000 (09:25 +0200)]
[flang][NFC] Add tests for fir.address_of

This patch adds FIR to LLVM test for fir.address_of.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[ELF][test] Fix RUN lines in lto/sample-profile.ll
Fangrui Song [Mon, 4 Apr 2022 06:57:31 +0000 (23:57 -0700)]
[ELF][test] Fix RUN lines in lto/sample-profile.ll

Reported at https://github.com/llvm/llvm-project/issues/54679#issuecomment-1086862116

2 years ago[M68k] Adopt VarLenCodeEmitter for shift / rotate instructions
Min-Yih Hsu [Fri, 17 Dec 2021 03:34:36 +0000 (11:34 +0800)]
[M68k] Adopt VarLenCodeEmitter for shift / rotate instructions

This patch is covered by existing MC tests.

2 years ago[M68k][test] Remove redundant CHECK-LABEL directive
Min-Yih Hsu [Mon, 4 Apr 2022 05:39:20 +0000 (22:39 -0700)]
[M68k][test] Remove redundant CHECK-LABEL directive

The associated test had a redundant CHECK-LABEL directive that might fail
the test since the inception, but this issue was "burried" by a missing
colon, which was addressed in fb65aaf0be09936e657d339f3dc8e62666a41956.
Thus, the test finally failed after the said commit.

This patch remove that CHECK-LABEL directive.

2 years agoReland "[lit] Use sharding for GoogleTest format"
Yuanfang Chen [Mon, 4 Apr 2022 03:14:26 +0000 (20:14 -0700)]
Reland "[lit] Use sharding for GoogleTest format"

This relands commit a87ba5c86d5d72defdbcdb278baad6515ec99463.

Adjust llvm/utils/lit/tests/googletest-timeout.py for new test output.

2 years ago[Support/BLAKE3] CMake: Remove the workaround that checks for "CC=ccache /path/to...
Argyrios Kyrtzidis [Mon, 4 Apr 2022 04:02:02 +0000 (21:02 -0700)]
[Support/BLAKE3] CMake: Remove the workaround that checks for "CC=ccache /path/to/clang"

The LLVM builders that were doing that have been updated to use "-DLLVM_CCACHE_BUILD=ON" instead.

2 years agoAttributorAttributes: guard against TLI being nullptr
Augie Fackler [Thu, 31 Mar 2022 18:46:51 +0000 (14:46 -0400)]
AttributorAttributes: guard against TLI being nullptr

I didn't dig into this very much because it appears to be totally valid
(especially once these properties can come from attributes instead
of only from hard-coded library functions) for TLI to not be defined,
and nothing broke when I added this check, including with all my other
patches applied.

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

2 years agoCallBase: fix getFnAttr so it also checks the function
Augie Fackler [Thu, 31 Mar 2022 14:30:26 +0000 (10:30 -0400)]
CallBase: fix getFnAttr so it also checks the function

Prior to this change, CallBase::hasFnAttr checked the called function to
see if it had an attribute if it wasn't set on the CallBase, but
getFnAttr didn't do the same delegation, which led to very confusing
behavior. This patch fixes the issue by making CallBase::getFnAttr also
check the function under the same circumstances.

Test changes look (to me) like they're cleaning up redundant attributes
which no longer get specified both on the callee and call. We also clean
up the one ad-hoc implementation of this getter over in InlineCost.cpp.

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

2 years ago[LV] Handle non-integral types when considering interleave widening legality
Philip Reames [Mon, 4 Apr 2022 03:09:03 +0000 (20:09 -0700)]
[LV] Handle non-integral types when considering interleave widening legality

In general, anywhere we might need to insert a blind bitcast, we need to make sure the types are losslessly convertible.

This fixes pr54634.

2 years ago[memcpyopt] Restructure store(load src, dest) form of callslotopt for compile time
Philip Reames [Tue, 29 Mar 2022 03:29:41 +0000 (20:29 -0700)]
[memcpyopt] Restructure store(load src, dest) form of callslotopt for compile time

The search for the clobbering call is fairly expensive if uses are not optimized at construction.  Defer the clobber walk to the point in the implementation we need it; there are a bunch of bailouts before that point.  (e.g. If the source pointer is not an alloca, we can't do callslotopt.)

On a test case which involves a bunch of copies from argument pointers, this switches memcpyopt from > 1/2 second to < 10ms.

2 years agoRevert "[lit] Use sharding for GoogleTest format"
Yuanfang Chen [Mon, 4 Apr 2022 03:04:55 +0000 (20:04 -0700)]
Revert "[lit] Use sharding for GoogleTest format"

This reverts commit a87ba5c86d5d72defdbcdb278baad6515ec99463.

Breaks bots:
https://lab.llvm.org/buildbot/#/builders/196/builds/10454

2 years ago[lit] Use sharding for GoogleTest format
Yuanfang Chen [Sat, 2 Apr 2022 19:28:23 +0000 (12:28 -0700)]
[lit] Use sharding for GoogleTest format

This helps lit unit test performance by a lot, especially on windows. The performance gain comes from launching one gtest executable for many subtests instead of one (this is the current situation).

The shards are executed by the test runner and the results are stored in the
json format supported by the GoogleTest. Later in the test reporting stage,
all test results in the json file are retrieved to continue the test results
summary etc.

On my Win10 desktop, before this patch: `check-clang-unit`: 177s, `check-llvm-unit`: 38s; after this patch: `check-clang-unit`: 37s, `check-llvm-unit`: 11s.
On my Linux machine, before this patch: `check-clang-unit`: 46s, `check-llvm-unit`: 8s; after this patch: `check-clang-unit`: 7s, `check-llvm-unit`: 4s.

Reviewed By: yln, rnk

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

2 years agoCorrect spelling error in TLS-Load-Hoist
Xiang1 Zhang [Mon, 4 Apr 2022 00:27:28 +0000 (08:27 +0800)]
Correct spelling error in TLS-Load-Hoist

2 years agoRevert "[NFCI] Regenerate SROA/LoopVectorize test checks"
Dávid Bolvanský [Sun, 3 Apr 2022 23:14:34 +0000 (01:14 +0200)]
Revert "[NFCI] Regenerate SROA/LoopVectorize test checks"

This reverts commit 14e3450fb57305aa9ff3e9e60687b458e43835c9.

2 years ago[NFCI] Regenerate SROA test checks
Dávid Bolvanský [Sun, 3 Apr 2022 22:55:54 +0000 (00:55 +0200)]
[NFCI] Regenerate SROA test checks

2 years ago[NFCI] Regenerate PhaseOrdering test checks
Dávid Bolvanský [Sun, 3 Apr 2022 22:28:57 +0000 (00:28 +0200)]
[NFCI] Regenerate PhaseOrdering test checks

2 years ago[NFCI] Regenerate LoopIdiomRecognize test checks
Dávid Bolvanský [Sun, 3 Apr 2022 22:21:00 +0000 (00:21 +0200)]
[NFCI] Regenerate LoopIdiomRecognize test checks

2 years agoRevert "[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs"
Nico Weber [Sun, 3 Apr 2022 21:21:06 +0000 (17:21 -0400)]
Revert "[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs"

This reverts commit 4cf98f973a13c5049322abff43f0dff3c214311b.
The test fails on mac bots, see comments on https://reviews.llvm.org/D122820

Also reverts follow-ups eb920989865d992093993143ba3c6e71126cbb89 and
861c189d2a5203ba8c8e983e8d2e109c0de153a5.

2 years ago[AArch64] Remove unsued WideningBaseCost. NFC
David Green [Sun, 3 Apr 2022 21:16:39 +0000 (22:16 +0100)]
[AArch64] Remove unsued WideningBaseCost. NFC

The WideningBaseCost is always 0. This removes it to clean up the code.

2 years ago[libc++] Remove unused <iosfwd> include from <__debug>
Louis Dionne [Sun, 3 Apr 2022 16:40:39 +0000 (12:40 -0400)]
[libc++] Remove unused <iosfwd> include from <__debug>

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

2 years ago[NFCI] Regenerate LoopVectorize test checks
Dávid Bolvanský [Sun, 3 Apr 2022 19:55:58 +0000 (21:55 +0200)]
[NFCI] Regenerate LoopVectorize test checks

2 years ago[IR] Remove unused forward declarations (NFC)
Kazu Hirata [Sun, 3 Apr 2022 19:54:54 +0000 (12:54 -0700)]
[IR] Remove unused forward declarations (NFC)

2 years ago[NFCI] Regenerate instsimplify test checks
Dávid Bolvanský [Sun, 3 Apr 2022 18:54:13 +0000 (20:54 +0200)]
[NFCI] Regenerate instsimplify test checks

2 years ago[libc++][NFC] Fix weird indentation in test
Louis Dionne [Sun, 3 Apr 2022 16:47:21 +0000 (12:47 -0400)]
[libc++][NFC] Fix weird indentation in test

2 years ago[BOLT] AArch64: Read all static relocations
Vladislav Khmelevsky [Sun, 20 Mar 2022 14:15:56 +0000 (17:15 +0300)]
[BOLT] AArch64: Read all static relocations

Read static relocs on the same address, as dynamic in order to update
constant island data address properly.

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

2 years agoRevert "[Flang][OpenMP] Add semantic check for OpenMP Private, Firstprivate and Lastp...
Kiran Chandramohan [Sun, 3 Apr 2022 15:23:54 +0000 (15:23 +0000)]
Revert "[Flang][OpenMP] Add semantic check for OpenMP Private, Firstprivate and Lastprivate clauses."

This reverts commit a2ca6bbda6160c1b474fffd6204bcac9456c7eb1.

D93213 performs some checks to ensure that variables that appear in
statement functions are not in privatisation clauses. The point at
which this check is currently performed, there can be misparses that
cause more constructs to be identified as statement functions. This
can lead to various kinds of errors, hence reverting.

This revert hopefully fixes:
https://github.com/llvm/llvm-project/issues/54477
https://github.com/llvm/llvm-project/issues/54161
https://github.com/llvm/llvm-project/issues/54163

Reviewed By: shraiysh

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

2 years ago[lldb][gui] underline the current token
Luboš Luňák [Sun, 3 Apr 2022 15:32:11 +0000 (17:32 +0200)]
[lldb][gui] underline the current token

Just like the non-gui listing already does.

2 years ago[lldb][gui] use symbolic names rather than hardcoded values
Luboš Luňák [Sun, 3 Apr 2022 15:01:54 +0000 (17:01 +0200)]
[lldb][gui] use symbolic names rather than hardcoded values

2 years ago[lldb][gui] fix background of syntax-highlighted non-selected PC line
Luboš Luňák [Sun, 3 Apr 2022 14:29:44 +0000 (16:29 +0200)]
[lldb][gui] fix background of syntax-highlighted non-selected PC line

It is the PC line, selected or not, that gets the blue-background
highlight. Without this, a keyword like 'bool' got black background
if the line wasn't selected.
And the blue-background highlight is handled by OutputColoredStringTruncated(),
so no point in setting it explicitly in the calling code.

2 years ago[lldb][gui] draw highlight for selected line even if empty
Luboš Luňák [Sun, 3 Apr 2022 14:08:02 +0000 (16:08 +0200)]
[lldb][gui] draw highlight for selected line even if empty

2 years agoRevert "Apply clang-tidy fixes for readability-redundant-declaration in Debug.cpp...
Kazu Hirata [Sun, 3 Apr 2022 15:14:11 +0000 (08:14 -0700)]
Revert "Apply clang-tidy fixes for readability-redundant-declaration in Debug.cpp (NFC)"

This reverts commit 0fe01a9346658c0955b68b123f2b470b018114b1.

The commit caused build failures like:

  llvm/lib/Support/Debug.cpp:65:3: error: ‘setCurrentDebugTypes’ was
  not declared in this scope; did you mean ‘setCurrentDebugType’?

2 years ago[gn build] Port e476df5629ee
LLVM GN Syncbot [Sun, 3 Apr 2022 15:09:33 +0000 (15:09 +0000)]
[gn build] Port e476df5629ee

2 years ago[libc++][ranges] Implement ranges::max
Nikolas Klauser [Sun, 3 Apr 2022 07:17:01 +0000 (09:17 +0200)]
[libc++][ranges] Implement ranges::max

Reviewed By: Mordante, var-const, #libc

Spies: sstefan1, libcxx-commits, mgorny

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

2 years agoApply clang-tidy fixes for readability-redundant-declaration in Debug.cpp (NFC)
Kazu Hirata [Sun, 3 Apr 2022 15:04:12 +0000 (08:04 -0700)]
Apply clang-tidy fixes for readability-redundant-declaration in Debug.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-member-init in YAMLParser.cpp (NFC)
Kazu Hirata [Sun, 3 Apr 2022 15:04:11 +0000 (08:04 -0700)]
Apply clang-tidy fixes for readability-redundant-member-init in YAMLParser.cpp (NFC)

2 years ago[clang-tidy] Add release notes for changes made in 2b21fc5520b39fba555f4e5f2480a56510...
Danny Mösch [Sun, 3 Apr 2022 13:48:39 +0000 (15:48 +0200)]
[clang-tidy] Add release notes for changes made in 2b21fc5520b39fba555f4e5f2480a5651056be84

2 years ago[flang][NFC] Add tests for fir.array_modify in array-value-copy pass
Valentin Clement [Sun, 3 Apr 2022 13:25:36 +0000 (15:25 +0200)]
[flang][NFC] Add tests for fir.array_modify in array-value-copy pass

This patch adds some test for the `fir.array_modify` operation
in the array-value-copy pass

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang][NFC] Add more test cases for the array-value-copy pass
Valentin Clement [Sun, 3 Apr 2022 13:24:20 +0000 (15:24 +0200)]
[flang][NFC] Add more test cases for the array-value-copy pass

This patch adds some test cases for the array-value-copy pass with slices.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang][NFC] Add tests for fir.is_present
Valentin Clement [Sun, 3 Apr 2022 13:21:42 +0000 (15:21 +0200)]
[flang][NFC] Add tests for fir.is_present

This patch adds tests for the `fir.is_present`
translation.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang] Add global and global box initialization tests
Valentin Clement [Sun, 3 Apr 2022 13:19:38 +0000 (15:19 +0200)]
[flang] Add global and global box initialization tests

This patch addes some global initialization and global
box initialization tests.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang][NFC] Add tests for select constructs
Valentin Clement [Sun, 3 Apr 2022 13:17:21 +0000 (15:17 +0200)]
[flang][NFC] Add tests for select constructs

Add tests for fir.select_rank and
fir.select_case.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years agoReapply "[InstSimplify][NFC] Add baseline tests for folds of icmp with ctpop"
Hirochika Matsumoto [Sun, 3 Apr 2022 13:05:18 +0000 (22:05 +0900)]
Reapply "[InstSimplify][NFC] Add baseline tests for folds of icmp with ctpop"

This change was previously reverted because I forgot rerunning
update_test_checks.py and tests were not actually baseline.

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

2 years ago[libunwind] Add missing licenses in test files
Louis Dionne [Sun, 3 Apr 2022 12:55:57 +0000 (08:55 -0400)]
[libunwind] Add missing licenses in test files

2 years ago[NFCI] Fixed missing colon in CHECK directives - part 2
Dávid Bolvanský [Sun, 3 Apr 2022 12:42:35 +0000 (14:42 +0200)]
[NFCI] Fixed missing colon in CHECK directives - part 2

2 years ago[C++20][Modules] Fix a testcase warning on Windows [NFC].
Iain Sandoe [Sun, 3 Apr 2022 08:50:20 +0000 (09:50 +0100)]
[C++20][Modules] Fix a testcase warning on Windows [NFC].

As reported, using "-DTDIR=%t" with a path name of 'C:\Users\...' causes
a warning to be emitted about the use of \U without following hex digits.

Since the value is only required for the FileCheck cases resolve this by
omitting the -D from the compile lines.

2 years ago[NFCI] Fixed missing colon in CHECK directives
Dávid Bolvanský [Sun, 3 Apr 2022 09:51:33 +0000 (11:51 +0200)]
[NFCI] Fixed missing colon in CHECK directives

2 years ago[X86] lowerShuffleAsRepeatedMaskAndLanePermute - allow v16i32 sub-lane permutes for...
Simon Pilgrim [Sun, 3 Apr 2022 09:05:10 +0000 (10:05 +0100)]
[X86] lowerShuffleAsRepeatedMaskAndLanePermute - allow v16i32 sub-lane permutes for v64i8 shuffles

Without VBMI, we are better off permuting v16i32 sub-lanes, even though its a variable shuffle, if it allows us to then shuffle v64i8 inlane repeated masks (PSHUFB etc.)

Fixes #54658

2 years ago[InstCombine] Fold srem(X, PowerOf2) == C into (X & Mask) == C for positive C
Alexander Shaposhnikov [Sun, 3 Apr 2022 03:57:05 +0000 (03:57 +0000)]
[InstCombine] Fold srem(X, PowerOf2) == C into (X & Mask) == C for positive C

This diff extends InstCombinerImpl::foldICmpSRemConstant to handle the cases
srem(X, PowerOf2) == C and
srem(X, PowerOf2) != C
for positive C.
This addresses the issue https://github.com/llvm/llvm-project/issues/54650

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

Test plan: make check-all

2 years ago[InstCombine][NFC] Add baseline tests for folds of srem(X, PowerOf2) == C
Alexander Shaposhnikov [Sun, 3 Apr 2022 03:26:47 +0000 (03:26 +0000)]
[InstCombine][NFC] Add baseline tests for folds of srem(X, PowerOf2) == C

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

Test plan: make check-all

2 years ago[InstCombine] limit icmp fold with sub if other sub user is a phi
Sanjay Patel [Sat, 2 Apr 2022 23:23:42 +0000 (19:23 -0400)]
[InstCombine] limit icmp fold with sub if other sub user is a phi

This is a hacky fix for:
https://github.com/llvm/llvm-project/issues/54558

As discussed there, codegen regressed when we opened up this transform
to allow extra uses ( 61580d0949fd3465 ), and it's not clear how to
undo the transforms at the later stage of compilation.

As noted in the code comments, there's a set of remaining folds that
are still limited to one-use, so we can try harder to refine and
expand the limitations on these folds, but it's likely to be an
up-and-down battle as we find and overcome similar regressions.

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

2 years ago[InstCombine] fold fcmp with lossy casted constant (2nd try)
Sanjay Patel [Sat, 2 Apr 2022 22:52:18 +0000 (18:52 -0400)]
[InstCombine] fold fcmp with lossy casted constant (2nd try)

This is a retry of 9397bdc67eb2 - that was reverted until
we had a clang warning in place to alert users about a
possible mistake in source. The warning was added with
ab982eace6e4.

This is noted as a missing clang warning in #54222,
but it is also a missing optimization opportunity.

Alive2 proofs:
https://alive2.llvm.org/ce/z/Q8drDq
https://alive2.llvm.org/ce/z/pE6LRt

I don't see a single conversion for all predicates
using "getFCmpCode" logic, so other predicates are
left as a TODO item.

2 years ago[MLIR][Presburger] Use PresburgerSpace in SetCoalescer
Groverkss [Sat, 2 Apr 2022 22:36:11 +0000 (04:06 +0530)]
[MLIR][Presburger] Use PresburgerSpace in SetCoalescer

This patch changes the implementation of SetCoalescer to use PresburgerSpace
instead of reimplementing parts of PresburgerSpace.

Reviewed By: arjunp

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

2 years ago[InstCombine] Fold `(X | C2) ^ C1 --> (X & ~C2) ^ (C1^C2)`
Roman Lebedev [Sat, 2 Apr 2022 20:54:33 +0000 (23:54 +0300)]
[InstCombine] Fold `(X | C2) ^ C1 --> (X & ~C2) ^ (C1^C2)`

These two are equivalent,
and i *think* the `and` form is more-ish canonical.

General proof: https://alive2.llvm.org/ce/z/RrF5s6

If constant on the (outer) `xor` is an `undef`,
the whole lane is dead: https://alive2.llvm.org/ce/z/mu4Sh2

However, if the constant on the (inner) `or` is an `undef`,
we must sanitize it first: https://alive2.llvm.org/ce/z/MHYJL7
I guess, producing a zero `and`-mask is optimal in that case.

alive-tv is happy about the entirety of `xor-of-or.ll`.

2 years ago[NFC][InstCombine] Autogenerate check lines in a test affected by the future change
Roman Lebedev [Sat, 2 Apr 2022 21:03:15 +0000 (00:03 +0300)]
[NFC][InstCombine] Autogenerate check lines in a test affected by the future change

2 years ago[NFC][InstCombine] Add some tests for `(X | C2) ^ C1` pattern
Roman Lebedev [Sat, 2 Apr 2022 20:04:44 +0000 (23:04 +0300)]
[NFC][InstCombine] Add some tests for `(X | C2) ^ C1` pattern

2 years ago[Support] [BLAKE3] Fix compilation with CMAKE_OSX_ARCHITECTURES
Martin Storsjö [Fri, 1 Apr 2022 08:50:25 +0000 (11:50 +0300)]
[Support] [BLAKE3] Fix compilation with CMAKE_OSX_ARCHITECTURES

With CMake, one can build for multiple macOS architectures
at the same time by setting CMAKE_OSX_ARCHITECTURES to multiple
architectures (avoiding needing to do two separate builds and
gluing the binaries together after the build).

In this case, while targeting x86_64 and arm64, neither IS_X64
nor IS_ARM64 is set, while compilation of the individual source
files will hit those cases (in either architecture mode).

Therefore, if we on the CMake level decide not to include the
architecture specific SIMD implementation files, also tell the
source this explicitly by passing the defines indicating that we
don't expect to use them.

Such a build clearly is less ideal than explicitly targeting one
architecture at a time if it won't include all the SIMD optimizations,
but that's a tradeoff that is up to the one deciding to do such an
universal build.

This also fixes builds for i386. The blake3 source code automatically
enables the SIMD implementations when building for i386, but we don't
provide the sources for that build configuration.

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

2 years ago[Support] [BLAKE3] Remove .hidden directives from windows-gnu assembly sources
Martin Storsjö [Fri, 1 Apr 2022 11:29:54 +0000 (14:29 +0300)]
[Support] [BLAKE3] Remove .hidden directives from windows-gnu assembly sources

COFF symbols don't have anything corresponding to a `.hidden` flag;
both GNU binutils as and LLVM's built-in assembler errors out on
these directives.

This reverts one part of
7f05aa2d4c36d6d53f97ac3e0db30ec600abbc62, fixing builds for
mingw x86_64.

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

2 years ago[VPlan] Set VPlan header block name to vector.body.
Florian Hahn [Sat, 2 Apr 2022 18:33:58 +0000 (19:33 +0100)]
[VPlan] Set VPlan header block name to vector.body.

This brings the VPlan block naming in line with the naming of the
generated basic blocks.