platform/upstream/llvm.git
2 years ago[lldb] Use the debugger's asynchronous output stream for progress events.
Jonas Devlieghere [Mon, 14 Mar 2022 17:22:04 +0000 (10:22 -0700)]
[lldb] Use the debugger's asynchronous output stream for progress events.

Use the debugger's asynchronous output stream for printing progress
events. This allows the active IOHandler to be in charge of printing
them and doing the necessary synchronization.

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

2 years ago[AArch64] Perform last active true vector combine
zhongyunde [Mon, 14 Mar 2022 17:19:39 +0000 (01:19 +0800)]
[AArch64] Perform last active true vector combine

Test bit of lane EC-1 can use P register directly, eg:
Materialize : Idx = (add (mul vscale, NumEls), -1)
               i1 = extract_vector_elt t37, Constant:i64<Idx>
    ... into: "ptrue p, all" + PTEST

Reviewed By: paulwalker-arm

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

2 years ago[clang][dataflow] Add support for nested composite bool expressions
Stanislav Gatev [Fri, 11 Mar 2022 11:52:53 +0000 (11:52 +0000)]
[clang][dataflow] Add support for nested composite bool expressions

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

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

2 years ago[WebAssembly] Remove unused method from WebAssemblyTargetStreamer. NFC
Sam Clegg [Sun, 13 Mar 2022 05:11:56 +0000 (21:11 -0800)]
[WebAssembly] Remove unused method from WebAssemblyTargetStreamer. NFC

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

2 years ago[WPD] Extend checking mode to support fallback to indirect call
Teresa Johnson [Thu, 10 Mar 2022 22:17:53 +0000 (14:17 -0800)]
[WPD] Extend checking mode to support fallback to indirect call

Extend -wholeprogramdevirt-check to support both the existing
trapping mode on an incorrect devirtualization, as well as a new
mode to fallback to an indirect call on a mismatch. The new mode is

The new mode is useful in cases where we want to enable
devirtualization but cannot fully guarantee whole program visibility
(e.g in the case where LTO has been disabled for a small set of objects
that could potentially override virtual methods without having a symbol
reference to anything in the base class including the vtable).

Remove !prof and !callees metadata (which are used by indirect call
promotion) from both the new direct call and the fallback indirect call
(so that we don't perform another round of promotion on the latter).
Also remove it from the direct call in the non-fallback cases, which
was an oversight, although it didn't seem to cause any issues. Add tests
for the metadata removal covering the various cases.

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

2 years ago[flang] Lower format statement
Valentin Clement [Mon, 14 Mar 2022 17:15:16 +0000 (18:15 +0100)]
[flang] Lower format statement

This patch lowers the format statement.

Reviewed By: PeteSteinfeld

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

2 years ago[llvm] Fix warning: missing submodule 'LLVM_Analysis.ScalarFuncs'
Jonas Devlieghere [Mon, 14 Mar 2022 16:47:39 +0000 (09:47 -0700)]
[llvm] Fix warning: missing submodule 'LLVM_Analysis.ScalarFuncs'

2 years ago[lldb] Use the IOHandler's stream instead of the debugger's in PrintAsync
Jonas Devlieghere [Mon, 14 Mar 2022 16:26:39 +0000 (09:26 -0700)]
[lldb] Use the IOHandler's stream instead of the debugger's in PrintAsync

PrintAsync is relying on the IOHandler to print to the output/error
stream. In that context it doesn't make much sense that this is using
the debugger's streams rather than the one from the IOHandler.

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

2 years ago[OpaquePtr][AArch64] Use elementtype on ldxr/stxr
Arthur Eubanks [Thu, 24 Feb 2022 23:51:00 +0000 (15:51 -0800)]
[OpaquePtr][AArch64] Use elementtype on ldxr/stxr

Includes verifier changes checking the elementtype, clang codegen
changes to emit the elementtype, and ISel changes using the elementtype.

Reviewed By: #opaque-pointers, nikic

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

2 years ago[flang] Lower common block
Valentin Clement [Mon, 14 Mar 2022 17:03:50 +0000 (18:03 +0100)]
[flang] Lower common block

This patch lowers common block variable to FIR.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[DFSan] Remove use of setarch in dfsan test.
Andrew Browne [Fri, 11 Mar 2022 02:58:17 +0000 (18:58 -0800)]
[DFSan] Remove use of setarch in dfsan test.

Use of setarch Was added by
https://github.com/llvm/llvm-project/commit/f93c2b64ed381bc4bc52f4b8539026f1597f574d

Running the test now it doesn't seem necessary because:

1) Explicitly only x86_64 is supported for dfsan.

2) https://reviews.llvm.org/D111522 makes it less flakey.

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

2 years ago[IROutliner] Avoid reusing PHINodes that have already been matched when merging outli...
Andrew Litteken [Wed, 9 Mar 2022 18:33:33 +0000 (10:33 -0800)]
[IROutliner] Avoid reusing PHINodes that have already been matched when merging outlined functions' phi node blocks

