platform/upstream/llvm.git
2 years agoRecommit "[VPlan] Introduce recipe to build scalar steps."
Florian Hahn [Mon, 28 Feb 2022 14:12:20 +0000 (14:12 +0000)]
Recommit "[VPlan] Introduce recipe to build scalar steps."

This reverts the revert commit ff93260bf6bddfbad1fa65c4d5184988885b900f.

The underlying issue causing the PPC bot failures has been fixed in
cbaac1473403 and a corresponding test case has been added in
ad2cad1c521c.

Original message:

    This patch adds a new VPScalarIVStepsRecipe to handle building scalar
    steps.

    In the first patch, it only handles the case where there is no vector
    induction variable needed.

    Reviewed By: Ayal

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

2 years ago[clang][tests] Fix ve-toolchain tests with CLANG_DEFAULT_UNWINDLIB
Timm Bäder [Mon, 28 Feb 2022 06:45:35 +0000 (07:45 +0100)]
[clang][tests] Fix ve-toolchain tests with CLANG_DEFAULT_UNWINDLIB

Otherwise, the driver will insert e.g. -lgcc_s when
CLANG_DEFAULT_UNWINDLIB=libgcc is set during the clang build.

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

2 years ago[flang] Lower power operations
Valentin Clement [Mon, 28 Feb 2022 13:48:40 +0000 (14:48 +0100)]
[flang] Lower power operations

Lower the power operation for real, integer
and complex.

The power operation is lowered to library calls.

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

Depends on D120403

Reviewed By: schweitz

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

2 years ago[AArch64] Async unwind - function prologues
Momchil Velikov [Mon, 28 Feb 2022 11:51:17 +0000 (11:51 +0000)]
[AArch64] Async unwind - function prologues

This patch rearranges emission of CFI instructions, so the resulting
DWARF and `.eh_frame` information is precise at every instruction.

The current state is that the unwind info is emitted only after the
function prologue. This is fine for synchronous (e.g. C++) exceptions,
but the information is generally incorrect when the program counter is
at an instruction in the prologue or the epilogue, for example:

```
stp x29, x30, [sp, #-16]!           // 16-byte Folded Spill
mov x29, sp
.cfi_def_cfa w29, 16
...
```

after the `stp` is executed the (initial) rule for the CFA still says
the CFA is in the `sp`, even though it's already offset by 16 bytes

A correct unwind info could look like:
```
stp x29, x30, [sp, #-16]!           // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
.cfi_def_cfa w29, 16
...
```

Having this information precise up to an instruction is useful for
sampling profilers that would like to get a stack backtrace. The end
goal (towards this patch is just a step) is to have fully working
`-fasynchronous-unwind-tables`.

Reviewed By: danielkiss, MaskRay

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

2 years ago[mlir] Apply ClangTidy performance fixes (NFC)
Adrian Kuegel [Mon, 28 Feb 2022 12:17:34 +0000 (13:17 +0100)]
[mlir] Apply ClangTidy performance fixes (NFC)

2 years ago[AArch64][SVE] Handle more cases in findMoreOptimalIndexType.
Sander de Smalen [Mon, 28 Feb 2022 11:32:05 +0000 (11:32 +0000)]
[AArch64][SVE] Handle more cases in findMoreOptimalIndexType.

This patch addresses @paulwalker-arm's comment on D117900 to
only update/write the by-ref operands iff the function returns
true. It also handles a few more cases where a series of added
offsets can be folded into the base pointer, rather than just looking
at a single offset.

Reviewed By: paulwalker-arm

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

2 years ago[compiler-rt] Disable coverage trace pc guard tests on Thumb
David Spickett [Mon, 28 Feb 2022 11:56:07 +0000 (11:56 +0000)]
[compiler-rt] Disable coverage trace pc guard tests on Thumb

These are failing on our silent bot:
https://lab.llvm.org/staging/#/builders/162/builds/358

$ <run cmd>
main
foo
bar
baz
SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard-dso.cpp.tmp.2122517.sancov: 2 PCs written
SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard-dso.cpp.tmp_2.so.2122517.sancov: 1 PCs written
SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard-dso.cpp.tmp_1.so.2122517.sancov: 1 PCs written
$ <sancov cmd>
ERROR: Coverage points in binary and .sancov file do not match.

Also reproduces if you build for Thumb on v8 hardware.

Doesn't fail when built with Arm only code so I guess the Thumb mode bit
in the PCs might be the issue.

2 years ago[mlir][linalg] Check the iterator types are valid.
gysit [Mon, 28 Feb 2022 11:25:12 +0000 (11:25 +0000)]
[mlir][linalg] Check the iterator types are valid.

Improve the LinalgOp verification to ensure the iterator types is known. Previously, unknown iterator types have been ignored without warning, which can lead to confusing bugs.

Reviewed By: nicolasvasilache

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

2 years ago[LV] Remove induction recipes only used outside vector loop.
Florian Hahn [Mon, 28 Feb 2022 11:14:21 +0000 (11:14 +0000)]
[LV] Remove induction recipes only used outside vector loop.

Exit values of vector inductions are generated completely independent of
the induction recipes. Consider them for removal, if they are not used
in loop.

This fixes a crash exposed by 49b23f451cf7130.

2 years agoPartially revert "[SchedModels][CortexA55] Add ASIMD integer instructions"
David Green [Mon, 28 Feb 2022 10:58:52 +0000 (10:58 +0000)]
Partially revert "[SchedModels][CortexA55] Add ASIMD integer instructions"

