platform/upstream/llvm.git
3 years ago[asan][test] Improve -asan-use-private-alias tests
Fangrui Song [Fri, 4 Dec 2020 23:05:59 +0000 (15:05 -0800)]
[asan][test] Improve -asan-use-private-alias tests

In preparation for D92078

3 years ago[libc++] Update the commented "synopsis" in <algorithm> to match current reality.
Arthur O'Dwyer [Thu, 3 Dec 2020 01:02:18 +0000 (20:02 -0500)]
[libc++] Update the commented "synopsis" in <algorithm> to match current reality.

The synopsis now reflects what's implemented. It does NOT reflect
all of what's specified in C++20. The "constexpr in C++20" markings
are still missing from these 12 algorithms, because they are still
unimplemented by libc++:

    reverse partition sort nth_element next_permutation prev_permutation
    push_heap pop_heap make_heap sort_heap partial_sort partial_sort_copy

All of the above algorithms were excluded from [P0202].

All of the above algorithms were made constexpr in [P0879] (along with
swap_ranges, iter_swap, and rotate — we've already implemented those three).

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

3 years ago[libc++] [P0202] constexpr set_union, set_difference, set_symmetric_difference, merge
Arthur O'Dwyer [Fri, 4 Dec 2020 18:47:12 +0000 (13:47 -0500)]
[libc++] [P0202] constexpr set_union, set_difference, set_symmetric_difference, merge

These had been waiting on the ability to use `std::copy` from
constexpr code (which in turn had been waiting on the ability to
use `is_constant_evaluated()` to switch between `memmove` and non-`memmove`
implementations of `std::copy`). That work landed a while ago,
so these algorithms can all be constexpr in C++20 now.

Simultaneously, update the tests for the set algorithms.

- Use an element type with "equivalent but not identical" values.
- The custom-comparator tests now pass something different from `operator<`.
- Make the constexpr coverage match the non-constexpr coverage.

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

3 years ago[libc++] Slightly improve constexpr test coverage for std::includes.
Arthur O'Dwyer [Fri, 4 Dec 2020 18:38:51 +0000 (13:38 -0500)]
[libc++] Slightly improve constexpr test coverage for std::includes.

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

3 years ago[VE] Add vfsqrt, vfcmp, vfmax, and vfmin intrinsic instructions
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 11:15:13 +0000 (20:15 +0900)]
[VE] Add vfsqrt, vfcmp, vfmax, and vfmin intrinsic instructions

Add vfsqrt, vfcmp, vfmax, and vfmin intrinsic instructions and
regression tests.

Reviewed By: simoll

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

3 years agoASTImporter: Migrate to the FileEntryRef overload of SourceManager::createFileID...
Duncan P. N. Exon Smith [Thu, 3 Dec 2020 01:25:46 +0000 (17:25 -0800)]
ASTImporter: Migrate to the FileEntryRef overload of SourceManager::createFileID, NFC

Migrate `ASTImporter::Import` over to using the `FileEntryRef` overload
of `SourceManager::createFileID`. No functionality change here.

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

3 years agoARCMigrate: Initialize fields in EditEntry inline, NFC
Duncan P. N. Exon Smith [Thu, 3 Dec 2020 01:32:08 +0000 (17:32 -0800)]
ARCMigrate: Initialize fields in EditEntry inline, NFC

Initialize the fields inline instead of having to manually write out a
default constructor.

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

3 years agoFrontend: Use translateLineCol instead of translateFileLineCol, NFC
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 22:34:22 +0000 (14:34 -0800)]
Frontend: Use translateLineCol instead of translateFileLineCol, NFC

`ParseDirective` in VerifyDiagnosticConsumer.cpp is already calling
`translateFile`, so use the `FileID` returned by that to call
`translateLineCol` instead of using the more heavyweight
`translateFileLineCol`.

No functionality change here.

3 years ago[MC] Consume EndOfStatement in .cfi_{sections,endproc}
Scott Linder [Fri, 4 Dec 2020 22:14:37 +0000 (22:14 +0000)]
[MC] Consume EndOfStatement in .cfi_{sections,endproc}

Previously these directives were always interpreted as having an extra
blank line after them.

Reviewed By: MaskRay

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

3 years ago[gn build] Port 4d8bf870a82
LLVM GN Syncbot [Fri, 4 Dec 2020 22:16:56 +0000 (22:16 +0000)]
[gn build] Port 4d8bf870a82

3 years agoADT: Remove AlignedCharArrayUnion, NFC
Duncan P. N. Exon Smith [Wed, 2 Dec 2020 23:41:36 +0000 (15:41 -0800)]
ADT: Remove AlignedCharArrayUnion, NFC

Prep commit already migrated users over to std::aligned_union_t; this
just deletes the type / header / test.

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

3 years ago[mlir][vector] rephrased description
Aart Bik [Fri, 4 Dec 2020 19:48:48 +0000 (11:48 -0800)]
[mlir][vector] rephrased description

More carefully worded description. Added constructor to options.

Reviewed By: nicolasvasilache

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

3 years agoInclude BuiltinAttributes.h in llvm-prettyprinters/gdb/mlir-support.cpp
Krzysztof Parzyszek [Fri, 4 Dec 2020 21:54:29 +0000 (15:54 -0600)]
Include BuiltinAttributes.h in llvm-prettyprinters/gdb/mlir-support.cpp

This header was introduced in c7cae0e4fa4e1ed4bdca186096a408578225fc2b.