When there are two external phi nodes for two different outlined regions, when compressing the created phi nodes between the two regions, the matching for the second phi node in the second region matches the first phi node created for the first region rather than the second phi node created for the first region. This adds an extra output path where there should not be one.

The fix is the ignore phi nodes that have already been matched for each region.

Reviewer: paquette

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

2 years ago[gn build] Port 5e65e79bace6
LLVM GN Syncbot [Mon, 14 Mar 2022 16:52:53 +0000 (16:52 +0000)]
[gn build] Port 5e65e79bace6

2 years ago[flang] Lower all intrinsic
Valentin Clement [Mon, 14 Mar 2022 16:40:47 +0000 (17:40 +0100)]
[flang] Lower all intrinsic

Lower the `all` intrinsic procedure.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years agoFix the implicit module build (2/2)
Jonas Devlieghere [Mon, 14 Mar 2022 16:40:24 +0000 (09:40 -0700)]
Fix the implicit module build (2/2)

This fixes the implicit module build after b1b4b6f36695 broke the LLDB
build: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/42084/

My previous commit didn't have the modulemap change staged.

2 years ago[NewPM] Actually recompute GlobalsAA before module optimization pipeline
Arthur Eubanks [Sat, 5 Mar 2022 23:06:08 +0000 (15:06 -0800)]
[NewPM] Actually recompute GlobalsAA before module optimization pipeline

RequireAnalysis<GlobalsAA> doesn't actually recompute GlobalsAA.
GlobalsAA isn't invalidated (unless specifically invalidated) because
it's self-updating via ValueHandles, but can be imprecise during the
self-updates.

Rather than invalidating GlobalsAA, which would invalidate AAManager and
any analyses that use AAManager, create a new pass that recomputes
GlobalsAA.

Fixes #53131.

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

2 years ago[test] Add phase ordering test
Arthur Eubanks [Sat, 5 Mar 2022 23:20:24 +0000 (15:20 -0800)]
[test] Add phase ordering test

2 years ago[flang] Lower elemental calls
Valentin Clement [Mon, 14 Mar 2022 16:38:47 +0000 (17:38 +0100)]
[flang] Lower elemental calls

This patch adds more lowering of operations sub-expression inside elemental call arguments.
It tests array contexts where an address is needed for each element (for
the argument), but part of the array sub-expression must be lowered by value
(for the operation)

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[ValueTracking] Simplify llvm::isPointerOffset()
Arthur Eubanks [Thu, 24 Feb 2022 23:30:23 +0000 (15:30 -0800)]
[ValueTracking] Simplify llvm::isPointerOffset()

We still need the code after stripAndAccumulateConstantOffsets() since
it doesn't handle GEPs of scalable types and non-constant but identical
indexes.

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

2 years agoFix issing header on z/OS
serge-sans-paille [Mon, 14 Mar 2022 16:28:38 +0000 (17:28 +0100)]
Fix issing header on z/OS

Bug introduced in fbbc41f8dd23

2 years ago[lldb] Skip Test11588 on Windows
Stella Stamenova [Mon, 14 Mar 2022 16:26:41 +0000 (09:26 -0700)]
[lldb] Skip Test11588 on Windows

The test was marked as XFAIL on Windows, but recent changes have made it flaky instead

2 years agoFix the implicit module build
Jonas Devlieghere [Mon, 14 Mar 2022 16:22:30 +0000 (09:22 -0700)]
Fix the implicit module build

This fixes the implicit module build after b1b4b6f36695 broke the LLDB
build: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/42084/

2 years ago[lldb] Move ProgressEventData out of debugger and into its own file (NFC)
Jonas Devlieghere [Mon, 14 Mar 2022 16:01:53 +0000 (09:01 -0700)]
[lldb] Move ProgressEventData out of debugger and into its own file (NFC)

Move ProgressEventData out of debugger and into its own file. This is in
preparation of adding a few new type of event data for diagnostics.

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

2 years ago[TLI] Check that malloc argument has type size_t
Nikita Popov [Mon, 14 Mar 2022 16:14:16 +0000 (17:14 +0100)]
[TLI] Check that malloc argument has type size_t

DSE assumes that this is the case when forming a calloc from a
malloc + memset pair.

For tests, either update the malloc signature or change the
data layout.

2 years ago[mlir][vector] Implement unrolling of ReductionOp
Matthias Springer [Mon, 14 Mar 2022 16:05:32 +0000 (01:05 +0900)]
[mlir][vector] Implement unrolling of ReductionOp

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

2 years ago[WebAssembly] Rename member in WasmYAML.h to avoid compiler warning
Sam Clegg [Mon, 14 Mar 2022 16:07:48 +0000 (09:07 -0700)]
[WebAssembly] Rename member in WasmYAML.h to avoid compiler warning

Followup/fix for https://reviews.llvm.org/D121349.

2 years agoclang-tidy: discover binaries in build dir
Keith Smiley [Sun, 13 Mar 2022 17:02:02 +0000 (10:02 -0700)]
clang-tidy: discover binaries in build dir

This changes the clang-tidy script to discover binaries you've built
locally without having to pass them.

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