The Cortex-A55 scheduling model is used for -mcpu=generic, meaning it
can have a wider effect than just the A55. The changes to the A55
scheduling model seems to have caused performance regressions on
Cortex-A510 device which have latencies closer to the original and
different forwarding paths.

This partially reverts the changes from D117003, at least until we can
do something to improve Cortex-A510. According to my results, this
improves the A510 results without altering the A55 very much.

2 years ago[clang-format] Treat && followed by noexcept operator as a binary operator inside...
Luis Penagos [Mon, 28 Feb 2022 10:30:30 +0000 (11:30 +0100)]
[clang-format] Treat && followed by noexcept operator as a binary operator inside template arguments

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

Reviewed By: curdeius, MyDeveloperDay

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

2 years ago[mlir] Remove unused static variables (NFC)
Adrian Kuegel [Mon, 28 Feb 2022 10:52:39 +0000 (11:52 +0100)]
[mlir] Remove unused static variables (NFC)

2 years ago[LV] Add test with dead induction in vector loop used outside.
Florian Hahn [Mon, 28 Feb 2022 10:39:08 +0000 (10:39 +0000)]
[LV] Add test with dead induction in vector loop used outside.

Add test with a induction phi that is not used in the vector loop, but
by an lcssa phi in the loop exit.

2 years ago[analyzer] Add more sources to Taint analysis
Endre Fülöp [Mon, 21 Feb 2022 22:10:24 +0000 (23:10 +0100)]
[analyzer] Add more sources to Taint analysis

Add more functions as taint sources to GenericTaintChecker.

Reviewed By: steakhal

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

2 years ago[gn build] Port 61835d19a848
LLVM GN Syncbot [Mon, 28 Feb 2022 10:06:58 +0000 (10:06 +0000)]
[gn build] Port 61835d19a848

2 years ago[InstCombine] Remove not of SPF min/max fold (NFCI)
Nikita Popov [Thu, 24 Feb 2022 13:39:59 +0000 (14:39 +0100)]
[InstCombine] Remove not of SPF min/max fold (NFCI)

This should no longer be necessary now that we canonicalize to
intrinsics. Might not be strictly NFC due to worklist order.

2 years ago[llvm-objcopy] Initial XCOFF32 support.
esmeyi [Mon, 28 Feb 2022 09:59:46 +0000 (04:59 -0500)]
[llvm-objcopy] Initial XCOFF32 support.

Summary: This is an initial implementation of lvm-objcopy for XCOFF32.
Currently only supports simple copying, op-passthrough to follow.

Reviewed By: jhenderson, shchenz

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

2 years ago[InstCombine] Remove sub of SPF min/max fold (NFCI)
Nikita Popov [Thu, 24 Feb 2022 13:38:04 +0000 (14:38 +0100)]
[InstCombine] Remove sub of SPF min/max fold (NFCI)

This isn't necessary anymore, now that we canonicalize SPF min/max
to intrinsics. Might not be strictly NFC due to worklist order
changes.

2 years ago[LV] Add test with IV that needs scalar steps and user outside of loop.
Florian Hahn [Mon, 28 Feb 2022 09:46:18 +0000 (09:46 +0000)]
[LV] Add test with IV that needs scalar steps and user outside of loop.

Also add a run line to check interleaving only. This test covers the PPC
buildbot failures caused by 49b23f451cf71.

2 years ago[InstCombine] Don't call matchSAddSubSat() for SPF (NFC)
Nikita Popov [Mon, 28 Feb 2022 09:41:56 +0000 (10:41 +0100)]
[InstCombine] Don't call matchSAddSubSat() for SPF (NFC)

Only call it for intrinsic min/max. The moved implementation is
unchanged apart from the one-use check: It is now hardcoded to
one-use, without the two-use special case for SPF.

2 years ago[InstCombine] Remove SPF moveAddAfterMinMax() (NFC)
Nikita Popov [Mon, 28 Feb 2022 09:28:16 +0000 (10:28 +0100)]
[InstCombine] Remove SPF moveAddAfterMinMax() (NFC)

As SPF min/max is canonicalized to intrinsics before this point,
this change should be entirely NFC.

2 years ago[InstCombine] Remove SPF moveNotAfterMinMax() (NFC)
Nikita Popov [Thu, 24 Feb 2022 13:35:18 +0000 (14:35 +0100)]
[InstCombine] Remove SPF moveNotAfterMinMax() (NFC)

This happens after SPF -> intrinsic canonicalization, and as such
should be entirely NFC.

2 years ago[InstCombine] Remove SPF factorizeMinMaxTree() (NFC)
Nikita Popov [Thu, 24 Feb 2022 12:19:00 +0000 (13:19 +0100)]
[InstCombine] Remove SPF factorizeMinMaxTree() (NFC)

SPF integer min/max is canonicalized to min/max intrinsics before
this code is reached, so this should be entirely NFC.

2 years agoAdd explicit `this->` to access method in attempt to fix gcc5 build (NFC)
Mehdi Amini [Mon, 28 Feb 2022 08:54:38 +0000 (08:54 +0000)]
Add explicit `this->` to access method in attempt to fix gcc5 build (NFC)

2 years ago[mlir][OpenMP][NFC] Removing unnecessary builders for wsloop
Shraiysh Vaishay [Mon, 28 Feb 2022 08:38:31 +0000 (14:08 +0530)]
[mlir][OpenMP][NFC] Removing unnecessary builders for wsloop