3 years ago[test] Add explicit dso_local to constant/global variable declarations
Fangrui Song [Fri, 4 Dec 2020 21:51:01 +0000 (13:51 -0800)]
[test] Add explicit dso_local to constant/global variable declarations

They are currently implicit because TargetMachine::shouldAssumeDSOLocal implies
dso_local.

For external data, clang -fno-pic emits the dso_local specifier for ELF and
non-MinGW COFF. Adding explicit dso_local makes these tests in align with the
clang behavior and helps implementing an option to use GOT indirection for
external data access in -fno-pic mode (to avoid copy relocations).

3 years ago[dfsan] Add empty APIs for field-level shadow
Jianzhou Zhao [Fri, 4 Dec 2020 02:50:56 +0000 (02:50 +0000)]
[dfsan] Add empty APIs for field-level shadow

This is a child diff of D92261.

This diff adds APIs that return shadow type/value/zero from origin
objects. For the time being these APIs simply returns primitive
shadow type/value/zero. The following diff will be implementing the
conversion.

As D92261 explains, some cases still use primitive shadow during
the incremential changes. The cases include
1) alloca/load/store
2) custom function IO
3) vectors
At the cases this diff does not use the new APIs, but uses primitive
shadow objects explicitly.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D92629

3 years ago[OPENMP]Fix PR48394: need to capture variables used in atomic constructs.
Alexey Bataev [Fri, 4 Dec 2020 20:56:54 +0000 (12:56 -0800)]
[OPENMP]Fix PR48394: need to capture variables used in atomic constructs.

The variables used in atomic construct should be captured in outer
task-based regions implicitly. Otherwise, the compiler will crash trying
to find the address of the local variable.

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

3 years ago[libc++] fix std::sort(T**, T**)
Brett Gutstein [Fri, 4 Dec 2020 21:05:03 +0000 (16:05 -0500)]
[libc++] fix std::sort(T**, T**)

previously, invocations of std::sort(T**, T**) casted the arguments to
(size_t *). this breaks sorting on systems for which pointers don't fit
in a size_t. change the cast to (uintptr_t *) and add a test.

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

3 years ago[Tooling] JSONCompilationDatabase::loadFromBuffer retains the buffer, copy it.
Sam McCall [Fri, 4 Dec 2020 10:34:30 +0000 (11:34 +0100)]
[Tooling] JSONCompilationDatabase::loadFromBuffer retains the buffer, copy it.

This function doesn't seem to be used in-tree outside tests.
However clangd wants to use it soon, and having the CDB be self-contained seems
reasonable.

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

3 years agoADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC
Duncan P. N. Exon Smith [Wed, 2 Dec 2020 23:33:08 +0000 (15:33 -0800)]
ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC

Prepare to delete `AlignedCharArrayUnion` by migrating its users over to
`std::aligned_union_t`.

I will delete `AlignedCharArrayUnion` and its tests in a follow-up
commit so that it's easier to revert in isolation in case some
downstream wants to keep using it.

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

3 years ago[dfsan] Add a test case of storing zero
Jianzhou Zhao [Fri, 4 Dec 2020 05:39:37 +0000 (05:39 +0000)]
[dfsan] Add a test case of storing zero

This covers a branch in storeShadow.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D92632

3 years ago[flang][openacc] Add clause validaty tests for data construct + fix default restriction
Valentin Clement [Fri, 4 Dec 2020 20:12:05 +0000 (15:12 -0500)]
[flang][openacc] Add clause validaty tests for data construct + fix default restriction

Add clause validity tests for the data construct. The default clause can appear only once
and this was not enforce in the ACC.td.

Reviewed By: sameeranjoshi

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

3 years ago[clang-format] NFC update in the overall clang-formatted status
mydeveloperday [Fri, 4 Dec 2020 20:07:54 +0000 (20:07 +0000)]
[clang-format] NFC  update in the overall clang-formatted status

The current state of the clang-formatted-ness of the LLVM project hasn't been updated since June bring it upto date

3 years agoRevert "[flang][openacc] Add clause validity tests for the update directive"
clementval [Fri, 4 Dec 2020 20:06:22 +0000 (15:06 -0500)]
Revert "[flang][openacc] Add clause validity tests for the update directive"

This reverts commit e46065433466eec50903fec6f40a09cf26fa801e.

3 years ago[CUDA] Another attempt to fix early inclusion of <new> from libstdc++
Artem Belevich [Fri, 4 Dec 2020 19:27:39 +0000 (11:27 -0800)]
[CUDA] Another attempt to fix early inclusion of <new> from libstdc++

Previous patch (9a465057a64dba) did not fix the problem.
https://bugs.llvm.org/show_bug.cgi?id=48228

If the <new> is included too early, before CUDA-specific defines are available,
just include-next the standard <new> and undo the include guard.  CUDA-specific
variants of operator new/delete will be declared if/when <new> is used from the
CUDA source itself, when all CUDA-related macros are available.

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

3 years agoADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 02:37:59 +0000 (18:37 -0800)]
ADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC

All the users of `AlignedCharArrayUnion` were changed in
5b267fb7966157e0d79ea85cbc1d07f92f840d3c to stop peeking inside (to look
at `buffer`), so this finishes gutting it. It's now an alias of
`std::aligned_union_t`, with a minor difference in template parameters
(`std::aligned_union_t` takes a minimum size and 0+ types, whereas this
just takes 1+ types... maybe a bit simpler to use correctly?).