2 years ago[WebAssembly] Second phase of implemented extended const proposal
Sam Clegg [Thu, 10 Mar 2022 02:11:44 +0000 (18:11 -0800)]
[WebAssembly] Second phase of implemented extended const proposal

This change continues to lay the ground work for supporting extended
const expressions in the linker.

The included test covers object file reading and writing and the YAML
representation.

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

2 years ago[SLPVectorizer] Handle external load/store pointer uses with opaque pointers
Nikita Popov [Mon, 14 Mar 2022 15:54:07 +0000 (16:54 +0100)]
[SLPVectorizer] Handle external load/store pointer uses with opaque pointers

In this case we may not generate a bitcast, so the new load/store
becomes the external user.

2 years ago[lldb] Require native for command-thread-siginfo.test
Ayush Sahay [Mon, 14 Mar 2022 15:25:13 +0000 (20:55 +0530)]
[lldb] Require native for command-thread-siginfo.test

command-thread-siginfo.test employs a subject with a call to wait, and
thus requires system-linux. However, it's possible to target non-Linux
platforms despite operating on Linux hosts. So, have it require native
too.

Reviewed By: mgorny, labath

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

2 years ago[LV] Remove dead Loop argument from emitMinimumVector... (NFC)
Florian Hahn [Mon, 14 Mar 2022 15:47:40 +0000 (15:47 +0000)]
[LV] Remove dead Loop argument from emitMinimumVector... (NFC)

The argument is not used, remove it.

2 years ago[polly] Introduce -polly-print-* passes to replace -analyze.
Michael Kruse [Mon, 14 Mar 2022 13:39:25 +0000 (08:39 -0500)]
[polly] Introduce -polly-print-* passes to replace -analyze.

The `opt -analyze` option only works with the legacy pass manager and might be removed in the future, as explained in llvm.org/PR53733. This patch introduced -polly-print-* passes that print what the pass would print with the `-analyze` option and replaces all uses of `-analyze` in the regression tests.