This patch removes the builders for `omp.wsloop` operation that aren't
specifically needed anywhere. We can add them later if the need arises.

Reviewed By: kiranchandramohan

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

2 years ago[C++20][Modules][7/8] Find the primary interface name for a module.
Iain Sandoe [Sat, 1 May 2021 12:07:45 +0000 (13:07 +0100)]
[C++20][Modules][7/8] Find the primary interface name for a module.

When we are building modules, there are cases where the only way to determine
validity of access is by comparing primary interface names.  This is because we need
to be able to associate a primary interface name with an imported partition, but
before the primary interface module is complete - so that textual comparison is
necessary.

If this turns out to be needed many times, we could cache the result, but it seems
unlikely to be significant (at this time); cases with very many imported partitions
would seem unusual.

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

2 years ago[ELF] Replace an unneeded dyn_cast_or_null with dyn_cast. NFC
Fangrui Song [Mon, 28 Feb 2022 08:50:06 +0000 (00:50 -0800)]
[ELF] Replace an unneeded dyn_cast_or_null with dyn_cast. NFC

2 years ago[ELF] Optimize SectionBase::Kind values to make isa<InputSection> more efficient...
Fangrui Song [Mon, 28 Feb 2022 08:24:25 +0000 (00:24 -0800)]
[ELF] Optimize SectionBase::Kind values to make isa<InputSection> more efficient. NFC

Surprisingly my lld executable is 1.5KiB smaller.

2 years ago[ELF] Make InputSection::classof inline. NFC
Fangrui Song [Mon, 28 Feb 2022 08:16:45 +0000 (00:16 -0800)]
[ELF] Make InputSection::classof inline. NFC

2 years ago[mlir] Purge linalg.tiled_loop.
Alexander Belyaev [Mon, 28 Feb 2022 07:47:01 +0000 (08:47 +0100)]
[mlir] Purge linalg.tiled_loop.

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

2 years ago[ELF] Move SyntheticSection check from InputSection::writeTo to OutputSection::writeT...
Fangrui Song [Mon, 28 Feb 2022 07:28:51 +0000 (23:28 -0800)]
[ELF] Move SyntheticSection check from InputSection::writeTo to OutputSection::writeTo. NFC

Simplify code and make the heavyweight operation to the call site so that it is
clearer how to improve the inefficient scheduling in the future.

2 years agoSet error message if ValueObjectRegister fails to write back to register
Ilya Nozhkin [Mon, 28 Feb 2022 06:27:32 +0000 (14:27 +0800)]
Set error message if ValueObjectRegister fails to write back to register

SetValueFromCString and SetData methods return false if register can't
be written but they don't set a error message. It sometimes confuses
callers of these methods because they try to get the error message in case of
failure but Status::AsCString returns nullptr.

For example, lldb-vscode crashes due to this bug if some register can't
be written. It invokes SBError::GetCString in case of error and doesn't
check whether the result is nullptr (see request_setVariable implementation in
lldb-vscode.cpp for more info).

Reviewed By: labath, clayborg

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

2 years ago[RISCV] Support hypervisor extention instructions
eric.tang [Wed, 19 Jan 2022 02:44:23 +0000 (10:44 +0800)]
[RISCV] Support hypervisor extention instructions

    According to privileged spec version-20211203

    Add the following hypervisor instructions:
        - HLV.B HLV.BU
        - HLV.H HLV.HU HLVX.HU
        - HLV.W HLV.WU HLVX.WU
        - HLV.D
        - HSV.B HSV.H HSV.W HSV.D

Signed-off-by: eric.tang <eric.tang@starfivetech.com>
Differential Revision: https://reviews.llvm.org/D117733

2 years ago[RISCV] Support Sinval extension and hypervisor memory management fence instructions
eric.tang [Fri, 14 Jan 2022 07:14:16 +0000 (15:14 +0800)]
[RISCV] Support Sinval extension and hypervisor memory management fence instructions

    According to Privileged spec version-20211203

    Add Supervisor Memory-Management Instructions:
        - SINVAL.VMA, SFENCE.W.INVAL, SFENCE.INVAL.IR
    Add Hypervisor Memory-Management Instructions:
        - HFENCE.VVMA, HFENCE.GVMA, HINVAL.VVMA, HINVAL.GVMA

Signed-off-by: eric.tang <eric.tang@starfivetech.com>
Differential Revision: https://reviews.llvm.org/D117654

2 years ago[RISCV] Change GPRMemAtomic to GPRMemZeroOffset for general usage
Eric Tang [Thu, 17 Feb 2022 05:54:57 +0000 (13:54 +0800)]
[RISCV] Change GPRMemAtomic to GPRMemZeroOffset for general usage

    Not only some AMO instructions but also other instructions need to
    process (${gpr}) or 0(${gpr}), where the 0 is be silently ignored.

    This patch does some changes for general usage.

Signed-off-by: Eric Tang <eric.tang@starfivetech.com>
Differential Revision: https://reviews.llvm.org/D120017

2 years ago[Support] Fix the build errors because missing CSKYTargetParser.def in module.modulem...
Zi Xuan Wu [Mon, 28 Feb 2022 05:47:55 +0000 (13:47 +0800)]
[Support] Fix the build errors because missing CSKYTargetParser.def in module.modulemap of 21bce9007ae8

Add textual header "Support/CSKYTargetParser.def" in module.modulemap.

Build Failure: https://green.lab.llvm.org/green/job/lldb-cmake/41771