A follow up will remove `AlignedCharArrayUnion` entirely, inlining this
alias into its users.

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

3 years ago[RISCV] Initial infrastructure for code generation of the RISC-V V-extension
Craig Topper [Tue, 1 Dec 2020 03:48:24 +0000 (19:48 -0800)]
[RISCV] Initial infrastructure for code generation of the RISC-V V-extension

The companion RFC (http://lists.llvm.org/pipermail/llvm-dev/2020-October/145850.html) gives lots of details on the overall strategy, but we summarize it here:

LLVM IR involving vector types is going to be selected using pseudo instructions (only MachineInstr). These pseudo instructions contain dummy operands to represent the vector type being operated and the vector length for the operation.
These two dummy operands, as set by instruction selection, will be used by the custom inserter to prepend every operation with an appropriate vsetvli instruction that ensures the vector architecture is properly configured for the operation. Not in this patch: later passes will remove the redundant vsetvli instructions.
Register classes of tuples of vector registers are used to represent vector register groups (LMUL > 1).
Those pseudos are eventually lowered into the actual instructions when emitting the MCInsts.
About the patch:

Because there is a bit of initial infrastructure required, this is the minimal patch that allows us to select instructions for 3 LLVM IR instructions: load, add and store vectors of integers. LLVM IR operations have "whole-vector" semantics (as in they generate values for all the elements).

Later patches will extend the information represented in TableGen.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Evandro Menezes <evandro.menezes@sifive.com>
Co-Authored-by: Craig Topper <craig.topper@sifive.com>
Differential Revision: https://reviews.llvm.org/D89449

3 years ago[flang][openacc] Add clause validity tests for the update directive
Valentin Clement [Fri, 4 Dec 2020 19:38:31 +0000 (14:38 -0500)]
[flang][openacc] Add clause validity tests for the update directive

Add couple of clause validity tests for the update directive and check for
the restriction where at least self, host or device clause must appear on the directive.

Reviewed By: sameeranjoshi

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

3 years agoAttempt to fix buildbot after rG993eaf2d69d8
Evgeny Leviant [Fri, 4 Dec 2020 19:10:36 +0000 (22:10 +0300)]
Attempt to fix buildbot after rG993eaf2d69d8

3 years agoADT: Stop peeking inside AlignedCharArrayUnion, NFC
Duncan P. N. Exon Smith [Wed, 2 Dec 2020 21:44:16 +0000 (13:44 -0800)]
ADT: Stop peeking inside AlignedCharArrayUnion, NFC

Update all the users of `AlignedCharArrayUnion` to stop peeking inside
(to look at `buffer`) so that a follow-up patch can replace it with an
alias to `std::aligned_union_t`.

This was reviewed as part of https://reviews.llvm.org/D92512, but I'm
splitting this bit out to commit first to reduce churn in case the
change to `AlignedCharArrayUnion` needs to be reverted for some
unexpected reason.

3 years agoFix for Bug 48055.
Hiroshi Yamauchi [Thu, 3 Dec 2020 19:04:19 +0000 (11:04 -0800)]
Fix for Bug 48055.

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

3 years ago[libc++] [test] Disable parts of path.factory.pass.cpp as requiring localization...
Marek Kurdej [Fri, 4 Dec 2020 19:04:09 +0000 (20:04 +0100)]
[libc++] [test] Disable parts of path.factory.pass.cpp as requiring localization enabled.

It was added in commit 6be11e35d5397ae1c117eb840a969585fdd7d08d, "[libcxx] Implement c++2a char8_t input/output of std::filesystem::path".

3 years ago[TEST]Autogenerate test checks, NFC.
Alexey Bataev [Fri, 4 Dec 2020 18:56:28 +0000 (10:56 -0800)]
[TEST]Autogenerate test checks, NFC.

3 years ago[libc++] [test] Mark path.charconv.pass.cpp as requiring localization enabled.
Marek Kurdej [Fri, 4 Dec 2020 18:58:48 +0000 (19:58 +0100)]
[libc++] [test] Mark path.charconv.pass.cpp as requiring localization enabled.

It was added in commit 0b71bf793924301d53cf01eeb0a27e96fea17791, "[libcxx] [test] Add a test for conversions between wchar_t, utf8, char16_t, char32_t and windows native narrow code pages"

3 years agoRecommit [TableGen][SchedModels] Fix read/write variant substitution
Evgeny Leviant [Fri, 4 Dec 2020 18:50:34 +0000 (21:50 +0300)]
Recommit [TableGen][SchedModels] Fix read/write variant substitution

Original commit rG112b3cb6ba49 introduced non-determinism in subtarget
generator due to iteration over DenseMap. New patch fixes this changing
ProcModelMapTy from DenseMap to std::map.

3 years ago[AArch64] Add custom lowering for ISD::ABS
Craig Topper [Fri, 4 Dec 2020 18:45:31 +0000 (10:45 -0800)]
[AArch64] Add custom lowering for ISD::ABS

Instead of trying to pattern match the code produced by ISD::ABS expansion, just custom legalize ISD::ABS to the desired sequence.

The one test change is because a DAG combine for (neg (abs)) is no longer firing because ISD::ABS is now Custom instead of Expand.

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

3 years ago[RISCV] Add support for printing pcrel immediates as absolute addresses in llvm-objdump
Craig Topper [Fri, 4 Dec 2020 18:31:23 +0000 (10:31 -0800)]
[RISCV] Add support for printing pcrel immediates as absolute addresses in llvm-objdump

This makes the llvm-objdump output much more readable and closer to binutils objdump. This builds on D76591

It requires changing the OperandType for certain immediates to "OPERAND_PCREL" so tablegen will generate code to pass the instruction's address. This means we can't do the generic check on these instructions in verifyInstruction any more. Should I add it back with explicit opcode checks? Or should we add a new operand flag to control the passing of address instead of matching the name?

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

3 years agoDon't use sysroot/include when sysroot is empty.
Hafiz Abid Qadeer [Fri, 4 Dec 2020 17:45:04 +0000 (17:45 +0000)]
Don't use sysroot/include when sysroot is empty.

Baremetal toolchain add Driver.SysRoot/include to the system include
paths without checking if Driver.SysRoot is empty. This resulted in
"-internal-isystem" "include" in the command. This patch adds check for
empty sysroot.

Reviewed By: jroelofs

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

3 years ago[libc] add tests to WrapperGen
Michael Jones [Thu, 19 Nov 2020 21:11:42 +0000 (21:11 +0000)]
[libc] add tests to WrapperGen

This adds an initial test that can serve as a basis for other tests on
wrappergen.

Reviewed By: sivachandra

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

3 years ago[DAG] Move SelectionDAG implementation to KnownBits::setInReg(). NFCI.
Simon Pilgrim [Fri, 4 Dec 2020 18:08:53 +0000 (18:08 +0000)]
[DAG] Move SelectionDAG implementation to KnownBits::setInReg(). NFCI.

3 years ago[mlir][vector][NFC] Change UnrollVectorPattern to not be statically dependent on...
Thomas Raoux [Fri, 4 Dec 2020 07:44:36 +0000 (23:44 -0800)]
[mlir][vector][NFC] Change UnrollVectorPattern to not be statically dependent on an op type

Make UnrollVectorPattern inherit from RewritePattern instead of
OpRewritePattern so that we don't need to create many patterns when applying to
many different type of ops. Since we may want to apply the pattern to all
arithmetic op, it is more convenient to filter dynamically.

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

3 years ago[clang-format] Improve clang-formats handling of concepts
mydeveloperday [Fri, 4 Dec 2020 17:44:25 +0000 (17:44 +0000)]
[clang-format] Improve clang-formats handling of concepts

This is a starting point to improve the handling of concepts in clang-format. There is currently no real formatting of concepts and this can lead to some odd formatting, e.g.

Reviewed By: mitchell-stellar, miscco, curdeius

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

3 years ago[libc++] [docs] Add Version column to issues tables on status pages.
Marek Kurdej [Fri, 4 Dec 2020 17:41:51 +0000 (18:41 +0100)]
[libc++] [docs] Add Version column to issues tables on status pages.

3 years ago[OpenMP][OMPT] Make sure that 0 is never used as ID in tests (NFC)
Joachim Protze [Fri, 4 Dec 2020 17:41:07 +0000 (18:41 +0100)]
[OpenMP][OMPT] Make sure that 0 is never used as ID in tests (NFC)

3 years ago[MLIR] Fix parseFunctionLikeOp() to fail parsing empty regions
Rahul Joshi [Thu, 3 Dec 2020 00:49:47 +0000 (16:49 -0800)]
[MLIR] Fix parseFunctionLikeOp() to fail parsing empty regions

- Change parseOptionalRegion to return an OptionalParseResult.
- Change parseFunctionLikeOp() to fail parsing if the function body was parsed but was
  empty.
- See https://llvm.discourse.group/t/funcop-parsing-bug/2164

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

3 years ago[MLIR] Generate inferReturnTypes declaration using InferTypeOpInterface trait.
Rahul Joshi [Fri, 4 Dec 2020 00:18:11 +0000 (16:18 -0800)]
[MLIR] Generate inferReturnTypes declaration using InferTypeOpInterface trait.

- Instead of hardcoding the parameters and return types of 'inferReturnTypes', use the
  InferTypeOpInterface trait to generate the method declaration.
- Fix InferTypeOfInterface to use fully qualified type for inferReturnTypes results.

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

3 years ago[NewPM] Make pass adaptors less templatey
Arthur Eubanks [Fri, 4 Dec 2020 16:30:34 +0000 (08:30 -0800)]
[NewPM] Make pass adaptors less templatey

Currently PassBuilder.cpp is by far the file that takes longest to
compile. This is due to tons of templates being instantiated per pass.

Follow PassManager by using wrappers around passes to avoid making
the adaptors templated on the pass type. This allows us to move various
adaptors' run methods into .cpp files.

This reduces the compile time of PassBuilder.cpp on my machine from 66
to 39 seconds. It also reduces the size of opt from 685M to 676M.

Reviewed By: dexonsmith

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

3 years ago[libomptarget][amdgpu] Fix latent race in load binary
Jon Chesterfield [Fri, 4 Dec 2020 16:29:09 +0000 (16:29 +0000)]
[libomptarget][amdgpu] Fix latent race in load binary

3 years agoFix a test failing on windows
Erik Pilkington [Fri, 4 Dec 2020 16:10:40 +0000 (11:10 -0500)]
Fix a test failing on windows

3 years ago[OPENMP]Fix PR48387: disable warning messages caused by internal conversions.
Alexey Bataev [Fri, 4 Dec 2020 14:17:08 +0000 (06:17 -0800)]
[OPENMP]Fix PR48387: disable warning messages caused by internal conversions.

Compiler needs to convert some of the loop iteration
variables/conditions to different types for better codegen and it may
lead to spurious warning messages about implicit signed/unsigned
conversions.

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

3 years ago[PowerPC] Regenerate p10-vector-rotate.ll
Simon Pilgrim [Fri, 4 Dec 2020 15:18:32 +0000 (15:18 +0000)]
[PowerPC] Regenerate p10-vector-rotate.ll

Reorder check-prefixes to stop update_llc_test_checks.py complaining

3 years agofix typos to cycle bots
Nico Weber [Fri, 4 Dec 2020 15:18:44 +0000 (10:18 -0500)]
fix typos to cycle bots

3 years ago[gn build] Port c8ec685ca55
LLVM GN Syncbot [Fri, 4 Dec 2020 15:06:48 +0000 (15:06 +0000)]
[gn build] Port c8ec685ca55

3 years ago[Sema] Fold VLAs to constant arrays in a few more contexts
Erik Pilkington [Thu, 3 Dec 2020 15:01:53 +0000 (10:01 -0500)]
[Sema] Fold VLAs to constant arrays in a few more contexts

552c6c2 removed support for promoting VLAs to constant arrays when the bounds
isn't an ICE, since this can result in miscompiling a conforming program that
assumes that the array is a VLA. Promoting VLAs for fields is still supported,
since clang doesn't support VLAs in fields, so no conforming program could have
a field VLA.

This change is really disruptive, so this commit carves out two more cases
where we promote VLAs which can't miscompile a conforming program:

 - When the VLA appears in an ivar -- this seems like a corollary to the field thing
 - When the VLA has an initializer -- VLAs can't have an initializer

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

3 years ago[llvm-exegesis][PowerPC] Add more register classes
Jinsong Ji [Fri, 4 Dec 2020 14:07:52 +0000 (14:07 +0000)]
[llvm-exegesis][PowerPC] Add more register classes

This PR adds more register class support in PowerPC,
mark OperandType for imm and memory operands.

Also added more unit tests for SnippetGenerator.

Reviewed By: #powerpc, steven.zhang

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

3 years ago[mlir][Linalg] NFC - Expose tiling canonicalization patterns through a populate method
Nicolas Vasilache [Fri, 4 Dec 2020 14:22:00 +0000 (14:22 +0000)]
[mlir][Linalg] NFC - Expose tiling canonicalization patterns through a populate method

3 years ago[AST][NFC] Silence GCC warning about broken strict aliasing rules
Thomas Preud'homme [Mon, 30 Nov 2020 17:02:12 +0000 (17:02 +0000)]
[AST][NFC] Silence GCC warning about broken strict aliasing rules

The deserialize() method would trigger the following warning on GCC <7:

   warning: dereferencing type-punned pointer will break
       strict-aliasing rules [-Wstrict-aliasing]

       ParamIdx P(*reinterpret_cast<ParamIdx *>(&S));
                                                  ^

&S was previously reinterpret_casted from a ParamIdx into a SerialType,
it is therefore safe to cast back into a ParamIdx. Similar to what was
done in D50608, we replace it with two static_cast via void * which
silences the warning and presumably makes GCC understand that no
strict-aliasing violation is happening.

No functional change intended.

Reviewed By: aaron.ballman

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

3 years ago[OpenMP] Add __kmpc_omp_target_task_alloc to dllexport
Hansang Bae [Thu, 3 Dec 2020 23:52:07 +0000 (17:52 -0600)]
[OpenMP] Add __kmpc_omp_target_task_alloc to dllexport

This patch enables use of the entry on Windows.

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

3 years ago[mlir][Linalg] Properly use distribution options.
Nicolas Vasilache [Fri, 4 Dec 2020 13:51:30 +0000 (13:51 +0000)]
[mlir][Linalg] Properly use distribution options.

Let tiling to scf.for actually use the distribution method.
For now only Cyclic is supported.

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

3 years ago[mac/lld] Add support for the LC_LINKER_OPTION load command in o files
Nico Weber [Thu, 3 Dec 2020 21:40:04 +0000 (16:40 -0500)]
[mac/lld] Add support for the LC_LINKER_OPTION load command in o files

clang puts `-framework CoreFoundation` in this load command for files
that use @available / __builtin_available. Without support for this,
binaries that don't explicitly link to CoreFoundation fail to link.

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

3 years ago[HIP] Fix bug in driver about wavefront size
Yaxun (Sam) Liu [Fri, 4 Dec 2020 02:56:35 +0000 (21:56 -0500)]
[HIP] Fix bug in driver about wavefront size

The static variable causes it only initialized once and take
the same value for different GPU archs, whereas they
may be different for different GPU archs, e.g. when
there are both gfx900 and gfx1010.

Removing static fixes that.

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

3 years agoRemove typeConverter from ConvertToLLVMPattern and use the existing one in Conversion...
Christian Sigg [Thu, 3 Dec 2020 11:34:26 +0000 (12:34 +0100)]
Remove typeConverter from ConvertToLLVMPattern and use the existing one in ConversionPattern.

ftynse

Reviewed By: ftynse

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

3 years ago[llvm-profgen] - Fix compilation issue after ELFFile<ELFT> interface update.
Georgii Rymar [Fri, 4 Dec 2020 13:09:25 +0000 (16:09 +0300)]
[llvm-profgen] - Fix compilation issue after ELFFile<ELFT> interface update.

`D92560` changed `ELFObjectFile::getELFFile` to return reference.

3 years ago[lib/Object, tools] - Make ELFObjectFile::getELFFile return reference.
Georgii Rymar [Thu, 3 Dec 2020 09:57:00 +0000 (12:57 +0300)]
[lib/Object, tools] - Make ELFObjectFile::getELFFile return reference.

We always have an object, so we don't have to return a pointer.

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

3 years ago[VE] Add vfadd, vfsub, vfmul, and vfdiv intrinsic instructions
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 11:12:10 +0000 (20:12 +0900)]
[VE] Add vfadd, vfsub, vfmul, and vfdiv intrinsic instructions

