platform/upstream/llvm.git
3 years ago[CMake] Remove some dead code in llvm_install_library_symlink()
Tom Stellard [Wed, 10 Feb 2021 15:36:49 +0000 (07:36 -0800)]
[CMake] Remove some dead code in llvm_install_library_symlink()

Reviewed By: smeenai

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

3 years agoRevert "Add convenience C++ helper to manipulate ranked strided memref"
Mehdi Amini [Wed, 10 Feb 2021 18:09:38 +0000 (18:09 +0000)]
Revert "Add convenience C++ helper to manipulate ranked strided memref"

This reverts commit 11f32a41c2144aeec80d1dce8cc6908fa91794a3.

The build is broken because this commit conflits with the refactoring of
the DialectRegistry APIs in the context. It'll reland shortly after
fixing the API usage.

3 years ago[RISCV] Add support for selecting vrgather.vx/vi for fixed vector splat shuffles.
Craig Topper [Wed, 10 Feb 2021 17:40:28 +0000 (09:40 -0800)]
[RISCV] Add support for selecting vrgather.vx/vi for fixed vector splat shuffles.

The test cases extract a fixed element from a vector and splat it
into a vector. This gets DAG combined into a splat shuffle.

I've used some very wide vectors in the test to make sure we have
at least a couple tests where the element doesn't fit into the
uimm5 immediate of vrgather.vi so we fall back to vrgather.vx.

Reviewed By: frasercrmck

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

3 years ago[libcxx] adds concept `std::copy_constructible`
Christopher Di Bella [Mon, 8 Feb 2021 03:01:27 +0000 (03:01 +0000)]
[libcxx] adds concept `std::copy_constructible`

Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D96230

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

3 years agoDebugInfo/Symbolize: Retrieve filename from the preceding STT_FILE for .symtab symbol...
Fangrui Song [Wed, 10 Feb 2021 17:47:10 +0000 (09:47 -0800)]
DebugInfo/Symbolize: Retrieve filename from the preceding STT_FILE for .symtab symbolization

The ELF spec says:

> STT_FILE: Conventionally, the symbol's name gives the name of the source file associated with the object file. A file symbol has STB_LOCAL binding, its section index is SHN_ABS, and it precedes the other STB_LOCAL symbols for the file, if it is present.

For a local symbol, the preceding STT_FILE symbol is almost always in the same
file[1]. GNU addr2line uses this heuristic to retrieve the filename associated
with a local symbol (e.g. internal linkage functions in C/C++).

GNU addr2line can assign STT_FILE filename to a non-local symbol, too, but the trick
only works if no regular symbol precede STT_FILE. This patch does not implement this corner case
(not useful for most executables which have more than one files).

In case of filename mismatch between .debug_line & .symtab, arbitrarily make .debug_line win.