2 years ago[Support] Add CSKY target parser and attributes parser
Zi Xuan Wu [Tue, 15 Feb 2022 07:26:39 +0000 (15:26 +0800)]
[Support] Add CSKY target parser and attributes parser

Construct LLVM Support module about CSKY target parser and attribute parser.
It refers CSKY ABIv2 and implementation of GNU binutils and GCC.

https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf

Now we only support CSKY 800 series cpus and newer cpus in the future undering CSKYv2 ABI specification.
There are 11 archs including ck801, ck802, ck803, ck803s, ck804, ck805, ck807, ck810, ck810v, ck860, ck860v.

Every arch has base extensions, the cpus of that arch family have more extended extensions than base extensions.
We need specify extended extensions for every cpu. Every extension has its enum value, name and related llvm feature string with +/-.
Every enum value represents a bit of uint64_t integer.

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

2 years ago[RISCV] Optimize (sext.w, srli) to sraiw with Zba.
Chenbing Zheng [Mon, 28 Feb 2022 01:43:04 +0000 (09:43 +0800)]
[RISCV] Optimize (sext.w, srli) to sraiw with Zba.

In this patch, we add a more narrower exclusion for
zeroext (srl x) -> srli (slli x), so that it provides an opportunity
for the selection of sraiw.

Reviewed By: craig.topper

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

2 years ago[AIX][cmake][NFC] Customize name of output atomic library
Kai Luo [Mon, 28 Feb 2022 02:27:26 +0000 (02:27 +0000)]
[AIX][cmake][NFC] Customize name of output atomic library

Let `archive-aix-libatomic` accept additional argument to customize name of output atomic library.

Reviewed By: jsji

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

2 years ago[Driver][OpenBSD] Enable unwind tables on all architectures
Todd Mortimer [Mon, 28 Feb 2022 00:43:49 +0000 (19:43 -0500)]
[Driver][OpenBSD] Enable unwind tables on all architectures

2 years agoAdd explicit capture for `this` pointer in attempt to fix gcc5 build (NFC)
Mehdi Amini [Sun, 27 Feb 2022 21:41:23 +0000 (21:41 +0000)]
Add explicit capture for `this` pointer in attempt to fix gcc5 build (NFC)

2 years ago[ELF] Enforce double-dash form --error-limit
Fangrui Song [Sun, 27 Feb 2022 20:49:36 +0000 (20:49 +0000)]
[ELF] Enforce double-dash form --error-limit

It's ld.lld specific and by convention we enforce the double-dash form to avoid
collision with the short option -e (--entry).

2 years ago[RISCV] Fix parseBareSymbol to not double-parse top-level operators
Jessica Clarke [Sun, 27 Feb 2022 20:48:52 +0000 (20:48 +0000)]
[RISCV] Fix parseBareSymbol to not double-parse top-level operators

By failing to lex the token we end up both parsing it as a binary
operator ourselves and parsing it as a unary operator when calling
parseExpression on the RHS. For plus this is harmless but for minus this
parses "foo - 4" as "foo - -4", effectively treating a top-level minus
as a plus.

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

Reviewed By: asb, MaskRay

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

2 years ago[ELF] Use --error-limit instead of -error-limit
Fangrui Song [Sun, 27 Feb 2022 20:47:37 +0000 (20:47 +0000)]
[ELF] Use --error-limit instead of -error-limit

2 years ago[ELF] Change global variable backwardReferences to a LinkerDriver member variable...
Fangrui Song [Sun, 27 Feb 2022 20:33:28 +0000 (20:33 +0000)]
[ELF] Change global variable backwardReferences to a LinkerDriver member variable. NFC

Similar to whyExtract.

2 years ago[ELF] Move --print-archive-stats= and --why-extract= beside --warn-backrefs report
Fangrui Song [Sun, 27 Feb 2022 20:23:09 +0000 (20:23 +0000)]
[ELF] Move --print-archive-stats= and --why-extract= beside --warn-backrefs report

So that early errors don't suppress their output.

2 years ago[libcxx] [test] Fix one failing part of dsl.sh.py on Windows.
Martin Storsjö [Mon, 10 Jan 2022 23:08:19 +0000 (23:08 +0000)]
[libcxx] [test] Fix one failing part of dsl.sh.py on Windows.

Windows UCRT has got a bug in older versions (present in CI), where
it successfully does set a locale named
`for_sure_this_is_not_an_existing_locale`. By adjusting the tested
locale name to `forsurethisisnotanexistinglocale`, that test works
as expected, failing to set the locale.

The bug is reported upstream at
https://developercommunity.visualstudio.com/t/setlocale-succeeds-for-bogus-locale-names-in-older/1652241,
but as it already is working correctly in newer versions, no action
was prompted there.

We could of course add a bug detection in features.py like other
existing `broken-*` features, but that would seem kinda
pointless as it would be doing exactly what this test does.
Instead just adjust the tested dummy locale name.

This bit was approved to be committed on its own, in
https://reviews.llvm.org/D120546 (which is left open to follow up on
review of the rest of that patch).

2 years ago[libcxx] [test] Fix the monetary locale pos/neg_format test for Windows and macOS
Martin Storsjö [Tue, 18 Jan 2022 09:20:04 +0000 (09:20 +0000)]
[libcxx] [test] Fix the monetary locale pos/neg_format test for Windows and macOS

The zh_CN.UTF-8 locale on Glibc has got `n_sign_posn == 4` (which means
having the negative sign just after the currency symbol), but has
`int_n_sign_posn == 1` (which means before the string).