Add vfadd, vfsub, vfmul, and vfdiv intrinsic instructions and
regression tests.

Reviewed By: simoll

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

3 years ago[X86] LowerRotate - enable custom lowering of ROTL/ROTR vXi16 on VBMI2 targets.
Simon Pilgrim [Fri, 4 Dec 2020 12:13:19 +0000 (12:13 +0000)]
[X86] LowerRotate - enable custom lowering of ROTL/ROTR vXi16 on VBMI2 targets.

3 years ago[IR] Disallow scalable vectors in ShuffleVectorInst::isExtractSubvectorMask
Cullen Rhodes [Mon, 30 Nov 2020 11:35:46 +0000 (11:35 +0000)]
[IR] Disallow scalable vectors in ShuffleVectorInst::isExtractSubvectorMask

It's not possible to express an extract subvector shuffle mask for
a scalable vector.

Reviewed By: david-arm

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

3 years ago[X86] LowerRotate - VBMI2 targets can lower vXi16 rotates using funnel shifts.
Simon Pilgrim [Fri, 4 Dec 2020 11:29:09 +0000 (11:29 +0000)]
[X86] LowerRotate - VBMI2 targets can lower vXi16 rotates using funnel shifts.

Ideally we'd do this inside DAGCombine but until we can make the FSHL/FSHR opcodes legal for VBMI2 it won't help us.