[1]: LLD does not synthesize STT_FILE symbols
(https://bugs.llvm.org/show_bug.cgi?id=48023 see also
https://sourceware.org/bugzilla/show_bug.cgi?id=26822).  An assembly file
without `.file` directives can cause mis-attribution. This is an edge case.

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

3 years ago[llvm-cfi-verify] Set UseSymbolTable to false
Fangrui Song [Wed, 10 Feb 2021 17:44:13 +0000 (09:44 -0800)]
[llvm-cfi-verify] Set UseSymbolTable to false

parseSectionContents expects to skip regions not described by DWARF.  With my
pending DebugInfo/Symbolize change, the filename can be recovered and there
will be more IndirectInstructions entries.

3 years agoAdd convenience C++ helper to manipulate ranked strided memref
Mehdi Amini [Wed, 3 Feb 2021 21:45:00 +0000 (21:45 +0000)]
Add convenience C++ helper to manipulate ranked strided memref

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

3 years ago[libcxx] adds concept `std::move_constructible`
Christopher Di Bella [Mon, 8 Feb 2021 02:00:42 +0000 (02:00 +0000)]
[libcxx] adds concept `std::move_constructible`

Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D77961

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

3 years ago[Polly] Fix -Wunused-lambda-capture
Fangrui Song [Wed, 10 Feb 2021 17:19:05 +0000 (09:19 -0800)]
[Polly] Fix -Wunused-lambda-capture

3 years ago[Polly] Fix -DPOLLY_ENABLE_GPGPU_CODEGEN=off build after 222d380d2f57cc71bb613b5c01ec...
Fangrui Song [Wed, 10 Feb 2021 17:17:13 +0000 (09:17 -0800)]
[Polly] Fix -DPOLLY_ENABLE_GPGPU_CODEGEN=off build after 222d380d2f57cc71bb613b5c01ecf17cd1f61fa2

3 years ago[GWP-ASan] Add back some headers removed by IWYU.
Mitch Phillips [Wed, 10 Feb 2021 16:38:34 +0000 (08:38 -0800)]
[GWP-ASan] Add back some headers removed by IWYU.

These headers are required for Android.

Reviewed By: eugenis

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

3 years ago[mlir][Linalg] Fix pad hoisting.
Nicolas Vasilache [Wed, 10 Feb 2021 15:12:05 +0000 (15:12 +0000)]
[mlir][Linalg] Fix pad hoisting.

This revision fixes the indexing logic into the packed tensor that result from hoisting padding. Previously, the index was incorrectly set to the loop induction variable when in fact we need to compute the iteration count (i.e. `(iv - lb).ceilDiv(step)`).

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

3 years agoRevert "Revert "[clang][driver] Only warn once about invalid library values""
Tom Weaver [Wed, 10 Feb 2021 16:40:07 +0000 (16:40 +0000)]
Revert "Revert "[clang][driver] Only warn once about invalid library values""

This reverts commit a743702a1f4880e4492196b1ce9a9a63e0b4c075.

Test was fixed in c6a1b16db7dc7a0af8951b39f29ddbe639a98a3b

3 years agoRevert "[clang][driver] Only warn once about invalid library values"
Tom Weaver [Wed, 10 Feb 2021 16:37:34 +0000 (16:37 +0000)]
Revert "[clang][driver] Only warn once about invalid library values"

This reverts commit a6439b52088b1d58d8e7aa9891c9011648710593.

Caused buildbot failure http://lab.llvm.org:8014/#/builders/125/builds/125

3 years ago[libc++] Fix copy-paste mistake in __threading_support
Colin Finck [Wed, 10 Feb 2021 16:00:04 +0000 (11:00 -0500)]
[libc++] Fix copy-paste mistake in __threading_support

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

3 years agoReland [DWARF] Location-less inlined variables should not have DW_TAG_variable
Jeremy Morse [Wed, 10 Feb 2021 15:40:47 +0000 (15:40 +0000)]
Reland [DWARF] Location-less inlined variables should not have DW_TAG_variable

Originally landed in ddc2f1e3fb4 and reverted in d32deaab4d because of
a Generic test objecting. That was fixed up in 013613964fd9. Original
landing commit message follows:

[DWARF] Location-less inlined variables should not have DW_TAG_variable

Discussed in this thread:

  https://lists.llvm.org/pipermail/llvm-dev/2021-January/148139.html

DwarfDebug::collectEntityInfo accidentally distinguishes between variable
locations that never have a location specified, and variable locations that
have an empty location specified. The latter leads to the creation of an
empty variable referring to the abstract origin.

Fix this by seeking a non-empty location before producing a concrete
entity, to guarantee a DW_AT_location will be produced. Other loops in
collectEntityInfo and endFunctionImpl take care of examining the
retainedNodes collection and ensuring optimised-out variables are created.

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

3 years agoAvoid conflicts between debug-info and pseudo-probe profiling
Paul Robinson [Tue, 9 Feb 2021 22:41:52 +0000 (14:41 -0800)]
Avoid conflicts between debug-info and pseudo-probe profiling

After D93264, using both -fdebug-info-for-profiling and
-fpseudo-probe-for-profiling will cause the compiler to crash.
Diagnose these conflicting options in the driver.

Also, the existing CodeGen test was using the driver when it should be
running cc1.

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

3 years ago[AMDGPU] Add another test case for combining DS reads
Jay Foad [Wed, 10 Feb 2021 14:37:29 +0000 (14:37 +0000)]
[AMDGPU] Add another test case for combining DS reads

3 years ago[AMDGPU] Fix comments in SILoadStoreOptimizer::offsetsCanBeCombined
Jay Foad [Tue, 9 Feb 2021 17:19:47 +0000 (17:19 +0000)]
[AMDGPU] Fix comments in SILoadStoreOptimizer::offsetsCanBeCombined

3 years agoclang: try to fix Driver/undefined-libs.cpp on non-linux
Nico Weber [Wed, 10 Feb 2021 14:45:04 +0000 (09:45 -0500)]
clang: try to fix Driver/undefined-libs.cpp on non-linux

3 years ago[DAGCombiner] Don't fold FCOPYSIGN vector sign operand casts
Luís Marques [Wed, 10 Feb 2021 14:24:15 +0000 (14:24 +0000)]
[DAGCombiner] Don't fold FCOPYSIGN vector sign operand casts

Avoid doing the following combine for vector types:

```
copysign(x, fp_extend(y)) -> copysign(x, y)
copysign(x, fp_round(y)) -> copysign(x, y)
```

That combine seemed to impede the selection of vector instruction and cause
a mess in some circumstances.

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

3 years ago[mlir][Linalg] Add a vectorization pattern for linalg::PadTensorOp
Nicolas Vasilache [Wed, 10 Feb 2021 13:15:23 +0000 (13:15 +0000)]
[mlir][Linalg] Add a vectorization pattern for linalg::PadTensorOp

The new pattern is exercised from the TestLinalgTransforms pass.

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

3 years ago[clang][NFC] Fix undefined-libs tests
Timm Bäder [Wed, 10 Feb 2021 13:34:04 +0000 (14:34 +0100)]
[clang][NFC] Fix undefined-libs tests

Not all platforms accept -stdlib or -rtlib. Instead of complaining about
the wrong argument to these options, clang complains about the option
itself being present.

Pass an appropriate -target to the clang invocations.

3 years ago[gn build] (manually) port e89fcbfad6a3
Nico Weber [Wed, 10 Feb 2021 13:59:07 +0000 (08:59 -0500)]
[gn build] (manually) port e89fcbfad6a3

3 years ago[Sparc] Support relocatable expressions in the assembler
Daniel Cederman [Wed, 10 Feb 2021 13:50:38 +0000 (14:50 +0100)]
[Sparc] Support relocatable expressions in the assembler

Allow assembler expressions to start with an identifier. This allows for expressions such as
```
b symbol + 4
```
and
```
mov symEnd - symStart, %g1
```

The patch builds upon https://reviews.llvm.org/D47136.

Reviewed By: joerg

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

3 years ago[flang][driver] Add missing dependency in unit tests (nfc)
Andrzej Warzynski [Wed, 10 Feb 2021 12:10:07 +0000 (12:10 +0000)]
[flang][driver] Add missing dependency in unit tests (nfc)

The following patch revealed a missing dependency in the CMake script
for Flang driver unit tests:
  * https://reviews.llvm.org/D96032
The following buildbots are failing ("BUILD_SHARED_LIBS" is set to ON):
  * http://lab.llvm.org:8011/#/builders/134/builds/1840
  * http://lab.llvm.org:8011/#/builders/66/builds/1785
  * http://lab.llvm.org:8011/#/builders/33/builds/2436

This patch adds the missing dependency.

From what I can see, FortranSemantics and FortranParser are only
indirect dependencies of FlangFrontendTests and IIUC shouldn't be
required here. This is something that we should revisit at some point.
In this patch I focus on fixing the build.

3 years ago[clang][cli] Declare local variable for marshalling macros
Jan Svoboda [Wed, 10 Feb 2021 12:54:08 +0000 (13:54 +0100)]
[clang][cli] Declare local variable for marshalling macros

Some Windows build bots report `FileSystemOpts` and `MigratorOpts` as undeclared. This fix renames the parameter and declares a local variable with the original name.

3 years ago[clang][cli] Extract FileSystem and Migrator options parsing/generation
Jan Svoboda [Wed, 10 Feb 2021 11:47:06 +0000 (12:47 +0100)]
[clang][cli] Extract FileSystem and Migrator options parsing/generation

This patch splits out the last two option groups (`Filesystem` and `Migrator`) into their own `Parse`/`Generate` functions.

This effectively removes the need for `parseSimpleArgs` and marshalling block in `CompilerInvocation::generateCC1CommandLine`.

The two new `Parse`/`Generate` functions are not part of the round-trip, because they contain no custom code and the very next patch starts round-tripping the whole `CompilerInvocation`.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Generate and round-trip Diagnostic options
Jan Svoboda [Wed, 10 Feb 2021 11:24:19 +0000 (12:24 +0100)]
[clang][cli] Generate and round-trip Diagnostic options

This patch implements generation of remaining diagnostic options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Generate and round-trip DependencyOutput options
Jan Svoboda [Wed, 10 Feb 2021 10:47:33 +0000 (11:47 +0100)]
[clang][cli] Generate and round-trip DependencyOutput options

This patch implements generation of remaining dependency output options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

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

3 years ago[mlir] avoid exposing mutable DialectRegistry from MLIRContext
Alex Zinenko [Wed, 10 Feb 2021 09:11:50 +0000 (10:11 +0100)]
[mlir] avoid exposing mutable DialectRegistry from MLIRContext

MLIRContext allows its users to access directly to the DialectRegistry it
contains. While sometimes useful for registering additional dialects on an
already existing context, this breaks the encapsulation by essentially giving
raw accesses to a part of the context's internal state. Remove this mutable
access and instead provide a method to append a given DialectRegistry to the
one already contained in the context. Also provide a shortcut mechanism to
construct a context from an already existing registry, which seems to be a
common use case in the wild. Keep read-only access to the registry contained in
the context in case it needs to be copied or used for constructing another
context.

With this change, DialectRegistry is no longer concerned with loading the
dialects and deciding whether to invoke delayed interface registration. Loading
is concentrated in the MLIRContext, and the functionality of the registry
better reflects its name.

Depends On D96137

Reviewed By: mehdi_amini

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

3 years ago[mlir] enable delayed registration of dialect interfaces
Alex Zinenko [Wed, 10 Feb 2021 09:11:40 +0000 (10:11 +0100)]
[mlir] enable delayed registration of dialect interfaces

This introduces a mechanism to register interfaces for a dialect without making
the dialect itself depend on the interface. The registration request happens on
DialectRegistry and, if the dialect has not been loaded yet, the actual
registration is delayed until the dialect is loaded. It requires
DialectRegistry to become aware of the context that contains it and the context
to expose methods for querying if a dialect is loaded.

This mechanism will enable a simple extension mechanism for dialects that can
have interfaces defined outside of the dialect code. It is particularly helpful
for, e.g., translation to LLVM IR where we don't want the dialect itself to
depend on LLVM IR libraries.

Reviewed By: mehdi_amini

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

3 years ago[RISCV] Add support for selecting vid.v from build_vector
Fraser Cormack [Tue, 9 Feb 2021 12:09:10 +0000 (12:09 +0000)]
[RISCV] Add support for selecting vid.v from build_vector

This patch optimizes a build_vector "index sequence" and lowers it to
the existing custom RISCVISD::VID node. This pattern is common in
autovectorized code.

The custom node was updated to allow it to be used by both scalable and
fixed-length vectors, thus avoiding pattern duplication.

Reviewed By: craig.topper

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

3 years agoReapply [DebugInfo] Re-engineer a test to be stricter, add XFails
Jeremy Morse [Wed, 10 Feb 2021 10:27:00 +0000 (10:27 +0000)]
Reapply [DebugInfo] Re-engineer a test to be stricter, add XFails

Was e05c10380ce, reverted in d7d0b17de77, see D95617 for details. I've
added "arm64" to the XFail list (as well as aarch64), will follow up on
the mailing list about whether there's anything else to be done.

3 years ago[clang][cli] Generate and round-trip Target options
Jan Svoboda [Wed, 10 Feb 2021 10:33:24 +0000 (11:33 +0100)]
[clang][cli] Generate and round-trip Target options

This patch implements generation of remaining target options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Generate and round-trip PreprocessorOutput options
Jan Svoboda [Wed, 10 Feb 2021 10:16:10 +0000 (11:16 +0100)]
[clang][cli] Generate and round-trip PreprocessorOutput options

This patch implements generation of remaining preprocessor output options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

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

3 years agoRevert rGe1172959226689a "[X86][AVX] canonicalizeLaneShuffleWithRepeatedOps - merge...
Simon Pilgrim [Wed, 10 Feb 2021 10:26:30 +0000 (10:26 +0000)]
Revert rGe1172959226689a "[X86][AVX] canonicalizeLaneShuffleWithRepeatedOps - merge VPERMILPD ops with different low/high masks."

Revert this while I investigate a downstream breakage report.

3 years ago[flang][driver] Add support for -fopenmp and -fopenacc
Faris Rehman [Wed, 10 Feb 2021 09:24:45 +0000 (09:24 +0000)]
[flang][driver] Add support for -fopenmp and -fopenacc

Add support for the following options:
* -fopenmp
* -fopenacc

Update OpenMP and OpenACC semantics tests to use the new driver if it is built, otherwise use f18.
OpenMP tests that include `use omp_lib` or run `test_symbols.sh` have not been updated as they require options `-intrinsic-module-directory` and `-funparse-with-symbols` which are currently not implemented in the new driver.
Similarly OpenACC tests that run `test_symbols.sh` have not been updated.

This patch also moves semanticsContext to CompilerInvocation and creates it in CompilerInvocation#setSemanticsOpts so that the semantics context can use Fortran::parser::Options#features.

Summary of changes:
- Move semanticsContext to CompilerInvocation.h
- Update OpenMP and OpenACC semantics tests that do not rely on `-intrinsic-module-directory` and `-funparse-with-symbols` to use %flang

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

3 years ago[OpenCL] Add cl_khr_subgroup_clustered_reduce to TableGen BIFs
Sven van Haastregt [Wed, 10 Feb 2021 09:44:52 +0000 (09:44 +0000)]
[OpenCL] Add cl_khr_subgroup_clustered_reduce to TableGen BIFs

Add the builtin functions brought by the
cl_khr_subgroup_clustered_reduce extension to
`-fdeclare-opencl-builtins`.

3 years ago[OpenCL] Add cl_khr_subgroup_non_uniform_arithmetic to TableGen BIFs
Sven van Haastregt [Wed, 10 Feb 2021 09:44:39 +0000 (09:44 +0000)]
[OpenCL] Add cl_khr_subgroup_non_uniform_arithmetic to TableGen BIFs

Add the builtin functions brought by the
cl_khr_subgroup_non_uniform_arithmetic extension to
`-fdeclare-opencl-builtins`.

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

3 years ago[LoopVectorize] NFC: Change computeFeasibleMaxVF to operate on ElementCount.
Sander de Smalen [Wed, 10 Feb 2021 08:52:10 +0000 (08:52 +0000)]
[LoopVectorize] NFC: Change computeFeasibleMaxVF to operate on ElementCount.

This patch is NFC and changes occurrences of `unsigned MaxVectorSize`
to work on type ElementCount.

This patch is a preparatory patch with the ultimate goal of making
`computeMaxVF()` return both a max fixed VF and a max scalable VF,
so that `selectVectorizationFactor()` can pick the most cost-effective
vectorization factor.

Reviewed By: kmclaughlin

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

3 years ago[ValueTypes] Add MVT for nxv1bf16.
Sander de Smalen [Wed, 10 Feb 2021 08:27:03 +0000 (08:27 +0000)]
[ValueTypes] Add MVT for nxv1bf16.

Reviewed By: frasercrmck

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

3 years ago[WebAssembly] Enable loop unrolling
Sam Parker [Wed, 10 Feb 2021 08:22:45 +0000 (08:22 +0000)]
[WebAssembly] Enable loop unrolling

Enable partial and runtime unrolling with a threshold of 30, which
was derived from a large number of kernels running on node and
wasmtime for amd64 and aarch64.

Unrolling is enabled by default at -O2 and -O3 and is disabled at
-Oz and -Os. Compiling with -Os is recommended if the wasm binary
size is the most important factor.

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

3 years ago[AArch64][GlobalISel] Fold selects fed by G_PTR_ADD
Jessica Paquette [Wed, 10 Feb 2021 02:04:44 +0000 (18:04 -0800)]
[AArch64][GlobalISel] Fold selects fed by G_PTR_ADD

Similar to the case for G_ADD.

There was a function in CTMark/pairlocalalign which was missing this case,
causing GlobalISel to emit a add + csel when a csinc is all that is necessary.

https://godbolt.org/z/ax69E9

Minor code size improvements on CTMark at -Os.

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

3 years agoRevert "[analyzer] RetainCountChecker: Add a suppression for OSSymbols."
Artem Dergachev [Wed, 10 Feb 2021 07:21:20 +0000 (23:21 -0800)]
Revert "[analyzer] RetainCountChecker: Add a suppression for OSSymbols."

This reverts commit 3500cc8d891bb3825bb3275affe6db8b12f2f695.

This old commit was made over a completely false premise. OSSymbols
aren't different from other OSObjects and we shouldn't treat them
differently for the purposes of static analysis.

3 years ago[mlir][shape] Generalize broadcast to a variadic number of shapes
Tres Popp [Mon, 1 Feb 2021 08:49:54 +0000 (09:49 +0100)]
[mlir][shape] Generalize broadcast to a variadic number of shapes

Previously broadcast was a binary op. Now it can support more inputs.
This has been changed in such a way that for now, this is an NFC for
all broadcast operations that were previously legal.

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

3 years ago[SelectionDAG] Use range-based for loops (NFC)
Kazu Hirata [Wed, 10 Feb 2021 06:14:30 +0000 (22:14 -0800)]
[SelectionDAG] Use range-based for loops (NFC)

3 years ago[TableGen] Drop unnecessary const from return types (NFC)
Kazu Hirata [Wed, 10 Feb 2021 06:14:28 +0000 (22:14 -0800)]
[TableGen] Drop unnecessary const from return types (NFC)

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Wed, 10 Feb 2021 06:14:26 +0000 (22:14 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years ago[Polly] Make the NewPM pass pipeline more similar to the legacy's.
Michael Kruse [Wed, 10 Feb 2021 05:20:09 +0000 (23:20 -0600)]
[Polly] Make the NewPM pass pipeline more similar to the legacy's.

Even though it has some oddities, both pipelines should be as similar as
possible. Also use report_fatal_error instead of assertions to ensure a
proper failure in release builds for unsupported options.

This finalizes the patch serious to make Polly run in the default
configuration when using the NewPM by default.

3 years ago[Polly] Make NewPM's IslAstAnalysis more similar to the legacy IslAstInfoWrapperPass.
Michael Kruse [Wed, 10 Feb 2021 05:08:15 +0000 (23:08 -0600)]
[Polly] Make NewPM's IslAstAnalysis more similar to the legacy IslAstInfoWrapperPass.

In particular, print the ast with -debug-only=polly-ast, print a
per-scop header with print<polly-ast> and force-add the analysis with
-polly-code-generation=ast.

3 years ago[Polly] Improve Simplify pass PM integration.
Michael Kruse [Wed, 10 Feb 2021 04:58:54 +0000 (22:58 -0600)]
[Polly] Improve Simplify pass PM integration.

1. LegacyPM: Rename SimplifyLegacyPass to SimplifyWrapperPass.
2. LegacyPM: Complete create/init functions in LinkAllPasses.h
3. NewPM: Only invalidate non-Scop passes if changed.
4. NewPM: Add to default pass pipeline.
5. NewPM: Print -analyze header for each print<polly-simplify>

3 years ago[Polly] Port IslScheduleOptimizer to the NewPM.
Michael Kruse [Wed, 10 Feb 2021 04:44:05 +0000 (22:44 -0600)]
[Polly] Port IslScheduleOptimizer to the NewPM.

3 years ago[Polly] Add TargetTransformInfo to ScopPass standard analysis results.
Michael Kruse [Wed, 10 Feb 2021 04:30:42 +0000 (22:30 -0600)]
[Polly] Add TargetTransformInfo to ScopPass standard analysis results.

TargetTransformInfo is required by IslScheduleOptimizer, as ScopPass.
Unfortunately it is not possible to get arbitrary larger-unit analyses
in for as ScopPass. Loop passes also already use TargetTransformInfo as
LoopStandardAnalysisResults, hence wei might expect it to be available
to Scop passes as well.

3 years ago[Polly] Register pass-instrumentation for NewPM's Scop level.
Michael Kruse [Wed, 10 Feb 2021 03:57:13 +0000 (21:57 -0600)]
[Polly] Register pass-instrumentation for NewPM's Scop level.

The pass-instrumentation pass is implicitly execute by the NewPM
whenever a new analysis runs. Not registering it will cause the crash
whenever a scop pass requests an analysis.

For instance this is the case for the IstAstAnalysis requesting the
DependenceAnalsis result.

3 years ago[Polly] Port PruneUnprofitable to the NewPM.
Michael Kruse [Wed, 10 Feb 2021 03:53:14 +0000 (21:53 -0600)]
[Polly] Port PruneUnprofitable to the NewPM.

3 years ago[Polly] Port DeLICM to the NewPM.
Michael Kruse [Wed, 10 Feb 2021 03:32:29 +0000 (21:32 -0600)]
[Polly] Port DeLICM to the NewPM.

3 years ago[Polly] Port ForwardOpTree to the NewPM.
Michael Kruse [Wed, 10 Feb 2021 03:19:47 +0000 (21:19 -0600)]
[Polly] Port ForwardOpTree to the NewPM.

3 years agoFix deprecated usage of `mallinfo`
Ta-Wei Tu [Wed, 10 Feb 2021 05:52:50 +0000 (13:52 +0800)]
Fix deprecated usage of `mallinfo`

glibc deprecates `mallinfo` in the latest version of 2.33. This patch replaces the usage of `mallinfo` with the new `mallinfo2` when it's available.

Reviewed By: lattner

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

3 years ago[Test] Two more tests on usub
Max Kazantsev [Wed, 10 Feb 2021 05:28:08 +0000 (12:28 +0700)]
[Test] Two more tests on usub

They are analogous to the existing tests, but use different starting offset
which can be important for some transforms.

3 years ago[clang][driver] Only warn once about invalid library values
Timm Bäder [Tue, 2 Feb 2021 17:25:36 +0000 (18:25 +0100)]
[clang][driver] Only warn once about invalid library values

Since ToolChain::GetCXXStdlibType() is a simple getter that might emit
the "invalid library name in argument" warning, it can conceivably be
called several times while initializing the build pipeline.

Before this patch, a simple 'clang++ -stdlib=foo ./test.cpp' would print
the warning twice, -rt=lib=foo would print 6 times.

Change this and always only print the warning once. Keep the rest of the
semantics of the functions.

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

3 years ago[MLIR] NFC Fix vector transforms build warnings
Uday Bondhugula [Wed, 10 Feb 2021 05:12:20 +0000 (10:42 +0530)]
[MLIR] NFC Fix vector transforms build warnings

Fix build warnings from VectorTransforms.cpp.

3 years ago[MLIR] Update affine.for unroll utility for iter_args support
Uday Bondhugula [Tue, 9 Feb 2021 12:36:12 +0000 (18:06 +0530)]
[MLIR] Update affine.for unroll utility for iter_args support

Update affine.for loop unroll utility for iteration arguments support.
Fix promoteIfSingleIteration as well.

Fixes PR49084: https://bugs.llvm.org/show_bug.cgi?id=49084

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

3 years ago[libcxx] adds concept `std::convertible_to`
Christopher Di Bella [Thu, 4 Feb 2021 03:19:26 +0000 (03:19 +0000)]
[libcxx] adds concept `std::convertible_to`

Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

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

3 years ago[clang][cli] Fix gcc "enumeral and non-enumeral type in conditional expression" warni...
Yang Fan [Wed, 10 Feb 2021 03:15:39 +0000 (11:15 +0800)]
[clang][cli] Fix gcc "enumeral and non-enumeral type in conditional expression" warning (NFC)

3 years agoFix JSON formatting when converting to trace event format
Todd Lipcon [Wed, 10 Feb 2021 01:59:31 +0000 (12:59 +1100)]
Fix JSON formatting when converting to trace event format

Reviewed By: dberris

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

3 years agoFix xray fdr mode to allow multiple flushes
Todd Lipcon [Wed, 10 Feb 2021 01:54:00 +0000 (12:54 +1100)]
Fix xray fdr mode to allow multiple flushes

Reviewed By: dberris

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

3 years agoUse internal_dict everywhere we refer to the python session dict in docs.
Jim Ingham [Wed, 10 Feb 2021 01:48:04 +0000 (17:48 -0800)]
Use internal_dict everywhere we refer to the python session dict in docs.

3 years agoAdd LLVMIR Dialect counterparts of @llvm.maximum and @llvm.minimum.
Andrew Pritchard [Wed, 10 Feb 2021 00:57:40 +0000 (00:57 +0000)]
Add LLVMIR Dialect counterparts of @llvm.maximum and @llvm.minimum.

These are similar to maxnum and minnum, but they're defined to treat -0
as less than +0.  This behavior can't be expressed using float
comparisons and selects, since comparisons are defined to treat
different-signed zeros as equal.  So, the only way to communicate this
behavior into LLVM IR without defining target-specific intrinsics is to
add the corresponding ops.

Reviewed By: mehdi_amini

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

3 years agoFix side-effect detection in LLVMIRIntrinsicGen.
Andrew Pritchard [Wed, 10 Feb 2021 00:48:08 +0000 (00:48 +0000)]
Fix side-effect detection in LLVMIRIntrinsicGen.

Previously it reported an op had side-effects iff it declared that it
didn't have any side-effects.  This had the undesirable result that
canonicalization would always delete any intrinsic calls that did memory
stores and returned void.

Reviewed By: ftynse, mehdi_amini

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

3 years agoRevert "[InstCombine] convert assumes to operand bundles"
Tyker [Wed, 10 Feb 2021 00:32:00 +0000 (01:32 +0100)]
Revert "[InstCombine] convert assumes to operand bundles"

This reverts commit 5eb2e994f9b3a5aff0a156d0a1f7e6121342cc11.

3 years ago[Polly] Remove use of -O3 in regression test.
Michael Kruse [Wed, 10 Feb 2021 00:05:43 +0000 (18:05 -0600)]
[Polly] Remove use of -O3 in regression test.

In addition to that regression tests should not test the intire pass
pipeline (unless they are testing the pipeline itself), the Polly-ACC
currently does not support the new pass manager. If enabled by default,
such tests will therefore fail.

Use the -polly-gpu-runtime and -polly-gpu-arch options also as default
values for the PPCGCodeGeneration pass. This requires to move the option
to be moved from the pipeline-building Register passes to the
PPCGCodeGeneration implementation.

Fixes the spir-typesize.ll buildbot fail.

3 years ago[LLDB] Remove uneeded CopyType from BlockPointerSyntheticFrontEnd
Shafik Yaghmour [Wed, 10 Feb 2021 00:09:32 +0000 (16:09 -0800)]
[LLDB] Remove uneeded CopyType from BlockPointerSyntheticFrontEnd

BlockPointerSyntheticFrontEnd does a CopyType which results in it copying the type
back into its own context. This will result in a call to ASTImporterDelegate::setOrigin
with &decl->getASTContext() == origin.ctx this can result in an infinite recursion
later on in ASTImporter since it will attempt to find the decl in its origin which will be itself.

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

3 years agoRemove trailing spaces after \ in comments.
Jim Ingham [Wed, 10 Feb 2021 00:06:47 +0000 (16:06 -0800)]
Remove trailing spaces after \ in comments.

3 years agoAdd documentation for the extra_args parameter to breakpoint commands.
Jim Ingham [Tue, 9 Feb 2021 23:32:45 +0000 (15:32 -0800)]
Add documentation for the extra_args parameter to breakpoint commands.

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

3 years agoAdd NoSideEffect trait to shape.split_at and shape.concat
Jing Pu [Tue, 9 Feb 2021 23:19:13 +0000 (15:19 -0800)]
Add NoSideEffect trait to shape.split_at and shape.concat

Reviewed By: jpienaar, silvas

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

3 years ago[flang][fir] Updates to internal name uniquer.
Eric Schweitz [Tue, 9 Feb 2021 17:50:08 +0000 (09:50 -0800)]
[flang][fir] Updates to internal name uniquer.

https://github.com/flang-compiler/f18-llvm-project/pull/474

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

3 years ago[lld][WebAssembly] Fix segfault in map file support
Thomas Lively [Tue, 9 Feb 2021 22:42:43 +0000 (14:42 -0800)]
[lld][WebAssembly] Fix segfault in map file support

The code previously assumed that `getChunk` would return a non-null pointer for
every symbol, but in fact it only returns non-null pointers for DefinedFunction
and DefinedData symbols. This patch fixes the segfault by checking whether
`getChunk` returns a null for each symbol and skipping the mapping output for
any symbols for which it does.

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

3 years ago[mlir][OpFormatGen] Refactor `type_ref` into a more general `ref` directive
River Riddle [Tue, 9 Feb 2021 22:32:15 +0000 (14:32 -0800)]
[mlir][OpFormatGen] Refactor `type_ref` into a more general `ref` directive

This allows for referencing nearly every component of an operation from within a custom directive.

It also fixes a bug with the current type_ref implementation, PR48478

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

3 years ago[mlir] Add initial support for an alias analysis framework in MLIR
River Riddle [Tue, 9 Feb 2021 22:11:00 +0000 (14:11 -0800)]
[mlir] Add initial support for an alias analysis framework in MLIR

This revision adds a new `AliasAnalysis` class that represents the main alias analysis interface in MLIR. The purpose of this class is not to hold the aliasing logic itself, but to provide an interface into various different alias analysis implementations. As it evolves this should allow for users to plug in specialized alias analysis implementations for their own needs, and have them immediately usable by other analyses and transformations.

This revision also adds an initial simple generic alias, LocalAliasAnalysis, that provides support for performing stateless local alias queries between values. This class is similar in scope to LLVM's BasicAA.

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

3 years ago[llvm-objdump][test] Fix --prefix tests for system-windows
Vinicius Tinti [Tue, 9 Feb 2021 20:06:34 +0000 (20:06 +0000)]
[llvm-objdump][test] Fix --prefix tests for system-windows

Merging directories and files may produce different results on different
platforms.

Merging "./Inputs" and "source-interleave-x86_64.c" will use different
separators in POSIX and Windows.

Dedicated tests are needed for dealing with removing trailing separators
for POSIX (consider only '/') and Windows (consider '/' and '\').

Fixes D85024.
Fixes PR46368.

Reviewed By: jhenderson, MaskRay

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

3 years ago[VPlan] Use VPUser to manage CondBit
Florian Hahn [Tue, 9 Feb 2021 17:56:05 +0000 (17:56 +0000)]
[VPlan] Use VPUser to manage CondBit

VP blocks keep track of a condition, which is a VPValue. This patch
updates VPBlockBase to manage the value using VPUser, so
replaceAllUsesWith properly updates the condition bit as well.

This is required to enable VP2VP transformations and it helps with
simplifying some of the code required to manage condition bits.

Reviewed By: gilr

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

3 years ago[AArch64][GlobalISel] Allow vector load legalization into 128-bit-wide types
Jessica Paquette [Mon, 8 Feb 2021 20:27:13 +0000 (12:27 -0800)]
[AArch64][GlobalISel] Allow vector load legalization into 128-bit-wide types

Similar to 3d25fdc5c21f174d38ac78dd01ccaf6eec655bc0

This fixes bad codegen in cases like so:

https://godbolt.org/z/hePhz1

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

3 years ago[AIX][llvm][support] Implement getHostCPUName
David Tenty [Tue, 9 Feb 2021 20:56:47 +0000 (15:56 -0500)]
[AIX][llvm][support] Implement getHostCPUName

We implement getHostCPUName() for AIX via systemcfg interfaces since access to the processor version register is a privileged operation. We return a value based on the  current processor implementation mode.

This fixes the cpu detection used by clang for `-mcpu=native`.

Reviewed By: hubert.reinterpretcast

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

3 years agoPR48545: Access check the inherited constructor, not the inheriting
Richard Smith [Tue, 9 Feb 2021 21:25:52 +0000 (13:25 -0800)]
PR48545: Access check the inherited constructor, not the inheriting
constructor.

We got this wrong only when forming a CXXTemporaryObjectExpr, which
caused the bug to only appear for certain syntactic forms.

3 years ago[MLIR] Add context accessor to identifier
George [Tue, 9 Feb 2021 20:59:52 +0000 (12:59 -0800)]
[MLIR] Add context accessor to identifier

I knew I would miss one...

Reviewed By: stellaraccident

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

3 years ago[lld][WebAssembly] Allow --export of optional start/stop symbols
Sam Clegg [Tue, 9 Feb 2021 01:16:15 +0000 (17:16 -0800)]
[lld][WebAssembly] Allow --export of optional start/stop symbols

This moves the error checking until after all optional
symbols (including the section start/end symbols) have
been created.

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

3 years ago[libc++] [LWG2993] reference_wrapper<T> conversion from U&&
Arthur O'Dwyer [Sun, 6 Dec 2020 00:37:41 +0000 (19:37 -0500)]
[libc++] [LWG2993] reference_wrapper<T> conversion from U&&

Implement the resolution of LWG2993. Replace a deleted constructor
with a constructor that SFINAEs away in appropriate circumstances.
Also, now that the constructor is templated, we must have an
explicit deduction guide to make CTAD work.

Some tests have been merged in from Agustín Bergé's D40259.

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

3 years ago[lldb] [Process/FreeBSDRemote] Introduce powerpc support
Michał Górny [Tue, 2 Feb 2021 17:29:06 +0000 (18:29 +0100)]
[lldb] [Process/FreeBSDRemote] Introduce powerpc support

Introduce a minimal support for the 32-bit powerpc platform.  This
includes support for GPR and FPR registers.  I also needed to add
software breakpoint opcode for PPC32/PPC64 (big endian), and to fix
offsets in RegisterInfos_powerpc.h (used only by FreeBSD register
context to be globally unique rather than relative to each struct).

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

3 years ago[mlir][IR] Remove the concept of `OperationProperties`
River Riddle [Tue, 9 Feb 2021 19:41:10 +0000 (11:41 -0800)]
[mlir][IR] Remove the concept of `OperationProperties`

These properties were useful for a few things before traits had a better integration story, but don't really carry their weight well these days. Most of these properties are already checked via traits in most of the code. It is better to align the system around traits, and improve the performance/cost of traits in general.

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

3 years ago[libc++] Add `noexcept` to `string::find` and similar members.
zoecarver [Fri, 5 Feb 2021 19:54:47 +0000 (11:54 -0800)]
[libc++] Add `noexcept` to `string::find` and similar members.

Adds `noexcept` to `string_view`/`string::find` and similar members
(`rfind`, etc.). See discussion in D95251. Refs D95821.

Reviewed By: curdeius, ldionne

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

3 years ago[clangd] Expose more dependent-name detail via semanticTokens
Sam McCall [Sat, 30 Jan 2021 00:12:36 +0000 (01:12 +0100)]
[clangd] Expose more dependent-name detail via semanticTokens

This change makes dependentName a modifier, rather than a token type.
It can be combined with:
- type (new, standard) - this combination replaces dependentType like T::typename Foo
- unknown (new, nonstandard) - for general dependent names
- Field, etc - when the name is dependent but we heuristically resolve it

While here, fix cases where template-template-parameter cases were
incorrectly flagged as type-dependent.
And the merging of modifiers when resolving conflicts accidentally
happens to work around a bug that showed up in a test.

The behavior observed through the pre-standard protocol should be mostly
unchanged (it'll see the bugfixes only). This is done in a somehat
fragile way but it's not expected to live long.

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

3 years ago[mlir][spirv] Add support for sampled image type
Weiwei Li [Tue, 9 Feb 2021 18:47:12 +0000 (13:47 -0500)]
[mlir][spirv] Add support for sampled image type

co-authored-by: Alan Liu <alanliu.yf@gmail.com>

Reviewed By: antiagainst

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

3 years ago[WebAssembly] Use data sections by default
Sam Clegg [Mon, 8 Feb 2021 04:22:07 +0000 (20:22 -0800)]
[WebAssembly] Use data sections by default

This allows data sections that don't start with `.data` to be
used/created.

Without this, clang's `__attribute__((section("foo")))` would
generate assembly that would not parse.

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

3 years ago[Attributor][FIX] Do not create UB by introducing a `noundef undef`
Johannes Doerfert [Tue, 9 Feb 2021 04:09:32 +0000 (22:09 -0600)]
[Attributor][FIX] Do not create UB by introducing a `noundef undef`

This was reported as PR49104. The reproducer uses varargs but the issue
is the same, we know an argument is dead but can't change the signature
for some reason. The PR49104 situation was: We are in an CG-SCC
traversal and we remove all the uses of an argument and proof it thereby
dead. However, if we do not remove the argument, via signature rewrite,
we need to ensure that the `undef` we introduce at the call site doesn't
clash with a `noundef` attribute.

3 years ago[CUDA, NVPTX] Allow targeting sm_86 GPUs.
Artem Belevich [Wed, 3 Feb 2021 21:26:00 +0000 (13:26 -0800)]
[CUDA, NVPTX] Allow targeting sm_86 GPUs.

The patch only plumbs through the option necessary for targeting sm_86 GPUs w/o
adding any new functionality.

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

3 years agoRevert "[libc++] Require C++20 to build the benchmarks."
Mark de Wever [Tue, 9 Feb 2021 18:59:34 +0000 (19:59 +0100)]
Revert "[libc++] Require C++20 to build the benchmarks."

There are build bots without C++20 support building the benchmarks.

This reverts commit 34acc91642440b8e4bad17acfdbb1314c8f2043e.

3 years agoAMDGPU: Fix verifier error with argument passed in CSR SGPR
Matt Arsenault [Thu, 4 Feb 2021 22:12:46 +0000 (17:12 -0500)]
AMDGPU: Fix verifier error with argument passed in CSR SGPR

We need to avoid setting the kill flag on the CSR spill if there's an
additional use of the register after the spill.

This does rely on consistency between the entry block liveins and the
MRI's function live ins, which is not something the verifier checks
now.

3 years agoGlobalISel: Fix using wrong calling convention for callees
Matt Arsenault [Mon, 8 Feb 2021 22:15:29 +0000 (17:15 -0500)]
GlobalISel: Fix using wrong calling convention for callees

This was taking the calling convention from the parent function,
instead of the callee. Avoids regressions in a future patch when the
caller and callee have different type breakdowns.

For some reason AArch64's lowerFormalArguments seems to intentionally
ignore the parent isVarArg.

3 years ago[RISCV] Make the min and max vector width command line options more consistent and...
Craig Topper [Tue, 9 Feb 2021 18:47:19 +0000 (10:47 -0800)]
[RISCV] Make the min and max vector width command line options more consistent and check their relationship to each other.