On Windows, there's no separate `int_n_sign_posn` field, so the same
`n_sign_posn` (which is 4 there too) is used for international currency
formatting too. This makes the ordering for the international case on
Windows be the same as for the national one right above it.

On Apple platforms, the fr_FR.UTF-8 locale has got `n_sign_posn == 2`
but `p_sign_posn == 1`, giving a different order for the French locale
for the negative format.

On Apple platforms for the zh_CN.UTF-8 locale, both `n_sign_posn` and
`int_n_sign_posn` are 4, but `p_sign_posn` and `int_p_sign_posn` are 1.

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

2 years ago[sancov] Add SPARC support for getPreviousInstructionPc
Xiaodong Liu [Sun, 27 Feb 2022 19:10:51 +0000 (19:10 +0000)]
[sancov] Add SPARC support for getPreviousInstructionPc

The SPARC and MIPS branching operations have a branch delay slot, 4 more bytes occupied.

Depends on D120381

Reviewed By: ro, MaskRay

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

2 years ago[SLP] Remove field unused after 33ce97f to silence buildbots [NFC]
Philip Reames [Sun, 27 Feb 2022 18:18:03 +0000 (10:18 -0800)]
[SLP] Remove field unused after 33ce97f to silence buildbots [NFC]

2 years agoRevert "[VPlan] Introduce recipe to build scalar steps."
Florian Hahn [Sun, 27 Feb 2022 17:51:19 +0000 (17:51 +0000)]
Revert "[VPlan] Introduce recipe to build scalar steps."

This reverts commit 49b23f451cf713036c99573a35daed308d2ac894.

This appears to break some PPC build bots. Revert while I investigate.

2 years ago[SLP] Use BatchAA to reduce capture analysis cost [NFC]
Philip Reames [Sun, 27 Feb 2022 17:44:11 +0000 (09:44 -0800)]
[SLP] Use BatchAA to reduce capture analysis cost [NFC]

SLP makes very heavy use of aliasing queries to construct pointer dependencies for scheduling purposes.  AA internally usings pointerMayBeCaptured to prove some noalias results.  In a local profile, we were spending about 4% of total O2 time in capture tracking.  By using BatchAA interface - which caches capture results - this drops to 2%.

Note that there is no invalidation of BatchAA here.  This assumes that no transformation done by SLP invalidates alias or capture results.  This is the same assumption made by the existing AliasCache, so this is not a new assumption in the code.

2 years ago[VPlan] Introduce recipe to build scalar steps.
Florian Hahn [Sun, 27 Feb 2022 17:32:41 +0000 (17:32 +0000)]
[VPlan] Introduce recipe to build scalar steps.

This patch adds a new VPScalarIVStepsRecipe to handle building scalar
steps.

In the first patch, it only handles the case where there is no vector
induction variable needed.

Reviewed By: Ayal

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

2 years ago[libc++] [test] Check the presence of "pragma include_instead" in newly added headers.
Arthur O'Dwyer [Sun, 27 Feb 2022 17:19:21 +0000 (12:19 -0500)]
[libc++] [test] Check the presence of "pragma include_instead" in newly added headers.

Unless/until we revert D106124, we should make sure that every newly added
detail header includes this line.

2 years ago[MLIR][Presburger] Move IntegerPolyhedron::reset to FlatAffineConstraints::reset
Groverkss [Sun, 27 Feb 2022 16:57:15 +0000 (22:27 +0530)]
[MLIR][Presburger] Move IntegerPolyhedron::reset to FlatAffineConstraints::reset

This patch moves IntegerPolyhedron::reset to FlatAffineConstraints::reset. This
function is not required in IntegerPolyhedron and creates ambiguity while
shifting implementations to IntegerRelation.

This patch is part of a series of patches to introduce relations in Presburger
library.

Reviewed By: arjunp

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

2 years ago[SDAG] fold (rotate X) eq/ne (0/-1)
Sanjay Patel [Sun, 27 Feb 2022 16:26:26 +0000 (11:26 -0500)]
[SDAG] fold (rotate X) eq/ne (0/-1)

This is the SDAG equivalent of an instcombine transform added with:
fd807601a78

This is another step towards solving #49541 and part of an alternative
set of more general transforms than what is proposed in D111530.

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

2 years ago[x86] add tests for setcc eq/ne 0/-1 of rotate; NFC
Sanjay Patel [Sun, 27 Feb 2022 15:44:02 +0000 (10:44 -0500)]
[x86] add tests for setcc eq/ne 0/-1 of rotate; NFC

The tests are adapted from a similar file for instcombine:
fd807601a78

2 years ago[X86][SSE] Attempt to lower vec_reduce_add patterns with PSADBW for zero-extended...
Simon Pilgrim [Sun, 27 Feb 2022 15:17:42 +0000 (15:17 +0000)]
[X86][SSE] Attempt to lower vec_reduce_add patterns with PSADBW for zero-extended vXi8 sources

For i16/32/64 vectors, if the upper bits are known to be zero, then we can try to truncate to vXi8 (if its worth it) and perform this as a PSADBW to add+zext each v4i8 subvector to a i64 sum, which we can then reduce together.

This addresses some of the PR42674 test cases where the source data was vXi8 but had been extended to match a wider unsigned integer accumulator.

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

2 years ago[SDAG] fold bitwise logic with shifted operands
Sanjay Patel [Sun, 27 Feb 2022 13:33:43 +0000 (08:33 -0500)]
[SDAG] fold bitwise logic with shifted operands