3 years ago[clangd] Fix an assertion violation in rename.
Haojian Wu [Fri, 4 Dec 2020 11:23:26 +0000 (12:23 +0100)]
[clangd] Fix an assertion violation in rename.

NamedDecl::getName() asserts the name must be an identifier.

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

3 years ago[X86] Let VBMI2 non-VLX targets still use funnel shifts instructions
Simon Pilgrim [Fri, 4 Dec 2020 11:06:21 +0000 (11:06 +0000)]
[X86] Let VBMI2 non-VLX targets still use funnel shifts instructions

3 years ago[yaml2obj,obj2yaml] - Make Symbol::Section field optional.
Georgii Rymar [Thu, 3 Dec 2020 11:40:06 +0000 (14:40 +0300)]
[yaml2obj,obj2yaml] - Make Symbol::Section field optional.

This is similar to what we did earlier for fields of the Section class.

When a field is optional we can use the =<none> syntax in macros.

This was splitted from D92478.

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

3 years ago[lldb] Remove LLDB session dir and just store test traces in the respective test...
Raphael Isemann [Fri, 4 Dec 2020 10:42:36 +0000 (11:42 +0100)]
[lldb] Remove LLDB session dir and just store test traces in the respective test build directory

Test runs log some of their output to files inside the LLDB session dir. This
session dir is shared between all tests, so all the tests have to make sure they
choose a unique file name inside that directory. We currently choose by default
`<test-class-name>-<test-method-name>` as the log file name. However, that means
that if not every test class in the test suite has a unique class name, then we
end up with a race condition as two tests will try to write to the same log
file.