There are two exceptions: `CodeGen\single_loop_param_less_equal.ll` and `CodeGen\loop_with_condition_nested.ll` use `-analyze on the `-loops` pass which is not part of Polly.

Reviewed By: aeubanks

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

2 years ago[mlir][vector] Add unrolling pattern for multidim_reduce op
Thomas Raoux [Wed, 9 Mar 2022 00:08:11 +0000 (00:08 +0000)]
[mlir][vector] Add unrolling pattern for multidim_reduce op

Implement the vectorLoopUnroll interface for MultiDimReduceOp and add a
pattern to do the unrolling following the same interface other vector
unroll patterns.

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

2 years ago[Verifier] Verify llvm.access.group metadata
Nikita Popov [Mon, 14 Mar 2022 14:36:32 +0000 (15:36 +0100)]
[Verifier] Verify llvm.access.group metadata

According to LangRef, an access scope must have zero operands and
be distinct. The access group may either be a single access scope
or a list of access scopes.

LoopInfo may assert if this is not the case.

2 years ago[PowerPC] Add missed VSX shuffles instead of Altivec ones
Nemanja Ivanovic [Fri, 11 Mar 2022 17:19:20 +0000 (11:19 -0600)]
[PowerPC] Add missed VSX shuffles instead of Altivec ones

VSX introduced some permute instructions that are direct
replacements for Altivec ones except they can target all
the VSX registers. We have added code generation for most
of these but somehow missed the low/hi word merges (XXMRG[LH]W).
This caused some additional spills on some large
computationally intensive code.

This patch simply adds the missed patterns.

2 years agoRevert "[clang-format] Correctly format variable templates."
Marek Kurdej [Mon, 14 Mar 2022 15:01:24 +0000 (16:01 +0100)]
Revert "[clang-format] Correctly format variable templates."

This reverts commit a140b7104fdae0d9eff5b18efbc784754e0ca274.

It provoked the bug https://github.com/llvm/llvm-project/issues/54374.

2 years ago[VE] v256f32|64 fma isel
Simon Moll [Mon, 14 Mar 2022 13:32:19 +0000 (14:32 +0100)]
[VE] v256f32|64 fma isel

llvm.fma|fmuladd vp.fma isel and tests

Reviewed By: kaz7

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

2 years ago[lld-link] Tweak winsysroottest.test to have passing links on happy path
Nico Weber [Sun, 13 Mar 2022 14:35:38 +0000 (10:35 -0400)]
[lld-link] Tweak winsysroottest.test to have passing links on happy path

Previously, the test checked for a "undefined symbol" error
(instead of the "could not open std*.lib" which would happen without
the flag).

Instead, use /entry: so that the link succeeds.

No behavior change, but maybe makes the test a bit easier to understand.

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

2 years agoSilence -Wlogical-op-parentheses and fix a logic bug while doing so
Aaron Ballman [Mon, 14 Mar 2022 14:13:01 +0000 (10:13 -0400)]
Silence -Wlogical-op-parentheses and fix a logic bug while doing so

2 years ago[libc] Include -150 to the special cases at the beginning of exp2f function.
Tue Ly [Mon, 14 Mar 2022 14:04:39 +0000 (10:04 -0400)]
[libc] Include -150 to the special cases at the beginning of exp2f function.

2 years ago[SCCP][IR] Landing pads are not safe to remove
Nikita Popov [Mon, 14 Mar 2022 13:34:01 +0000 (14:34 +0100)]
[SCCP][IR] Landing pads are not safe to remove

For landingpads with {} type, SCCP ended up dropping them, because
we considered them as safe to remove.

2 years ago[libc] Implement exp2f function that is correctly rounded for all rounding modes.
Tue Ly [Fri, 11 Mar 2022 15:08:47 +0000 (10:08 -0500)]
[libc] Implement exp2f function that is correctly rounded for all rounding modes.

Implement exp2f function that is correctly rounded for all rounding modes.

Reviewed By: sivachandra, zimmermann6

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

2 years agoImplement literal suffixes for _BitInt
Aaron Ballman [Mon, 14 Mar 2022 13:22:37 +0000 (09:22 -0400)]
Implement literal suffixes for _BitInt

WG14 adopted N2775 (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2775.pdf)
at our Feb 2022 meeting. This paper adds a literal suffix for
bit-precise types that automatically sizes the bit-precise type to be
the smallest possible legal _BitInt type that can represent the literal
value. The suffix chosen is wb (for a signed bit-precise type) which
can be combined with the u suffix (for an unsigned bit-precise type).

The preprocessor continues to operate as-if all integer types were
intmax_t/uintmax_t, including bit-precise integer types. It is a
constraint violation if the bit-precise literal is too large to fit
within that type in the context of the preprocessor (when still using
a pp-number preprocessing token), but it is not a constraint violation
in other circumstances. This allows you to make bit-precise integer
literals that are wider than what the preprocessor currently supports
in order to initialize variables, etc.

2 years agoHave cpu-specific variants set 'tune-cpu' as an optimization hint
Erich Keane [Thu, 10 Mar 2022 21:31:52 +0000 (13:31 -0800)]
Have cpu-specific variants set 'tune-cpu' as an optimization hint

Due to various implementation constraints, despite the programmer
choosing a 'processor' cpu_dispatch/cpu_specific needs to use the
'feature' list of a processor to identify it. This results in the
identified processor in source-code not being propogated to the
optimizer, and thus, not able to be tuned for.

This patch changes to use the actual cpu as written for tune-cpu so that
opt can make decisions based on the cpu-as-spelled, which should better
match the behavior expected by the programmer.

Note that the 'valid' list of processors for x86 is in
llvm/include/llvm/Support/X86TargetParser.def. At the moment, this list
contains only Intel processors, but other vendors may wish to add their
own entries as 'alias'es (or with different feature lists!).

If this is not done, there is two potential performance issues with the
patch, but I believe them to be worth it in light of the improvements to
behavior and performance.

1- In the event that the user spelled "ProcessorB", but we only have the
features available to test for "ProcessorA" (where A is B minus
features),
AND there is an optimization opportunity for "B" that negatively affects
"A", the optimizer will likely choose to do so.

2- In the event that the user spelled VendorI's processor, and the
feature
list allows it to run on VendorA's processor of similar features, AND
there
is an optimization opportunity for VendorIs that negatively affects
"A"s,
the optimizer will likely choose to do so. This can be fixed by adding
an
alias to X86TargetParser.def.

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

2 years ago[mlir][bufferization] Update public MLIR documentation
Matthias Springer [Mon, 14 Mar 2022 13:06:11 +0000 (22:06 +0900)]
[mlir][bufferization] Update public MLIR documentation

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

2 years ago[LV] Remove dead Loop argument from emitSCEVChecks. (NFC)
Florian Hahn [Mon, 14 Mar 2022 13:00:02 +0000 (13:00 +0000)]
[LV] Remove dead Loop argument from emitSCEVChecks. (NFC)

The argument is not used, remove it.

2 years ago[CoroSplit] Avoid self-replacement
Nikita Popov [Mon, 14 Mar 2022 12:52:59 +0000 (13:52 +0100)]
[CoroSplit] Avoid self-replacement

With opaque pointers, the bitcast might be a no-op, and this can
end up trying to replace a value with itself, which is illegal.

2 years ago[Clang][Sema] Avoid crashing for `__builtin_memcpy_inline` with an array argument
Egor Zhdan [Fri, 11 Mar 2022 15:57:01 +0000 (15:57 +0000)]
[Clang][Sema] Avoid crashing for `__builtin_memcpy_inline` with an array argument

This change teaches the Sema logic for `__builtin_memcpy_inline` to implicitly convert arrays passed as arguments to pointers, similarly to regular `memcpy`.

This code will no longer cause a compiler crash:
```
void f(char *p) {
    char s[1] = {0};
    __builtin_memcpy_inline(p, s, 1);
}
```

rdar://88147527

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

2 years ago[LV] Do not set insert point in completeLoopSkeleton. (NFCI)
Florian Hahn [Mon, 14 Mar 2022 12:21:20 +0000 (12:21 +0000)]
[LV] Do not set insert point in completeLoopSkeleton. (NFCI)

The insertion point for the builder used during VPlan code generation is
set during code generation. Setting the insert point here is dead code
and can be removed.

2 years ago[DeadArgElim] Guard against function type mismatch
Nikita Popov [Mon, 14 Mar 2022 12:03:04 +0000 (13:03 +0100)]
[DeadArgElim] Guard against function type mismatch

If the call function type and function type don't match, we should
consider the function live (there is effectively a bitcast
sitting in between).

2 years ago[GVN] Check load type in select PRE
Nikita Popov [Mon, 14 Mar 2022 11:46:10 +0000 (12:46 +0100)]
[GVN] Check load type in select PRE

This is no longer implicitly guaranteed with opaque pointers.

2 years ago[clang-format] Fix crash on asm block with label
Björn Schäpers [Sun, 13 Mar 2022 20:25:11 +0000 (21:25 +0100)]
[clang-format] Fix crash on asm block with label

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

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

2 years ago[clang-format][NFC] Left renamed to OpeningBrace...
Björn Schäpers [Sun, 13 Mar 2022 20:07:01 +0000 (21:07 +0100)]
[clang-format][NFC] Left renamed to OpeningBrace...

in TokenAnnotator::parseBrace. Left is misleading, because we have a
loop and Left does not move.

Also return early.

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

2 years ago[clang-format] Fix crash on invalid requires expression
Björn Schäpers [Sun, 13 Mar 2022 10:55:24 +0000 (11:55 +0100)]
[clang-format] Fix crash on invalid requires expression

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

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

2 years ago[clang-format][NFC] Rename Left to OpeningParen...
Björn Schäpers [Sun, 13 Mar 2022 20:49:15 +0000 (21:49 +0100)]
[clang-format][NFC] Rename Left to OpeningParen...

in TokenAnnotator::parseParens(). Left is misleading since we have a
loop and Left is not adjusted.

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

2 years agoExpose ScalarizerPass options to C++ (not just commandline)
Benoit Jacob [Mon, 14 Mar 2022 10:07:33 +0000 (11:07 +0100)]
Expose ScalarizerPass options to C++ (not just commandline)

Context: I needed this for https://github.com/google/iree/pull/8474 .
I found that TSan instrumentation expects vector sizes to be <= 16,
and in my project (IREE) we have tests with higher vector sizes.
That left some test functions uninstrumented, resulting in crashes as
instrumented code called into them.

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

2 years ago[clang-format] Clean up UnwrappedLineParser::parseRecord. NFC.
Marek Kurdej [Mon, 14 Mar 2022 10:59:41 +0000 (11:59 +0100)]
[clang-format] Clean up UnwrappedLineParser::parseRecord. NFC.

2 years ago[X86] Update AVX512 VBMI2 VL intrinsic tests to avoid adds
Simon Pilgrim [Mon, 14 Mar 2022 10:57:17 +0000 (10:57 +0000)]
[X86] Update AVX512 VBMI2 VL intrinsic tests to avoid adds

As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.

2 years ago[mlir][linalg] Replace linalg.fill by OpDSL variant.
gysit [Mon, 14 Mar 2022 10:45:04 +0000 (10:45 +0000)]
[mlir][linalg] Replace linalg.fill by OpDSL variant.

The revision removes the linalg.fill operation and renames the OpDSL generated linalg.fill_tensor operation to replace it. After the change, all named structured operations are defined via OpDSL and there are no handwritten operations left.

A side-effect of the change is that the pretty printed form changes from:
```
%1 = linalg.fill(%cst, %0) : f32, tensor<?x?xf32> -> tensor<?x?xf32>
```
changes to
```
%1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<?x?xf32>) -> tensor<?x?xf32>
```
Additionally, the builder signature now takes input and output value ranges as it is the case for all other OpDSL operations:
```
rewriter.create<linalg::FillOp>(loc, val, output)
```
changes to
```
rewriter.create<linalg::FillOp>(loc, ValueRange{val}, ValueRange{output})
```
All other changes remain minimal. In particular, the canonicalization patterns are the same and the `value()`, `output()`, and `result()` methods are now implemented by the FillOpInterface.

Depends On D120726

Reviewed By: nicolasvasilache

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

2 years ago[flang][NFC] Use TODO with location
Valentin Clement [Mon, 14 Mar 2022 10:49:50 +0000 (11:49 +0100)]
[flang][NFC] Use TODO with location

Use the TODO macro in `flang/Lower/Todo.h` with the converter location.

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

Reviewed By: jeanPerier

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

2 years ago[VE] Support more intrinsics
Kazushi (Jam) Marukawa [Sat, 12 Mar 2022 02:21:51 +0000 (11:21 +0900)]
[VE] Support more intrinsics

Support new intrinsics for following instrauctions.
  - VLDZ, VPCNT, VBRV
  - LCR, SCR, TSCR, FIDCR
  - FENCE
Also clean the intrinsics implementation of a following instruction.
  - SVOB

Reviewed By: simoll

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

2 years ago[VE] v256i32|64 reduction isel and tests
Simon Moll [Mon, 14 Mar 2022 09:39:30 +0000 (10:39 +0100)]
[VE] v256i32|64 reduction isel and tests

and|add|or|xor|smax v256i32|64 isel and tests for vp and vector.reduce
intrinsics

Reviewed By: kaz7

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

2 years ago[flang][NFC] Add todo in CallInterface
Valentin Clement [Mon, 14 Mar 2022 09:41:50 +0000 (10:41 +0100)]
[flang][NFC] Add todo in CallInterface

Add a todo for assumed shape dummy argument with VALUE attribute
since this is not implemented yet.

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

Reviewed By: jeanPerier

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

2 years ago[VE] v256.32|64 gather|scatter isel and tests
Simon Moll [Mon, 14 Mar 2022 08:19:27 +0000 (09:19 +0100)]
[VE] v256.32|64 gather|scatter isel and tests

This adds support for v256.32|64 scatter|gather isel.  vp.gather|scatter
and regular gather|scatter intrinsics are both lowered to the internal
VVP layer.  Splitting these ops on v512.32 is the subject of future
patches.

Reviewed By: kaz7

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

2 years ago[flang] Add runtime support for GET_COMMAND
Diana Picus [Wed, 2 Feb 2022 11:04:34 +0000 (11:04 +0000)]
[flang] Add runtime support for GET_COMMAND

Implement the GET_COMMAND intrinsic.
Add 2 new parameters (sourceFile and line) so we can create a terminator
for RUNTIME_CHECKs.

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

2 years agoAdd BasicTTIImpl cost model for llvm.get.active.lane.mask intrinsic
David Sherwood [Mon, 28 Feb 2022 17:03:22 +0000 (17:03 +0000)]
Add BasicTTIImpl cost model for llvm.get.active.lane.mask intrinsic

The vectoriser sometimes generates predicated vector loops using
the llvm.get.active.lane.mask intrinsic so it's important that we
are able to calculate a valid cost for the call instruction. When
SVE is enabled we are able to use a single whilelo instruction
for some vector types - in such cases I've marked the cost as 1.
For all other cases I've set the cost according to how the intrinsic
will be expanded.

Tests added here:

  Analysis/CostModel/AArch64/sve-intrinsics.ll
  Analysis/CostModel/ARM/active_lane_mask.ll
  Analysis/CostModel/RISCV/active_lane_mask.ll

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

2 years ago[flang] Add support for linkonce_odr in FIR
Jean Perier [Mon, 14 Mar 2022 09:24:17 +0000 (10:24 +0100)]
[flang] Add support for linkonce_odr in FIR

Add support for parsing and converting linkonce_odr in FIR.

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

2 years ago[VE] Transfer backend ownership
Simon Moll [Mon, 14 Mar 2022 08:18:33 +0000 (09:18 +0100)]
[VE] Transfer backend ownership

Kazushi Marukawa (kaz7) of NEC Solution Innovators will take over my
role as a code owner for the Vector Engine target. Erich Focht (efocht)
of NEC will assume the administrator role for the clang-ve-ninja
buildbot.

Reviewed By: kaz7

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

2 years ago[mlir][linalg] Use explicit replace in canonicalization pattern (NFC).
gysit [Mon, 14 Mar 2022 07:09:35 +0000 (07:09 +0000)]
[mlir][linalg] Use explicit replace in canonicalization pattern (NFC).

Introduce an explicit `replaceOp` call to enable the tracking of the producer LinalgOp.

Reviewed By: nicolasvasilache

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

2 years agoAdd cmake_parse_arguments() to `tablegen()` CMake function
Mehdi Amini [Mon, 14 Mar 2022 04:50:17 +0000 (04:50 +0000)]
Add cmake_parse_arguments() to `tablegen()` CMake function

This support "DEPENDS" and "EXTRA_INCLUDES", allowing in particular
to inject include paths to a tablegen targets without forcing to go
through the global INCLUDE_DIRECTORIES property.

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

2 years ago[clang][dataflow] Model the behavior of various optional members
Stanislav Gatev [Thu, 10 Mar 2022 15:25:42 +0000 (15:25 +0000)]
[clang][dataflow] Model the behavior of various optional members

Model `make_optional`, optional's default constructor, `emplace`,
`reset`, and `operator bool` members.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D121378

2 years agoCorrectly find builtins library with clang-cl
Tobias Hieta [Tue, 1 Mar 2022 07:22:53 +0000 (08:22 +0100)]
Correctly find builtins library with clang-cl

When using COMPILER_RT_USE_BUILTINS_LIBRARY=ON and clang-cl there
where several places where it didn't work as expected.

First -print-libgcc-file-name has to be prefixed with /clang:

Then the regex that matched the builtins library was wrong because
the builtins library is called clang_rt.builtins_<arch>.lib
and the regex only matched libclang_rt.builtins_arch.a

With this commit you can use a runtime build on Windows with this
option enabled.

Reviewed By: phosek

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

2 years ago[cmake] Add LLVM_THINLTO_CACHE_PATH
Tobias Hieta [Tue, 8 Mar 2022 15:15:20 +0000 (16:15 +0100)]
[cmake] Add LLVM_THINLTO_CACHE_PATH

This allows you to set a custom path to the ThinLTO cache so that
it can be shared when building in several different build directories.

Reviewed By: phosek

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

2 years ago[NFC] Fix go binding build
Kito Cheng [Mon, 14 Mar 2022 06:03:25 +0000 (14:03 +0800)]
[NFC] Fix go binding build

Fix test failure cause by D121332.

2 years ago[MCA] Removed unused variable.
Patrick Holland [Mon, 14 Mar 2022 04:55:13 +0000 (21:55 -0700)]
[MCA] Removed unused variable.

2 years ago[clang-format] Add option to align compound assignments like `+=`
sstwcw [Mon, 14 Mar 2022 01:24:32 +0000 (01:24 +0000)]
[clang-format] Add option to align compound assignments like `+=`

Reviewed By: curdeius, HazardyKnusperkeks, MyDeveloperDay

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

2 years ago[clang-format] Extract doc for entire configuration structs
sstwcw [Mon, 14 Mar 2022 01:24:31 +0000 (01:24 +0000)]
[clang-format] Extract doc for entire configuration structs

Previously the comments for configuration structs as a whole like
`BraceWrappingFlags` did not go into the doc.

Reviewed By: curdeius

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

2 years ago[yamlio] Allow parsing an entire mapping as an enumeration
sstwcw [Mon, 14 Mar 2022 01:24:26 +0000 (01:24 +0000)]
[yamlio] Allow parsing an entire mapping as an enumeration

For when we want to change a configuration option from an enum into a
struct.  The need arose when working on D119599.

Reviewed By: jhenderson

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

2 years agoRemove include_directories() from cmake `mlir_tablegen()` function (NFC)
Mehdi Amini [Mon, 14 Mar 2022 04:09:56 +0000 (04:09 +0000)]
Remove include_directories() from cmake `mlir_tablegen()` function (NFC)

This is present since the beginning, but does not seem needed by any
in-tree target right now. This seems like the kind of thing to populate
by the caller if needed.

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

2 years ago[MCA] Moved six instruction flags from InstrDesc to InstructionBase.
Patrick Holland [Sat, 12 Mar 2022 03:52:36 +0000 (19:52 -0800)]
[MCA] Moved six instruction flags from InstrDesc to InstructionBase.

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

2 years ago[IRSim] Make sure the first instruction of a block doesn't get missed if it is the...
Andrew Litteken [Wed, 9 Mar 2022 18:33:06 +0000 (10:33 -0800)]
[IRSim] Make sure the first instruction of a block doesn't get missed if it is the first valid instruction in Module.

If an instruction is first legal instruction in the module, and is the only legal instruction in its basic block, it will be ignored by the outliner due to a length check inherited from the older version of the outliner that was restricted to outlining within a single basic block. This removes that check, and updates any tests that broke because of it.

Reviewer: paquette

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

2 years ago[RISCV] Add basic code modeling for fixed length vector reduction.
Yeting Kuo [Fri, 11 Mar 2022 08:39:29 +0000 (16:39 +0800)]
[RISCV] Add basic code modeling for fixed length vector reduction.

Reviewed By: craig.topper

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

2 years ago[RISCV] Merge ReplaceNodeResults code for SHFL and GREV/GORC. NFC
Craig Topper [Sun, 13 Mar 2022 20:57:43 +0000 (13:57 -0700)]
[RISCV] Merge ReplaceNodeResults code for SHFL and GREV/GORC. NFC

2 years ago[X86] Update avx512vbmi2vl intrinsic tests to avoid adds
Luo, Yuanke [Mon, 14 Mar 2022 01:16:53 +0000 (09:16 +0800)]
[X86] Update avx512vbmi2vl intrinsic tests to avoid adds

As noticed in D119654, by adding the masked intrinsics results together
we can end up with the selects being canonicalized away from the
intrinsic - this isn't what we want to test here so replace with a
insertvalue chain into a aggregate instead to retain all the results.

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

2 years ago[IRSim][IROutliner] Ignoring Musttail Function
Andrew Litteken [Wed, 9 Mar 2022 18:35:09 +0000 (10:35 -0800)]
[IRSim][IROutliner] Ignoring Musttail Function

Musttail calls require extra handling to properly propagate the calling convention information and tail call information. The outliner does not currently do this, so we ignore call instructions that utilize the swifttailcc and tailcc calling convention as well as functions marked with the attribute musttail.

Reviewers: paquette, aschwaighofer

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

2 years agoRevert "[IRSim][IROutliner] Ignoring Musttail Function"
Andrew Litteken [Mon, 14 Mar 2022 00:26:45 +0000 (19:26 -0500)]
Revert "[IRSim][IROutliner] Ignoring Musttail Function"

This reverts commit c7037c72572c9d1b2a50dbf56077be7975f83f09.

Pushed too soon

2 years ago[IRSim][IROutliner] Ignoring Musttail Function
Andrew Litteken [Wed, 9 Mar 2022 18:35:09 +0000 (10:35 -0800)]
[IRSim][IROutliner] Ignoring Musttail Function

2 years ago[VPlan] Ensure each iv user is only visited once in transform.
Florian Hahn [Sun, 13 Mar 2022 21:40:25 +0000 (21:40 +0000)]
[VPlan] Ensure each iv user is only visited once in transform.

If a recipe has multiple uses of an IV, we crash. It causes a crash when
building llvm-test-suite.

Exposed by 95f76bff1c40bc1c2f.

2 years ago[clang-format] Fix incorrect assertion on macro definitions with keyword class.
Marek Kurdej [Sun, 13 Mar 2022 21:17:48 +0000 (22:17 +0100)]
[clang-format] Fix incorrect assertion on macro definitions with keyword class.

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

2 years ago[clang-format] Correctly format variable templates.
Marek Kurdej [Fri, 11 Mar 2022 11:51:15 +0000 (12:51 +0100)]
[clang-format] Correctly format variable templates.

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

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years ago[clang-format] Add space to comments starting with '#'.
Marek Kurdej [Tue, 1 Mar 2022 08:42:28 +0000 (09:42 +0100)]
[clang-format] Add space to comments starting with '#'.

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

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years ago[clang-format] Handle attributes before case label.
Marek Kurdej [Wed, 9 Mar 2022 10:05:34 +0000 (11:05 +0100)]
[clang-format] Handle attributes before case label.

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

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years ago[X86] Update AVX512 intrinsic tests to avoid adds
Simon Pilgrim [Sun, 13 Mar 2022 17:28:18 +0000 (17:28 +0000)]
[X86] Update AVX512 intrinsic tests to avoid adds

As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.

2 years ago[PhaseOrdering] Update naming of blocks after 95f76bff1c40.
Florian Hahn [Sun, 13 Mar 2022 17:23:25 +0000 (17:23 +0000)]
[PhaseOrdering] Update naming of blocks after 95f76bff1c40.

2 years ago[X86] Update AVX512VL intrinsic tests to avoid adds
Simon Pilgrim [Sun, 13 Mar 2022 17:20:12 +0000 (17:20 +0000)]
[X86] Update AVX512VL intrinsic tests to avoid adds

As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.

2 years ago[LV] Create & use VPScalarIVSteps for all scalar users.
Florian Hahn [Sun, 13 Mar 2022 17:15:24 +0000 (17:15 +0000)]
[LV] Create & use VPScalarIVSteps for all scalar users.

This patch is a follow-up to D115953. It updates optimizeInductions
to also introduce new VPScalarIVStepsRecipes if an IV has both vector
and scalar uses.

It updates all uses that only need scalar values to use the newly
created recipe for the scalar steps.

This completes untangling of VPWidenIntOrFpInductionRecipe
code-generation. Now the recipe *only* creates the widened vector
values, as it says on the tin.

The code to genereate IR has been moved directly to
VPWidenIntOrFpInductionRecipe::execute.

Note that the recipe has been updated to hold a reference to
ScalarEvolution, which is needed to expand the step, until we can place
the corresponding SCEV expansion in the pre-header.

Depends on D120827.

Reviewed By: Ayal

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

2 years ago[clang-tidy][docs] Fix wrong url in DontModifyStdNamespaceCheck
Balazs Benics [Sun, 13 Mar 2022 16:51:00 +0000 (17:51 +0100)]
[clang-tidy][docs] Fix wrong url in DontModifyStdNamespaceCheck

It was probably a copy-paste mistake.
The check was added as `cert-dcl58-cpp`, so the doc should point there.

Reviewed By: aaron.ballman

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

2 years ago[clang-tidy][docs][NFC] Update URL and docs of PostfixOperatorCheck
Balazs Benics [Sun, 13 Mar 2022 16:51:00 +0000 (17:51 +0100)]
[clang-tidy][docs][NFC] Update URL and docs of PostfixOperatorCheck

The docs URL was dangling, and the docs suggested that it has no fixits,
but it actually had.

Reviewed By: aaron.ballman

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

2 years ago[clang-tidy][docs][NFC] Refer to the CERT rule in bugprone-shared-ptr-array-mismatch...
Balazs Benics [Sun, 13 Mar 2022 16:51:00 +0000 (17:51 +0100)]
[clang-tidy][docs][NFC] Refer to the CERT rule in bugprone-shared-ptr-array-mismatch docs

Document the connection between this checker and the corresponding CERT
rule.

Reviewed By: aaron.ballman

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

2 years ago[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI.
Joe Loser [Sat, 12 Mar 2022 15:46:57 +0000 (10:46 -0500)]
[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI.

All supported compilers that support C++20 now support concepts. So, remove
`_LIB_LIBCPP_HAS_NO_CONCEPTS` in favor of `_LIBCPP_STD_VER > 17`. Similarly in
the tests, remove `// UNSUPPORTED: libcpp-no-concepts`.

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