LOGIC (LOGIC (SH X0, Y), Z), (SH X1, Y) --> LOGIC (SH (LOGIC X0, X1), Y), Z

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

This is a reassociation + factoring fold. The common shift operation is moved
after a bitwise logic op on 2 input operands.
We get simpler cases of these patterns in IR, but I suspect we would miss all
of these exact tests in IR too. We also handle the simpler form of this plus
several other folds in DAGCombiner::hoistLogicOpWithSameOpcodeHands().

This is a partial implementation of a transform suggested in D111530
(only handles 'or' bitwise logic as a first step - need to stamp out more
tests for other opcodes).
Several of the same tests added for D111530 are altered here (but not
fully optimized). I'm not sure yet if this would help/hinder that patch,
but this should be an improvement for all tests added with ecf606cb4329ae
since it removes a shift operation in those examples.

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

2 years agoRevert "[Support] Reset option to its default if its Default field is undefined"
Yevgeny Rouban [Sun, 27 Feb 2022 14:46:10 +0000 (21:46 +0700)]
Revert "[Support] Reset option to its default if its Default field is undefined"

This reverts commit 7fb39fb6d6665cd469557b43eb205cc32b0a7ac3 as clang buildbots failed.

2 years ago[Support] Reset option to its default if its Default field is undefined
Yevgeny Rouban [Sun, 27 Feb 2022 12:56:31 +0000 (19:56 +0700)]
[Support] Reset option to its default if its Default field is undefined

opt::setDefaultImpl() is changed to set the option value to the option
type's default if the Default field is not set. This results in option
value reset by Option::reset() or ResetAllOptionOccurrences() even if
the cl::init() is not specified.

Example:
  StackOption<std::string> Str("str"); // No cl::init().
  Str = "some value";
  cl::ResetAllOptionOccurrences();
  EXPECT_EQ("", Str); // The Str is reset.

Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D115433

2 years ago[VPlan] Add recipe to handle SCEV expansion (NFC).
Florian Hahn [Sun, 27 Feb 2022 12:44:07 +0000 (12:44 +0000)]
[VPlan] Add recipe to handle SCEV expansion (NFC).

This can be used to explicitly model VPValues that depend on SCEV
expansion, like the step for inductions.

Reviewed By: Ayal

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

2 years ago[lldb] BreakpointOptions::CommandData::CreateFromStructuredData - remove dead code...
Simon Pilgrim [Sun, 27 Feb 2022 11:33:14 +0000 (11:33 +0000)]
[lldb] BreakpointOptions::CommandData::CreateFromStructuredData - remove dead code + variable. NFCI.

The found_something bool is only ever read after it has always been set to true.

Looks to be a leftover debugging variable.

Fixes static analyzer warning: https://llvm.org/reports/scan-build/report-BreakpointOptions.cpp-CreateFromStructuredData-8-4055b9.html#EndPath