I already tried in D83767 changing the format to use the test file basename
instead (which we already require to be unique for some other functionality),
but it seems the code for getting the basename didn't work on Windows.

This patch instead just changes that dotest stores the log files in the build
directory for the current test. We know that directory is unique for this test,
so no need to generate some unique file name now. Also removes all the
environment vars and parameters related to the now unused session dir.

The new log paths now look like this for a failure in 'TestCppOperators`:
```
./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_dwarf/Failure.log
./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_dsym/Failure.log
./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_gmodules/Failure.log
```

Reviewed By: labath

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

3 years ago[llvm-readobj] - Report unique warnings in printProgramHeaders.
Georgii Rymar [Thu, 3 Dec 2020 12:07:28 +0000 (15:07 +0300)]
[llvm-readobj] - Report unique warnings in printProgramHeaders.

This converts `reportWarning` -> `reportUniqueWarning`

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

3 years ago[lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget
Raphael Isemann [Fri, 4 Dec 2020 09:26:03 +0000 (10:26 +0100)]
[lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget

Also add some documentation while I'm at it.

3 years ago[PowerPC] Fix the regression caused by commit 9c588f53fc42
QingShan Zhang [Fri, 4 Dec 2020 10:22:13 +0000 (10:22 +0000)]
[PowerPC] Fix the regression caused by commit 9c588f53fc42

Add a TypeLegal check for MVT::i1 and add the test.

3 years ago[DAGCombiner] Use const APInt& for getConstantOperandAPInt results. NFCI.
Simon Pilgrim [Thu, 3 Dec 2020 11:55:59 +0000 (11:55 +0000)]
[DAGCombiner] Use const APInt& for getConstantOperandAPInt results. NFCI.

Avoid unnecessary instantiation.

Noticed while removing unnecessary autos

3 years ago[X86] Remove unnecessary bitcast. NFC.
Simon Pilgrim [Thu, 3 Dec 2020 11:53:34 +0000 (11:53 +0000)]
[X86] Remove unnecessary bitcast. NFC.

The X86ISD::SUBV_BROADCAST node is already VT

3 years ago[X86] Regenerate midpoint-int.ll tests
Simon Pilgrim [Thu, 3 Dec 2020 11:52:27 +0000 (11:52 +0000)]
[X86] Regenerate midpoint-int.ll tests

Replace X32 check prefixes with X86 - X32 is generally used for gnux triple tests

3 years ago[libcxx] [test] Add a test for conversions between wchar_t, utf8, char16_t, char32_t...
Martin Storsjö [Sat, 24 Oct 2020 21:48:12 +0000 (00:48 +0300)]
[libcxx] [test] Add a test for conversions between wchar_t, utf8, char16_t, char32_t and windows native narrow code pages

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

3 years ago[libcxx] Implement c++2a char8_t input/output of std::filesystem::path
Martin Storsjö [Mon, 26 Oct 2020 11:18:46 +0000 (13:18 +0200)]
[libcxx] Implement c++2a char8_t input/output of std::filesystem::path

This implements the std::filesystem parts of P0482 (which is already
marked as in progress), and applies the actions that are suggested
in P1423.

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

3 years ago[clang] [Headers] Use the corresponding _aligned_free or __mingw_aligned_free in...
Martin Storsjö [Thu, 3 Dec 2020 11:58:04 +0000 (13:58 +0200)]
[clang] [Headers] Use the corresponding _aligned_free or __mingw_aligned_free in _mm_free

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

3 years ago[NFC][NARY-REASSOCIATE] Restructure code to aviod isPotentiallyReassociatable
Evgeniy Brevnov [Fri, 25 Sep 2020 04:46:20 +0000 (11:46 +0700)]
[NFC][NARY-REASSOCIATE] Restructure code to aviod isPotentiallyReassociatable

Currently we have to duplicate the same checks in isPotentiallyReassociatable and tryReassociate. With simple pattern like add/mul this may be not a big deal. But the situation gets much worse when I try to add support for min/max. Min/Max may be represented by several instructions and can take different forms. In order reduce complexity for upcoming min/max support we need to restructure the code a bit to avoid mentioned code duplication.

Reviewed By: mkazantsev

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

3 years ago[NARY-REASSOCIATE] Simplify traversal logic by post deleting dead instructions
Evgeniy Brevnov [Fri, 25 Sep 2020 04:37:19 +0000 (11:37 +0700)]
[NARY-REASSOCIATE] Simplify traversal logic by post deleting dead instructions

Currently we delete optimized instructions as we go. That has several negative consequences. First it complicates traversal logic itself. Second if newly generated instruction has been deleted the traversal is repeated from scratch.

But real motivation for the change is upcoming change with support for min/max reassociation. Here we employ SCEV expander to generate code. As a result newly generated instructions may be inserted not right before original instruction (because SCEV may do hoisting) and there is no way to know 'next' instruction.

Reviewed By: mkazantsev

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

3 years ago[lldb][NFC] Rename TypeSystemClangForExpressions to ScratchTypeSystemClang
Raphael Isemann [Fri, 4 Dec 2020 08:17:51 +0000 (09:17 +0100)]
[lldb][NFC] Rename TypeSystemClangForExpressions to ScratchTypeSystemClang

We keep referring to the single object created by this class as
'scratch AST/Context/TypeSystem' so at this point we might as well rename the
class. It's also not involved at all in expression evaluation, so the
'ForExpressions' prefix is a bit misleading.

3 years ago[clang] Add a C++17 deduction guide testcase.
Haojian Wu [Fri, 4 Dec 2020 08:02:04 +0000 (09:02 +0100)]
[clang] Add a C++17 deduction guide testcase.

From https://bugs.llvm.org/show_bug.cgi?id=47219.

It was crashing before the commit 1e14588d0f68.

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

3 years ago[JumpThreading] Call eraseBlock when folding a conditional branch
Kazu Hirata [Fri, 4 Dec 2020 07:50:17 +0000 (23:50 -0800)]
[JumpThreading] Call eraseBlock when folding a conditional branch

This patch teaches the jump threading pass to call BPI->eraseBlock
when it folds a conditional branch.

Without this patch, BranchProbabilityInfo could end up with stale edge
probabilities for the basic block containing the conditional branch --
one edge probability with less than 1.0 and the other for a removed
edge.

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

3 years ago[mlir][Linalg] Handle fusion on tensors for projected permutation.
Hanhan Wang [Fri, 4 Dec 2020 07:10:20 +0000 (23:10 -0800)]
[mlir][Linalg] Handle fusion on tensors for projected permutation.

In the past, the reshape op can be folded only if the indexing map is
permutation in consumer's usage. We can relax to condition to be projected
permutation.

This patch still limits the fusion for scalar cases. Scalar case is a corner
case, because we need to decide where to put extra dims.

Reviewed By: mravishankar

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

3 years ago[PowerPC] Pre-commit neg abs test for vector. NFC.
Kai Luo [Fri, 4 Dec 2020 06:42:30 +0000 (06:42 +0000)]
[PowerPC] Pre-commit neg abs test for vector. NFC.

3 years agoReturn "[IndVars] ICmpInst should not prevent IV widening"
Max Kazantsev [Fri, 4 Dec 2020 04:59:07 +0000 (11:59 +0700)]
Return "[IndVars] ICmpInst should not prevent IV widening"

This reverts commit 4bd35cdc3ae1874c6d070c5d410b3f591de54ee6.

The patch was reverted during the investigation. The investigation
shown that the patch did not cause any trouble, but just exposed
the existing problem that is addressed by the previous patch
"[IndVars] Quick fix LHS/RHS bug". Returning without changes.

3 years ago[IndVars] Quick fix LHS/RHS bug
Max Kazantsev [Fri, 4 Dec 2020 04:57:39 +0000 (11:57 +0700)]
[IndVars] Quick fix LHS/RHS bug

The code relies on fact that LHS is the NarrowDef but never
really checks it. Adding the conservative restrictive check,
will follow-up with handling of case where RHS is a NarrowDef.

3 years agoFix -allow-deprecated-dag-overlap in test/CodeGen/dso-local-executable.c
Fangrui Song [Fri, 4 Dec 2020 05:24:38 +0000 (21:24 -0800)]
Fix -allow-deprecated-dag-overlap in test/CodeGen/dso-local-executable.c

3 years agoPR48383: Disallow decltype(auto) in pseudodestructor calls
David Blaikie [Fri, 4 Dec 2020 04:40:37 +0000 (20:40 -0800)]
PR48383: Disallow decltype(auto) in pseudodestructor calls

3 years ago[tools] Update update_test_prefix.py to handle %s after prefixes
Mircea Trofin [Thu, 3 Dec 2020 05:32:28 +0000 (21:32 -0800)]
[tools] Update update_test_prefix.py to handle %s after prefixes

Sometimes the check-prefixes is followed by %s, and we want to keep a
white space before it.

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

3 years ago[NFC] [Clang] Fix ppc64le vaarg OpenMP test in CodeGen
Qiu Chaofan [Fri, 4 Dec 2020 03:28:18 +0000 (11:28 +0800)]
[NFC] [Clang] Fix ppc64le vaarg OpenMP test in CodeGen

Reviewed By: MaskRay

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

3 years ago[dfsan] Support passing non-i16 shadow values in TLS mode
Jianzhou Zhao [Wed, 2 Dec 2020 01:14:31 +0000 (01:14 +0000)]
[dfsan] Support passing non-i16 shadow values in TLS mode

This is a child diff of D92261.

It extended TLS arg/ret to work with aggregate types.

For a function
  t foo(t1 a1, t2 a2, ... tn an)
Its arguments shadow are saved in TLS args like
  a1_s, a2_s, ..., an_s
TLS ret simply includes r_s. By calculating the type size of each shadow
value, we can get their offset.

This is similar to what MSan does. See __msan_retval_tls and __msan_param_tls
from llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp.

Note that this change does not add test cases for overflowed TLS
arg/ret because this is hard to test w/o supporting aggregate shdow
types. We will be adding them after supporting that.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D92440

3 years agoIntrusiveRefCntPtr: Ensure RefCount is initialized during ThreadSafeRefCountedBase...
David Blaikie [Fri, 4 Dec 2020 02:23:13 +0000 (18:23 -0800)]
IntrusiveRefCntPtr: Ensure RefCount is initialized during ThreadSafeRefCountedBase copy construction

Post commit feedback on 2e83ccc2ee33 from Nathan James!

3 years agoUse isIgnored instead of checking pass name
Arthur Eubanks [Fri, 4 Dec 2020 01:38:00 +0000 (17:38 -0800)]
Use isIgnored instead of checking pass name

In preparation for https://reviews.llvm.org/D92616 which will remove
angle brackets from pass manager/adaptor names.

Reviewed By: dexonsmith, thakis

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

3 years ago[mac/lld] Run tests with -fatal_warnings by default
Nico Weber [Thu, 3 Dec 2020 14:35:25 +0000 (09:35 -0500)]
[mac/lld] Run tests with -fatal_warnings by default

This helps us catch cases where we add support for a flag but forget to
remove HelpHidden from Options.td.

More explicit alternative to D92455

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

3 years ago[lld][WebAssembly] Set memory limits correctly for PIC + shared memory
Sam Clegg [Thu, 3 Dec 2020 01:14:57 +0000 (17:14 -0800)]
[lld][WebAssembly] Set memory limits correctly for PIC + shared memory

Don't early return from layoutMemory in PIC mode before we have set the
memory limits.

This matters in particular with shared-memory + PIC because shared
memories require maximum size.

Secondly, when we need a maximum, but the user does not supply one,
default to MAX_INT rather than 0 (defaulting to zero is completely
useless and means that building with -shared didn't previously work at
all without --maximum-memory, because zero is never big enough).

This is part of an ongoing effort to enable dynamic linking with
threads in emscripten.

See https://github.com/emscripten-core/emscripten/issues/3494

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

3 years agoSupport: Change InMemoryFileSystem::addFileNoOwn to take a MemoryBufferRef, NFC
Duncan P. N. Exon Smith [Thu, 5 Nov 2020 23:23:19 +0000 (18:23 -0500)]
Support: Change InMemoryFileSystem::addFileNoOwn to take a MemoryBufferRef, NFC

Found this by chance when looking at the InMemoryFileSystem API, seems
like an easy cleanup.

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

3 years ago[mlir][Attributes][NFC] Move all builtin Attribute classes to BuiltinAttributes.h
River Riddle [Fri, 4 Dec 2020 01:22:57 +0000 (17:22 -0800)]
[mlir][Attributes][NFC] Move all builtin Attribute classes to BuiltinAttributes.h

This mirrors the file structure of Types.

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