2 years ago[DAG] Ensure type is legal for bswap(shl(x,c)) -> zext(bswap(trunc(shl(x,c-bw/2)...
Simon Pilgrim [Sun, 27 Feb 2022 11:25:17 +0000 (11:25 +0000)]
[DAG] Ensure type is legal for bswap(shl(x,c)) -> zext(bswap(trunc(shl(x,c-bw/2)))) fold

As reported on D120192

2 years ago[C++20][Modules][6/8] Record direct module imports.
Iain Sandoe [Sun, 30 Jan 2022 14:26:57 +0000 (14:26 +0000)]
[C++20][Modules][6/8] Record direct module imports.

This is a small cache to avoid having to check both Exports and
Imports.

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

2 years ago[AMDGPU] Remove redundant isVALU in SIPreEmitPeephole. NFC
Carl Ritson [Sun, 27 Feb 2022 04:23:22 +0000 (13:23 +0900)]
[AMDGPU] Remove redundant isVALU in SIPreEmitPeephole. NFC

Remove redundant isVALU call added in D120202.

2 years ago[ELF] BitcodeFile: resolve defined symbols before undefined symbols
Fangrui Song [Sun, 27 Feb 2022 05:37:08 +0000 (05:37 +0000)]
[ELF] BitcodeFile: resolve defined symbols before undefined symbols

This ports D95985 for ELF relocatable object files to BitcodeFile.

2 years ago[ConstantFolding] Fix folding of constrained compare intrinsics
Serge Pavlov [Sat, 26 Feb 2022 16:39:12 +0000 (23:39 +0700)]
[ConstantFolding] Fix folding of constrained compare intrinsics

The change fixes treatment of constrained compare intrinsics if
compared values are of vector type.

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

2 years ago[bazel] Port g95b4e88b1db3
Benjamin Kramer [Sat, 26 Feb 2022 23:11:42 +0000 (00:11 +0100)]
[bazel] Port g95b4e88b1db3

2 years ago[clang] MarkVarDeclODRUsed - remove redundant nullptr check. NFCI.
Simon Pilgrim [Sat, 26 Feb 2022 21:24:15 +0000 (21:24 +0000)]
[clang] MarkVarDeclODRUsed - remove redundant nullptr check. NFCI.

The function has already been dereferenced the Var pointer

2 years ago[clangd] Test fixes missing from 257559ed9
Sam McCall [Sat, 26 Feb 2022 20:38:25 +0000 (21:38 +0100)]
[clangd] Test fixes missing from 257559ed9

2 years ago[clangd] Function return type hints: support lambdas, don't duplicate "->"
Sam McCall [Wed, 23 Feb 2022 15:59:19 +0000 (16:59 +0100)]
[clangd] Function return type hints: support lambdas, don't duplicate "->"

While here, fix an ugliness:
  auto foo()->auto { return 42; }
This (silly) code gains a "-> int" hint. While correct and useful, it renders as
  auto foo()->int->auto { return 42; }
which is confusing enough to do more harm than good I think.

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

2 years ago[clang-format][NFC] Rename test and remove comments
Björn Schäpers [Wed, 23 Feb 2022 06:07:13 +0000 (07:07 +0100)]
[clang-format][NFC] Rename test and remove comments

Why put "InMacros" in the name? We test other things to, and I will add
more, withut macros.

Also all our tests are regression tests.

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

2 years ago[clang-format][NFC] Remove redundant semi
Björn Schäpers [Tue, 22 Feb 2022 22:26:17 +0000 (23:26 +0100)]
[clang-format][NFC] Remove redundant semi

All "calls" have a semi, as they should, remove the one from the macro.

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

2 years agoUse RegisterInfo::regsOverlaps instead of checking aliases
Benjamin Kramer [Sat, 26 Feb 2022 19:29:16 +0000 (20:29 +0100)]
Use RegisterInfo::regsOverlaps instead of checking aliases

This is both less code and faster since it doesn't have to expand all
the sub & superreg sets. NFCI.

2 years ago[PDLL] Properly error out on returning results from native constraints
River Riddle [Mon, 14 Feb 2022 21:39:06 +0000 (13:39 -0800)]
[PDLL] Properly error out on returning results from native constraints

PDL currently doesn't support result values from constraints, meaning we need
to error out until this is actually supported to avoid crashes.

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

2 years ago[mlir:PDLL] Add support for C++ generation
River Riddle [Mon, 14 Feb 2022 07:51:52 +0000 (23:51 -0800)]
[mlir:PDLL] Add support for C++ generation

This commits adds a C++ generator to PDLL that generates wrapper PDL patterns
directly usable in C++ code, and also generates the definitions of native constraints/rewrites
that have code bodies specified in PDLL. This generator is effectively the PDLL equivalent of
the current DRR generator, and will allow easy replacement of DRR patterns with PDLL patterns.
A followup will start to utilize this for end-to-end integration testing and show case how to
use this as a drop-in replacement for DRR tablegen usage.

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

2 years ago[mlir:PDLL] Fix handling of unspecified operands/results on operation expressions
River Riddle [Mon, 14 Feb 2022 07:51:46 +0000 (23:51 -0800)]
[mlir:PDLL] Fix handling of unspecified operands/results on operation expressions

If the operand list or result list of an operation expression is not specified, we interpret
this as meaning that the operands/results are "unconstraint" (i.e. "could be anything").
We currently don't properly handle differentiating this case from the case of
"no operands/results". This commit adds the insertion of implicit value/type range
variables when these lists are unspecified. This allows for adding proper support
for when zero operands or results are expected.

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

2 years ago[mlir:PDLL] Add support for PDL MLIR code generation
River Riddle [Mon, 14 Feb 2022 07:51:21 +0000 (23:51 -0800)]
[mlir:PDLL] Add support for PDL MLIR code generation

This commits starts to plumb PDLL down into MLIR and adds an initial
PDL generator. After this commit, we will have conceptually support
end-to-end execution of PDLL. Followups will add CPP generation to
match the current DRR setup, and begin to add various end-to-end
tests to test PDLL execution.

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

2 years ago[AArch64] Cleanup and extend cast costs. NFC
David Green [Sat, 26 Feb 2022 17:59:02 +0000 (17:59 +0000)]
[AArch64] Cleanup and extend cast costs. NFC

2 years ago[libc++] [test] Re-remove C++ comments from generated files.
Arthur O'Dwyer [Sat, 26 Feb 2022 17:44:26 +0000 (12:44 -0500)]
[libc++] [test] Re-remove C++ comments from generated files.

A merge conflict in D106124 accidentally reverted this part of
b82683b2e/D110794.

> Even if these comments have a benefit in .h files (for editors that
> care about language but can't be configured to treat .h as C++ code),
> they certainly have no benefit for files with the .cpp extension.

2 years ago[libcxx] [test] Remove an incorrect XFAIL, fix CI on main
Martin Storsjö [Sat, 26 Feb 2022 17:28:16 +0000 (12:28 -0500)]
[libcxx] [test] Remove an incorrect XFAIL, fix CI on main

9f5f084 (D119770) made this test pass in the Windows configuration too,
but didn't update the XFAIL accordingly.

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

2 years ago[MLIR][Presburger] Remove redundant check from hasConsistentState
Groverkss [Sat, 26 Feb 2022 16:32:12 +0000 (22:02 +0530)]
[MLIR][Presburger] Remove redundant check from hasConsistentState

This patch removes a redundant check in hasConsistentState which is always true
after introduction of PresburgerSpace.

Reviewed By: arjunp

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

2 years ago[VPlan] Remove dead header-phi recipes.
Florian Hahn [Sat, 26 Feb 2022 16:24:25 +0000 (16:24 +0000)]
[VPlan] Remove dead header-phi recipes.

This patch adds a new transform to remove dead recipes. For now, it only
removes dead recipes in the header, to keep the number tests that require
updating manageable. Future patches will extend this to remove dead
recipes across the whole plan.

Reviewed By: Ayal

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

2 years ago[gn build] (manually) port 2e6ae1d3f2de more
Nico Weber [Sat, 26 Feb 2022 15:46:20 +0000 (10:46 -0500)]
[gn build] (manually) port 2e6ae1d3f2de more

b85f97bc00ae7 missed one file.

With this, all files listed in libcxx/include/CMakeLists.txt are
listed in this BUILD.gn file again.

2 years ago[gn build] (manually) port 01ace074fcb6 more
Nico Weber [Sat, 26 Feb 2022 15:43:11 +0000 (10:43 -0500)]
[gn build] (manually) port 01ace074fcb6 more

410d4492e395a only hit half the added files.

2 years ago[gn build] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER when building libcxx
Nico Weber [Sat, 26 Feb 2022 15:24:48 +0000 (10:24 -0500)]
[gn build] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER when building libcxx

Ports 87a82490fc6b89fd3 in a way. Has the effect of enabling warnings
when building libcxx itself, but more importantly this is required
after 5aaefa510ef0 to not get build errors when building libcxx itself.

2 years ago[LV] Add test with redundant cast in separate latch block.
Florian Hahn [Sat, 26 Feb 2022 14:48:45 +0000 (14:48 +0000)]
[LV] Add test with redundant cast in separate latch block.

Adds another interesting test for D118051.

2 years ago[clangd] Support IncludeFixer or base specifiers
Sam McCall [Sat, 26 Feb 2022 14:35:01 +0000 (15:35 +0100)]
[clangd] Support IncludeFixer or base specifiers

2 years agoRevert "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON"
Nikita Popov [Sat, 26 Feb 2022 14:19:45 +0000 (15:19 +0100)]
Revert "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON"

See post-commit discussion on https://reviews.llvm.org/D120305.
This change breaks the clang-ppc64le-rhel buildbot, though
there is suspicion that it's an issue with the bot. The change
also had a larger than expected impact on compile-time and
code-size.

This reverts commit 3c4ed02698afec021c6bca80740d1e58e3ee019e
and some followup changes.

2 years ago[MLIR][Presburger] Move IdKind specific insert/append
Groverkss [Sat, 26 Feb 2022 13:24:19 +0000 (18:54 +0530)]
[MLIR][Presburger] Move IdKind specific insert/append

This patch moves identifier kind specific insert/append functions like
`insertDimId`, `appendSymbolId`, etc. from IntegerPolyhedron to
FlatAffineConstraints.

This change allows for a smoother transition to IntegerRelation.

This change is part of a series of patches to introduce Relations in Presburger
library.

Reviewed By: arjunp

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

2 years ago[clangd] Fix wrong included header. NFC
Sam McCall [Sat, 26 Feb 2022 13:21:52 +0000 (14:21 +0100)]
[clangd] Fix wrong included header. NFC

2 years ago[clangd] Fix include-cleaner false-positive bug
Sam McCall [Sat, 26 Feb 2022 13:08:12 +0000 (14:08 +0100)]
[clangd] Fix include-cleaner false-positive bug

For TemplateSpecializationType, we were checking the node's newness
twice, so it always failed the second test.

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

2 years ago[clangd] Qualify calls to std::move to silence -Wunqualified-std-cast-call. NFC.
Benjamin Kramer [Sat, 26 Feb 2022 12:34:35 +0000 (13:34 +0100)]
[clangd] Qualify calls to std::move to silence -Wunqualified-std-cast-call. NFC.

2 years ago[MLIR][Presburger] Factor out various Space equality checks to PresburgerSpace::isEqual
Groverkss [Sat, 26 Feb 2022 10:57:22 +0000 (16:27 +0530)]
[MLIR][Presburger] Factor out various Space equality checks to PresburgerSpace::isEqual

This patch factors out various checks for dimension compatibility to
PresburgerSpace::isEqual and PresburgerLocalSpace::isEqual (for local
identifiers).

Reviewed By: arjunp

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

2 years ago[MLIR][Presburger] coalesce: add assert noting that locals are not yet supported
Arjun P [Sat, 26 Feb 2022 12:21:47 +0000 (12:21 +0000)]
[MLIR][Presburger] coalesce: add assert noting that locals are not yet supported

2 years ago[libc++] Remove recursion in basic_string::insert(const_iterator, ForwardIterator...
Nikolas Klauser [Sat, 26 Feb 2022 12:28:33 +0000 (13:28 +0100)]
[libc++] Remove recursion in basic_string::insert(const_iterator, ForwardIterator, ForwardIterator)

`__addr_in_range` is a non-constexpr function, so we can't call it during constant evaluation.

Reviewed By: Quuxplusone, #libc, miscco

Spies: miscco, libcxx-commits

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

2 years ago[clangd] Add a missing include. NFC.
Benjamin Kramer [Sat, 26 Feb 2022 12:23:06 +0000 (13:23 +0100)]
[clangd] Add a missing include. NFC.

2 years ago[C++20][Modules][5/8] Diagnose wrong import/export for partition CMIs.
Iain Sandoe [Sun, 30 Jan 2022 14:11:57 +0000 (14:11 +0000)]
[C++20][Modules][5/8] Diagnose wrong import/export for partition CMIs.

We cannot export partition implementation CMIs, but we can export the content
of partition interface CMIs.

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

2 years ago[clangd] Clean up unused includes. NFCI
Sam McCall [Sat, 26 Feb 2022 10:40:12 +0000 (11:40 +0100)]
[clangd] Clean up unused includes. NFCI

Add includes where needed to fix build.
Haven't systematically added used headers, so there is still accidental
dependency on transitive includes.