platform/upstream/llvm.git
3 years ago[llvm-reduce] ReduceGlobalVarInitializers delta pass: fix handling of globals w/...
Roman Lebedev [Thu, 7 Jan 2021 14:28:25 +0000 (17:28 +0300)]
[llvm-reduce] ReduceGlobalVarInitializers delta pass: fix handling of globals w/ comdat/non-external linkage

Much like with ReduceFunctionBodies delta pass,
we need to remove comdat and set linkage to external,
else verifier will complain, and our deltas are invalid.

3 years ago[SplitEdge] Add new parameter to SplitEdge to name the newly created basic block
Sidharth Baveja [Thu, 7 Jan 2021 14:49:23 +0000 (14:49 +0000)]
[SplitEdge] Add new parameter to SplitEdge to name the newly created basic block

Summary:
Currently SplitEdge does not support passing in parameter which allows you to
name the newly created BasicBlock.

This patch updates the function such that the name of the block can be passed
in, if users of this utility decide to do so.

Reviewed By: Whitney, bmahjour, asbirlea, jamieschmeiser

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

3 years ago[TableGen] Add field kind to the RecordVal class.
Paul C. Anagnostopoulos [Thu, 31 Dec 2020 19:50:51 +0000 (14:50 -0500)]
[TableGen] Add field kind to the RecordVal class.

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

3 years ago[flang][openacc] Enforce delcare directive restriction
Valentin Clement [Thu, 7 Jan 2021 14:25:00 +0000 (09:25 -0500)]
[flang][openacc] Enforce delcare directive restriction

Add semantic check for most of the restrictions for the declare directive.

Reviewed By: kiranktp

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

3 years ago[AArch64] SVEIntrinsicOpts - use range loop and cast<> instead of dyn_cast<> for...
Simon Pilgrim [Thu, 7 Jan 2021 14:21:29 +0000 (14:21 +0000)]
[AArch64] SVEIntrinsicOpts - use range loop and cast<> instead of dyn_cast<> for dereferenced pointer. NFCI.

Don't directly dereference a dyn_cast<> - use cast<> so we assert for the correct type.

Also, simplify the for loop to a range loop.

Fixes clang static analyzer warning.

3 years ago[Analysis] MemoryDepChecker::couldPreventStoreLoadForward - remove dead store. NFCI.
Simon Pilgrim [Thu, 7 Jan 2021 13:58:13 +0000 (13:58 +0000)]
[Analysis] MemoryDepChecker::couldPreventStoreLoadForward - remove dead store. NFCI.

As we're breaking from the loop when clamping MaxVF, clang static analyzer was warning that the VF iterator was being updated and never used.

3 years ago[flang][driver] Rename driver tests (nfc)
Andrzej Warzynski [Thu, 7 Jan 2021 14:03:39 +0000 (14:03 +0000)]
[flang][driver] Rename driver tests (nfc)

As per [1]:
```
File names should use dashes, not underscores.
```

This patch updates the names of Flang driver tests accordingly.

[1] https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md

3 years ago[AArch64][CostModel]Fix gather scatter cost model
Caroline Concatto [Thu, 7 Jan 2021 09:07:06 +0000 (09:07 +0000)]
[AArch64][CostModel]Fix gather scatter cost model

This patch fixes a bug introduced in the patch:
https://reviews.llvm.org/D93030

This patch pulls the test for scalable vector to be the first instruction
to be checked. This avoids the Gather and Scatter cost model for AArch64 to
compute the number of vector elements for something that is not a vector and
therefore crashing.

3 years ago[clang][cli] NFC: Make parsing macro reusable
Jan Svoboda [Wed, 6 Jan 2021 14:18:43 +0000 (15:18 +0100)]
[clang][cli] NFC: Make parsing macro reusable

This is necessary for a future patch, where we start using this macro in another function.

Reviewed By: dexonsmith

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

3 years ago[mlir] remove a use of deprecated OpState::setAttr
Alex Zinenko [Thu, 7 Jan 2021 13:19:30 +0000 (14:19 +0100)]
[mlir] remove a use of deprecated OpState::setAttr

3 years ago[clang][cli] NFC: Move parseSimpleArgs
Jan Svoboda [Wed, 6 Jan 2021 13:58:19 +0000 (14:58 +0100)]
[clang][cli] NFC: Move parseSimpleArgs

This patch moves `parseSimpleArgs` closer to `ParseDiagnosticArgs` so that sharing the parsing macro between them can be done more locally in a future patch.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] NFC: Ensure non-null DiagnosticsEngine in ParseDiagnosticArgs
Jan Svoboda [Tue, 22 Dec 2020 14:05:16 +0000 (15:05 +0100)]
[clang][cli] NFC: Ensure non-null DiagnosticsEngine in ParseDiagnosticArgs

Before this patch, ParseDiagnosticArgs can be called with a nullptr DiagnosticsEngine *. This happens early on in the compilation process, where no proper DiagnosticEngine exists, because the diagnostic options (passed through command line) are not known yet.

This patch ensures nullptr is replaced by an ignoring DiagnosticEngine in ParseDiagnosticArgs, which allows to switch from pointer to a reference in some utility functions.

Besides simplifying the code, this patch enables a future patch (D84673) that ports diagnostic options to the new marshalling infrastructure.

Reviewed By: dexonsmith

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

3 years ago[mlir] Add fastmath flags support to some LLVM dialect ops
Ivan Butygin [Thu, 7 Jan 2021 12:56:37 +0000 (13:56 +0100)]
[mlir] Add fastmath flags support to some LLVM dialect ops

Add fastmath enum, attributes to some llvm dialect ops, `FastmathFlagsInterface` op interface, and `translateModuleToLLVMIR` support.

Reviewed By: ftynse

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

3 years ago[llvm-objdump] Pass Twine by const reference instead of by value. NFCI.
Simon Pilgrim [Thu, 7 Jan 2021 12:34:11 +0000 (12:34 +0000)]
[llvm-objdump] Pass Twine by const reference instead of by value. NFCI.

3 years ago[DWARF] DWARFDebugLoc::dumpRawEntry - remove dead stores. NFCI.
Simon Pilgrim [Thu, 7 Jan 2021 12:23:01 +0000 (12:23 +0000)]
[DWARF] DWARFDebugLoc::dumpRawEntry - remove dead stores. NFCI.

Don't bother zeroing local (unused) variables just before returning.

Fixes clang static analyzer warning.

3 years ago[CompilationDatabase] Pass Twine by const reference instead of by value. NFCI.
Simon Pilgrim [Thu, 7 Jan 2021 12:15:01 +0000 (12:15 +0000)]
[CompilationDatabase] Pass Twine by const reference instead of by value. NFCI.

3 years ago[SLP]Need shrink the load vector after reordering.
Alexey Bataev [Fri, 1 Jan 2021 16:43:33 +0000 (08:43 -0800)]
[SLP]Need shrink the load vector after reordering.

After merging the shuffles, we cannot rely on the previous shuffle
anymore and need to shrink the final shuffle, if it is required.

Reported in D92668

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

3 years ago[clangd] Add server capability advertising hot-reloading of CDBs.
Sam McCall [Thu, 7 Jan 2021 10:40:33 +0000 (11:40 +0100)]
[clangd] Add server capability advertising hot-reloading of CDBs.

Currently some clients watch for CDB changes and restart clangd, now that we
can reload compile_commands.json ourselves this is counterproductive.
The capability allows this behavior to be phased out.

This is going to be a mild regression, as we do not actually watch for files on
disk and so new diagnostics need to wait until a rebuild is requested e.g. due
to file change (and the internal caches have expired).
However this is still a better tradeoff (and if it's important, we can request
the client to watch files for us in the future).

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

3 years ago[mlir] Refactor translation of OpenMP dialect ops to LLVM IR
Alex Zinenko [Tue, 5 Jan 2021 15:04:00 +0000 (16:04 +0100)]
[mlir] Refactor translation of OpenMP dialect ops to LLVM IR

The original implementation of the OpenMP dialect to LLVM IR translation has
been relying on a stack of insertion points for delayed insertion of branch
instructions that correspond to terminator ops. This is an intrusive into
ModuleTranslation and makes the translation non-local. A recent addition of the
WsLoop translation exercised another approach where the parent op is
responsible for converting terminators of all blocks in its regions. Use this
approach for other OpenMP dialect operations with regions, remove the stack and
deduplicate the code for converting such regions.

Reviewed By: kiranchandramohan

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

3 years ago[libc++] Use c++20 instead of c++2a consistently.
Marek Kurdej [Thu, 7 Jan 2021 11:29:04 +0000 (12:29 +0100)]
[libc++] Use c++20 instead of c++2a consistently.

* The only exception is that the flag -std=c++2a is still used not to break compatibility with older compilers (clang <= 9, gcc <= 9).
* Bump _LIBCPP_STD_VER for C++20 to 20 and use 21 for the future standard (C++2b).

That's a preparation step to add c++2b support to libc++.

Reviewed By: ldionne, #libc

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

3 years ago[libcxx] Mark a test as unsupported for C++03
Mikhail Maltsev [Thu, 7 Jan 2021 12:06:08 +0000 (12:06 +0000)]
[libcxx] Mark a test as unsupported for C++03

The nullptr_t_integral_cast.pass.cpp test is currently xfailed for
C++03, but actually, it only fails with the first version of libc++
ABI.

This patch changes XFAIL to UNSUPPORTED to avoid unexpected passes
with ABI v2 or later.

Reviewed By: ldionne, #libc

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

3 years ago[DAG] Simplify OR(X,SHL(Y,BW/2)) eq/ne 0/-1 'all/any-of' style patterns
Simon Pilgrim [Thu, 7 Jan 2021 12:02:50 +0000 (12:02 +0000)]
[DAG] Simplify OR(X,SHL(Y,BW/2)) eq/ne 0/-1 'all/any-of' style patterns

Attempt to simplify all/any-of style patterns that concatenate 2 smaller integers together into an and(x,y)/or(x,y) + icmp 0/-1 instead.

This is mainly to help some bool predicate reduction patterns where we end up concatenating bool vectors that have been bitcasted to integers.

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

3 years ago[clang][cli] Report the actual argument parsing result
Jan Svoboda [Tue, 22 Dec 2020 14:00:31 +0000 (15:00 +0100)]
[clang][cli] Report the actual argument parsing result

Reviewed By: Bigcheese

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

3 years ago[libc++] [CI] Install Tip-of-Trunk clang.
Marek Kurdej [Thu, 7 Jan 2021 11:02:56 +0000 (12:02 +0100)]
[libc++] [CI] Install Tip-of-Trunk clang.

* Check created symlinks.

Reviewed By: ldionne, #libc

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

3 years ago[clang][cli] Port getAllArgumentValues to the marshalling infrastructure
Jan Svoboda [Tue, 22 Dec 2020 09:01:51 +0000 (10:01 +0100)]
[clang][cli] Port getAllArgumentValues to the marshalling infrastructure

Reviewed By: dexonsmith

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

3 years ago[flang][driver] Add support for `-c` and `-emit-obj`
Andrzej Warzynski [Thu, 7 Jan 2021 09:08:54 +0000 (09:08 +0000)]
[flang][driver] Add support for `-c` and `-emit-obj`

This patch adds a frontend action for emitting object files. While Flang
does not support code-generation, this action remains a placeholder.
This patch simply provides glue-code to connect the compiler driver
with the appropriate frontend action.

The new action is triggered with the `-c` compiler driver flag, i.e.
`flang-new -c`. This is then translated to `flang-new -fc1 -emit-obj`,
so `-emit-obj` has to be marked as supported as well.

As code-generation is not available yet, `flang-new -c` results in a
driver error:
```
error: code-generation is not available yet
```
Hopefully this will help communicating the level of available
functionality within Flang.

The definition of `emit-obj` is updated so that it can be shared between
Clang and Flang. As the original definition was enclosed within a
Clang-specific TableGen `let` statement, it is extracted into a new `let`
statement. That felt like the cleanest option.

I also commented out `-triple` in Flang::ConstructJob and updated some
comments there. This is similar to https://reviews.llvm.org/D93027. I
wanted to make sure that it's clear that we can't support `-triple`
until we have code-generation. However, once code-generation is
available we _will need_ `-triple`.

As this patch adds `-emit-obj`, the emit-obj.f90 becomes irrelevant and
is deleted. Instead, phases.f90 is added to demonstrate that users can
control compilation phases (indeed, `-c` is a phase control flag).

Reviewed By: SouraVX, clementval

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

3 years ago[clang][cli] Port a CommaJoined option to the marshalling infrastructure
Jan Svoboda [Mon, 21 Dec 2020 15:35:32 +0000 (16:35 +0100)]
[clang][cli] Port a CommaJoined option to the marshalling infrastructure

Reviewed By: dexonsmith

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

3 years ago[lldb][ARM/AArch64] Update disasm flags to latest v8.7a ISA
David Spickett [Tue, 5 Jan 2021 11:46:18 +0000 (11:46 +0000)]
[lldb][ARM/AArch64] Update disasm flags to latest v8.7a ISA

Add optional memory tagging extension on AArch64.

Use isAArch64() instead of listing the AArch64 triples,
which fixes us not recognising aarch64_be.

Reviewed By: omjavaid

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

3 years ago[clang][ASTImporter] Fix a possible assertion failure `NeedsInjectedClassNameType...
Balázs Kéri [Thu, 7 Jan 2021 07:41:08 +0000 (08:41 +0100)]
[clang][ASTImporter] Fix a possible assertion failure `NeedsInjectedClassNameType(Decl)'.

The assertion can happen if ASTImporter imports a CXXRecordDecl in a template
and then imports another redeclaration of this declaration, while the first import is in progress.
The process of first import did not set the "described template" yet
and the second import finds the first declaration at setting the injected types.
Setting the injected type requires in the assertion that the described template is set.
The exact assertion was:
clang/lib/AST/ASTContext.cpp:4411:
clang::QualType clang::ASTContext::getInjectedClassNameType(clang::CXXRecordDecl*, clang::QualType) const:
Assertion `NeedsInjectedClassNameType(Decl)' failed.

Reviewed By: shafik

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

3 years agoReapply "[clang][cli] Allow users to specify a conditional to prevent parsing options...
Jan Svoboda [Thu, 7 Jan 2021 09:14:48 +0000 (10:14 +0100)]
Reapply "[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo"

This reverts commit d0fa7a05 and fixes failing OptionMarshallingTest by adding the SHOULD_PARSE macro argument

3 years ago[RISCV] Add vector mask arithmetic ISel patterns
Fraser Cormack [Tue, 5 Jan 2021 11:55:03 +0000 (11:55 +0000)]
[RISCV] Add vector mask arithmetic ISel patterns

The patterns that want to use 'vnot' use a custom PatFrag. This is
because 'vnot' uses immAllOnesV which implicitly uses BUILD_VECTOR
rather than SPLAT_VECTOR.

Reviewed By: craig.topper

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

3 years agoRevert "[llvm] Use BasicBlock::phis() (NFC)"
Oliver Stannard [Thu, 7 Jan 2021 09:43:33 +0000 (09:43 +0000)]
Revert "[llvm] Use BasicBlock::phis() (NFC)"

Reverting because this causes crashes on the 2-stage buildbots, for
example http://lab.llvm.org:8011/#/builders/7/builds/1140.

This reverts commit 9b228f107d43341ef73af92865f73a9a076c5a76.

3 years agoRevert "[clang][cli] Allow users to specify a conditional to prevent parsing options...
Jan Svoboda [Thu, 7 Jan 2021 09:12:53 +0000 (10:12 +0100)]
Revert "[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo"

This reverts commit 77db83ae

3 years ago[clang][cli] Implement ContainsN Google Test matcher
Jan Svoboda [Mon, 21 Dec 2020 15:13:43 +0000 (16:13 +0100)]
[clang][cli] Implement ContainsN Google Test matcher

This allows us to verify that we don't emit options multiple times.

In most cases, that would be benign, but for options with `MarshallingInfoVectorString`, emitting wrong number of arguments might change the semantics.

Reviewed By: Bigcheese

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

3 years ago[clang][cli] Allow users to specify a conditional to prevent parsing options with...
Jan Svoboda [Fri, 18 Dec 2020 14:02:43 +0000 (15:02 +0100)]
[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo

Depends on D84189 & D93540.

Reviewed By: Bigcheese

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

3 years ago[gn build] Port d2ddc694ff9
LLVM GN Syncbot [Thu, 7 Jan 2021 08:29:23 +0000 (08:29 +0000)]
[gn build] Port d2ddc694ff9

3 years agoRevert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to...
Artem Dergachev [Wed, 6 Jan 2021 14:35:09 +0000 (06:35 -0800)]
Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""

This reverts commit 5663bf201f5c444d6fb56fb1bd471bc53c17d837.

The cyclic dependency problem is addressed now.
This is the ~fifth attempt to land this change.

3 years ago[mlir] Mark methods from mlir::OpState that just forward to mlir::Operation as deprec...
Christian Sigg [Thu, 7 Jan 2021 06:52:37 +0000 (07:52 +0100)]
[mlir] Mark methods from mlir::OpState that just forward to mlir::Operation as deprecated.

The functions will be removed by January 20th.

All call sites within MLIR have been converted in previous changes.

Reviewed By: rriddle

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

3 years ago[libcxx] Handle backslash as path separator on windows
Martin Storsjö [Wed, 28 Oct 2020 10:24:11 +0000 (12:24 +0200)]
[libcxx] Handle backslash as path separator on windows

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

3 years ago[LLD] [MinGW] Pass the --demangle and --no-demangle options to the COFF linker
Martin Storsjö [Wed, 30 Dec 2020 21:02:01 +0000 (23:02 +0200)]
[LLD] [MinGW] Pass the --demangle and --no-demangle options to the COFF linker

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

3 years ago[LV] Merge tests into a single file (NFC)
Gil Rapaport [Thu, 7 Jan 2021 07:01:02 +0000 (09:01 +0200)]
[LV] Merge tests into a single file (NFC)

In response to https://reviews.llvm.org/D94088#inline-879268

3 years ago[mlir][ODS] Fix missed rename of TypeParameter 'description' to 'summary'
River Riddle [Thu, 7 Jan 2021 06:24:05 +0000 (22:24 -0800)]
[mlir][ODS] Fix missed rename of TypeParameter 'description' to 'summary'

This fixes document generation for type parameters.

3 years ago[X86] Update tests for znver3
Ganesh Gopalasubramanian [Wed, 6 Jan 2021 19:29:38 +0000 (00:59 +0530)]
[X86] Update tests for znver3

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

3 years ago[VE][NFC] Update comments to match the generated instructions
Kazushi (Jam) Marukawa [Thu, 7 Jan 2021 03:23:38 +0000 (12:23 +0900)]
[VE][NFC] Update comments to match the generated instructions

3 years ago[PowerPC] Delete dead Lower*
Fangrui Song [Thu, 7 Jan 2021 05:58:40 +0000 (21:58 -0800)]
[PowerPC] Delete dead Lower*

3 years ago[PowerPC] Delete remnant Darwin ISelLowering code
Fangrui Song [Thu, 7 Jan 2021 05:40:40 +0000 (21:40 -0800)]
[PowerPC] Delete remnant Darwin ISelLowering code

3 years ago[PowerPC] Delete remnant isOSDarwin references
Fangrui Song [Thu, 7 Jan 2021 05:18:35 +0000 (21:18 -0800)]
[PowerPC] Delete remnant isOSDarwin references

3 years agoUpdate for review feedback: Inline var declaration and expand names.
Chris Lattner [Thu, 7 Jan 2021 01:38:37 +0000 (17:38 -0800)]
Update for review feedback: Inline var declaration and expand names.

Depends on D93908.

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

3 years ago[AsmPrinter] Make OpAsmPrinter::printFunctionalType be resilient to null values.
Chris Lattner [Tue, 29 Dec 2020 19:05:45 +0000 (11:05 -0800)]
[AsmPrinter] Make OpAsmPrinter::printFunctionalType be resilient to null values.

A previous patch made Value::getType() be resilient to null values which was
considered to be too sweeping.  This is a more targeted change which requires
deabstracting some templates.

A middle ground would be to make ValueTypeIterator be tolerant to null values.

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

3 years ago[debuginfo-test] Fix -Wunused-value
Fangrui Song [Thu, 7 Jan 2021 04:39:07 +0000 (20:39 -0800)]
[debuginfo-test] Fix -Wunused-value

3 years ago[NFC] Don't copy MachineFrameInfo on each invocation of HasAlias
Sanjoy Das [Wed, 6 Jan 2021 17:46:43 +0000 (09:46 -0800)]
[NFC] Don't copy MachineFrameInfo on each invocation of HasAlias

Also fix a typo in a comment.  This fixes a compile time issue in XLA
(https://www.tensorflow.org/xla).

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

3 years ago[clangd][NFC] Use PathRef for getCorrespondingHeaderOrSource
Nathan James [Thu, 7 Jan 2021 02:40:20 +0000 (02:40 +0000)]
[clangd][NFC] Use PathRef for getCorrespondingHeaderOrSource

3 years ago[llvm] Use llvm::all_of (NFC)
Kazu Hirata [Thu, 7 Jan 2021 02:27:36 +0000 (18:27 -0800)]
[llvm] Use llvm::all_of (NFC)

3 years ago[llvm] Use BasicBlock::phis() (NFC)
Kazu Hirata [Thu, 7 Jan 2021 02:27:35 +0000 (18:27 -0800)]
[llvm] Use BasicBlock::phis() (NFC)

3 years ago[llvm] Use llvm::append_range (NFC)
Kazu Hirata [Thu, 7 Jan 2021 02:27:33 +0000 (18:27 -0800)]
[llvm] Use llvm::append_range (NFC)

3 years ago[lldb] Skip scoped enum checks with Dwarf <4
Jonas Devlieghere [Thu, 7 Jan 2021 01:10:20 +0000 (17:10 -0800)]
[lldb] Skip scoped enum checks with Dwarf <4

The scoped enum tests depend on DW_AT_enum_class which was added in
Dwarf 4.

I made part of the test conditional on the Dwarf version instead of
splitting it into a separate test and using the decorator to avoid the
overhead of setting up the test.

3 years ago[lldb] [debugserver] Add stN aliases for stmmN for compatibility
Michał Górny [Fri, 20 Nov 2020 08:44:33 +0000 (09:44 +0100)]
[lldb] [debugserver] Add stN aliases for stmmN for compatibility

Add stN aliases for the FPU (stmmN) registers on MacOSX.  This should
improve compatibility between MacOSX and other platforms, and partially
fix x86*-fp-write tests without having to duplicate them.  Note that
the tests are currently still broken due to ftag incompatibility.

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

3 years ago[InstSimplify] Fold insertelement vec, poison, idx into vec
Juneyoung Lee [Sun, 3 Jan 2021 17:02:19 +0000 (02:02 +0900)]
[InstSimplify] Fold insertelement vec, poison, idx into vec

This is a simple patch that adds folding from `insertelement vec, poison, idx` into `vec`.

Alive2 proof: https://alive2.llvm.org/ce/z/2y2vbC

Reviewed By: nikic

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

3 years ago[Constant] Add tests for ConstantVector::get (NFC)
Juneyoung Lee [Thu, 7 Jan 2021 01:08:01 +0000 (10:08 +0900)]
[Constant] Add tests for ConstantVector::get (NFC)

3 years ago[NFC] Move readAPValue/writeAPValue up the inheritance hierarchy
Varun Gandhi [Wed, 6 Jan 2021 22:34:20 +0000 (14:34 -0800)]
[NFC] Move readAPValue/writeAPValue up the inheritance hierarchy

The implementation for (de)serialization of APValues can be shared
between Clang and Swift, so we prefer pushing the methods up
the inheritance hierarchy, instead of having the methods live in
ASTReader/ASTWriter. Fixes rdar://72592937.

Reviewed By: rjmccall

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

3 years ago[RISCV] Fix a few section number comments in RISCVInstrInfoVPseudos.td to match the...
Craig Topper [Wed, 6 Jan 2021 23:59:30 +0000 (15:59 -0800)]
[RISCV] Fix a few section number comments in RISCVInstrInfoVPseudos.td to match the V extension 1.0 draft spec. NFC

The majority of the comments use the 1.0 draft spec section numbers.

3 years ago[lldb/Lua] add support for multiline scripted breakpoints
Pedro Tammela [Wed, 16 Dec 2020 21:34:44 +0000 (21:34 +0000)]
[lldb/Lua] add support for multiline scripted breakpoints

1 - Partial Statements

The interpreter loop runs every line it receives, so partial
Lua statements are not being handled properly. This is a problem for
multiline breakpoint scripts since the interpreter loop, for this
particular case, is just an abstraction to a partially parsed function
body declaration.

This patch addresses this issue and as a side effect improves the
general Lua interpreter loop as well. It's now possible to write partial
statements in the 'script' command.

Example:
   (lldb) script
   >>>   do
   ..>   local a = 123
   ..>   print(a)
   ..>   end
   123

The technique implemented is the same as the one employed by Lua's own REPL implementation.
Partial statements always errors out with the '<eof>' tag in the error
message.

2 - CheckSyntax in Lua.h

In order to support (1), we need an API for just checking the syntax of string buffers.

3 - Multiline scripted breakpoints

Finally, with all the base features implemented this feature is
straightforward. The interpreter loop behaves exactly the same, the
difference is that it will aggregate all Lua statements into the body of
the breakpoint function. An explicit 'quit' statement is needed to exit the
interpreter loop.

Example:
   (lldb) breakpoint command add -s lua
   Enter your Lua command(s). Type 'quit' to end.
   The commands are compiled as the body of the following Lua function
   function (frame, bp_loc, ...) end
   ..> print(456)
   ..> a = 123
   ..> quit

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

3 years ago[Constant] Update ConstantVector::get to return poison if all input elems are poison
Juneyoung Lee [Thu, 7 Jan 2021 00:24:39 +0000 (09:24 +0900)]
[Constant] Update ConstantVector::get to return poison if all input elems are poison

The diff was reviewed at D93994

3 years ago[analyzer] Update Fuchsia checker to catch releasing unowned handles.
Daniel Hwang [Wed, 6 Jan 2021 23:35:06 +0000 (15:35 -0800)]
[analyzer] Update Fuchsia checker to catch releasing unowned handles.

Certain Fuchsia functions may return handles that are not owned by the
current closure. This adds a check in order to determine when these
handles are released.

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

3 years ago[PPC] Remove old PPCSubTarget variable.
Kit Barton [Wed, 6 Jan 2021 22:48:41 +0000 (16:48 -0600)]
[PPC] Remove old PPCSubTarget variable.

The PPCSubTarget variable has been replaced with the Subtarget variable. This
removes the remaining instances of PPCSubTarget as they are no longer necessary.

3 years ago[libc++] ADL-proof vector<bool> by adding _VSTD:: qualification on calls.
Arthur O'Dwyer [Wed, 16 Dec 2020 00:32:29 +0000 (19:32 -0500)]
[libc++] ADL-proof vector<bool> by adding _VSTD:: qualification on calls.

This affects only vectors with weird/malicious allocators,
the same corner case covered in D91708, but for `vector<bool>` this time.

Also ADL-proof <__tree>, which affects only sets and maps with weird/malicious
allocators where the ADL trap is in the *fancy pointer type*.

Also drive-by _VSTD:: qualification in the guts of std::bind,
std::packaged_task, std::condition_variable.

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

3 years ago[lldb] Ad os_signpost support to lldb_private::Timer
Jonas Devlieghere [Wed, 6 Jan 2021 22:37:17 +0000 (14:37 -0800)]
[lldb] Ad os_signpost support to lldb_private::Timer

Emit os_signposts when supported from LLDB's timer class. A vast amount
of performance sensitive places in LLDB are already instrumented with
the Timer class.

By emitting signposts we can examine this information in Instruments. I
recommend looking at Daniel's differential for why this is so powerful:
https://reviews.llvm.org/D52954.

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

3 years ago[Support] Untie the llvm::Signpost interface from llvm::Timer
Jonas Devlieghere [Wed, 6 Jan 2021 22:35:07 +0000 (14:35 -0800)]
[Support] Untie the llvm::Signpost interface from llvm::Timer

Make llvm::Signpost more generic by untying from llvm::Timer. This
allows signposts to be used in a different context.

My motivation for doing this is being able to use signposts in LLDB.

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

3 years ago[mlir][vector] Support transfer op on tensor optimizations
Thomas Raoux [Wed, 6 Jan 2021 17:34:50 +0000 (09:34 -0800)]
[mlir][vector] Support transfer op on tensor optimizations

Support store to load forwarding and dead store transformations for transfer op
on tensor.

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

3 years ago[libc] Use a wrapper for rand instead of calling std::rand in fma tests.
Siva Chandra Reddy [Wed, 6 Jan 2021 22:39:07 +0000 (14:39 -0800)]
[libc] Use a wrapper for rand instead of calling std::rand in fma tests.

Reviewed By: lntue

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

3 years ago[mlir][TypeDefGen] Remove the need to define parser/printer for singleton types
River Riddle [Wed, 6 Jan 2021 22:54:39 +0000 (14:54 -0800)]
[mlir][TypeDefGen] Remove the need to define parser/printer for singleton types

This allows for singleton types without an explicit parser/printer to simply use
the mnemonic as the assembly format, removing the need for these types to provide the parser/printer
fields.

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

3 years agoFix failing triple test for macOS 11 with non-zero minor versions.
Amara Emerson [Wed, 6 Jan 2021 22:40:17 +0000 (14:40 -0800)]
Fix failing triple test for macOS 11 with non-zero minor versions.

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

3 years ago[DominatorTree] Add support for mixed pre/post CFG views.
Alina Sbirlea [Mon, 14 Dec 2020 19:53:35 +0000 (11:53 -0800)]
[DominatorTree] Add support for mixed pre/post CFG views.

Add support for mixed pre/post CFG views.

Update usages of the MemorySSAUpdater to use the new DT API by
requesting the DT updates to be done by the MSSAUpdater.

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

3 years ago[OpenMP] Use c_int/c_size_t in Fortran target memory routine interface
Hansang Bae [Wed, 6 Jan 2021 22:14:37 +0000 (16:14 -0600)]
[OpenMP] Use c_int/c_size_t in Fortran target memory routine interface

The Fortran interface is now in line with 5.1 specification.

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

3 years ago[mlir] Add hoisting transformation for transfer ops on tensor
Thomas Raoux [Tue, 5 Jan 2021 20:58:51 +0000 (12:58 -0800)]
[mlir] Add hoisting transformation for transfer ops on tensor

Add same hoisting transformation existing for transfer ops on buffers for
transfer_ops on tensor. The logic is significantly different so this is done as
a separate transformation and it is expect that user would know which
transformation to use based on the flow.

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

3 years ago[mlir][ODS] Fix the use of cppClassName in Type constraints for TypeDefs
River Riddle [Wed, 6 Jan 2021 22:08:12 +0000 (14:08 -0800)]
[mlir][ODS] Fix the use of cppClassName in Type constraints for TypeDefs

This field is currently being used to mean "Fully resolved class name", which breaks the usage by TypeDefs. This revision prefixes the name with the dialect namespace when necessary.

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

3 years ago[mlir][ODS] Rename several uses of 'description' to 'summary'
River Riddle [Wed, 6 Jan 2021 22:08:03 +0000 (14:08 -0800)]
[mlir][ODS] Rename several uses of 'description' to 'summary'

Right now constraint/predicate traits/etc. use their "description" field as a one line human readable string. This breaks the current convention, by which a "description" may be multi-line. This revision renames the "description" field in these cases to "summary" which matches what the string is actually used as. This also unbreaks the use of TypeDefs(and eventually AttrDefs) in conjunction with existing type constraint facilities like `Optional`.

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

3 years ago[libc] Add implementation of fmaf.
Tue Ly [Sat, 2 Jan 2021 06:36:29 +0000 (01:36 -0500)]
[libc] Add implementation of fmaf.

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

3 years ago[OpenMP] Fixed an issue that wrong LLVM headers might be included when building libom...
Shilei Tian [Wed, 6 Jan 2021 22:07:17 +0000 (17:07 -0500)]
[OpenMP] Fixed an issue that wrong LLVM headers might be included when building libomptarget

Wrong LLVM headers might be included if we don't set `include_directories`
to a right place. This will cause a compilation error if LLVM is installed in
system directories.

Reviewed By: jdoerfert

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

3 years ago[OpenMP] Fixed the test environment when building along with LLVM
Shilei Tian [Wed, 6 Jan 2021 22:05:54 +0000 (17:05 -0500)]
[OpenMP] Fixed the test environment when building along with LLVM

Currently all built libraries in OpenMP are anywhere if building along
with LLVM. It is not an issue if we don't execute any test. However, almost all
tests for `libomptarget` fails because in the lit configuration, we only set
`<build_dir>/libomptarget` to `LD_LIBRARY_PATH` and `LIBRARY_PATH`. Since those
libraries are everywhere, `clang` can no longer find `libomptarget.so` or those
deviceRTLs anymore.

In this patch, we set a unified path for all built libraries, no matter whether
it is built along with LLVM or not. In this way, our lit configuration can work
propoerly.

Reviewed By: jdoerfert

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

3 years ago[hip] Fix HIP version parsing.
Michael Liao [Sat, 19 Dec 2020 21:20:36 +0000 (16:20 -0500)]
[hip] Fix HIP version parsing.

- Need trimming before parsing major or minor version numbers. This's required
  due to the different line ending on Windows.
- In addition, the integer conversion may fail due to invalid char. Return that
  parsing function return `true` when the parsing fails.

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

3 years ago[mlir][vector] Support unrolling for transfer ops using tensors
Thomas Raoux [Tue, 29 Dec 2020 17:59:36 +0000 (09:59 -0800)]
[mlir][vector] Support unrolling for transfer ops using tensors

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

3 years ago[clang-offload-bundler] Add option -list
Yaxun (Sam) Liu [Wed, 9 Dec 2020 15:35:12 +0000 (10:35 -0500)]
[clang-offload-bundler] Add option -list

clang-offload-bundler is not only used by clang driver
to bundle/unbundle files for offloading toolchains,
but also used by out of tree tools to unbundle
fat binaries generated by clang. It is important
to be able to list the bundle IDs in a bundled
file so that the bundles can be extracted.

This patch adds an option -list to list bundle
ID's in a bundled file. Each bundle ID is separated
by new line. If the file is not a bundled file
nothing is output and returns 0.

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

3 years ago[BasicAA] Fix BatchAA results for phi-phi assumptions
Nikita Popov [Sun, 22 Nov 2020 17:23:53 +0000 (18:23 +0100)]
[BasicAA] Fix BatchAA results for phi-phi assumptions

Change the way NoAlias assumptions in BasicAA are handled. Instead of
handling this inside the phi-phi code, always initially insert a
NoAlias result into the map and keep track whether it is used.
If it is used, then we require that we also get back NoAlias from
the recursive queries. Otherwise, the entry is changed to MayAlias.

Additionally, keep track of all location pairs we inserted that may
still be based on assumptions higher up. If it turns out one of those
assumptions is incorrect, we flush them from the cache.

The compile-time impact for the new implementation is significantly
higher than the previous iteration of this patch:
https://llvm-compile-time-tracker.com/compare.php?from=c0bb9859de6991cc233e2dedb978dd118da8c382&to=c07112373279143e37568b5bcd293daf81a35973&stat=instructions
However, it should avoid the exponential runtime cases we run into
if we don't cache assumption-based results entirely.

This also produces better results in some cases, because NoAlias
assumptions can now start at any root, rather than just phi-phi pairs.
This is not just relevant for analysis quality, but also for BatchAA
consistency: Otherwise, results would once again depend on query order,
though at least they wouldn't be wrong.

This ended up both more complicated and more expensive than I hoped,
but I wasn't able to come up with another solution that satisfies all
the constraints.

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

3 years ago[OpenCL] Add clang extension for variadic functions.
Anastasia Stulova [Wed, 6 Jan 2021 19:30:04 +0000 (19:30 +0000)]
[OpenCL] Add clang extension for variadic functions.

With the internal clang extension '__cl_clang_variadic_functions'
variadic functions are accepted by the frontend.

This is not a fully supported vendor/Khronos extension
as it can only be used on targets with variadic prototype
support or in metaprogramming to represent functions with
generic prototype without calling such functions in the
kernel code.

Tags: #clang

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

3 years ago[OpenCL] Add clang extension for function pointers.
Anastasia Stulova [Wed, 6 Jan 2021 19:05:09 +0000 (19:05 +0000)]
[OpenCL] Add clang extension for function pointers.

The new clang internal extension '__cl_clang_function_pointers'
allows use of function pointers and other features that have
the same functionality:
- Use of member function pointers;
- Unrestricted use of references to functions;
- Virtual member functions.

This not a vendor extension and therefore it doesn't require any
special target support. Exposing this functionality fully
will require vendor or Khronos extension.

Tags: #clang

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

3 years ago[mlir] Remove a number of methods from mlir::OpState that just forward to mlir::Opera...
Christian Sigg [Wed, 6 Jan 2021 20:26:59 +0000 (21:26 +0100)]
[mlir] Remove a number of methods from mlir::OpState that just forward to mlir::Operation. All call sites have been converted in previous changes.

3 years ago[InstSimplify] Canonicalize non-demanded shuffle op to poison (NFCI)
Nikita Popov [Wed, 6 Jan 2021 20:22:27 +0000 (21:22 +0100)]
[InstSimplify] Canonicalize non-demanded shuffle op to poison (NFCI)

I don't believe this has an observable effect, because the only
thing we care about here is replacing the operand with a constant
so following folds can apply. This change is just to make the
representation follow canonical unary shuffle form.

3 years ago[InstSimplify] Fold call null/undef to poison
Nikita Popov [Sun, 3 Jan 2021 21:08:38 +0000 (22:08 +0100)]
[InstSimplify] Fold call null/undef to poison

Calling null or undef results in immediate undefined behavior.
Return poison instead of undef in this case, similar to what
we do for immediate UB due to division by zero.

3 years ago[PowerPC] Avoid call to undef in test (NFC)
Nikita Popov [Wed, 6 Jan 2021 20:04:57 +0000 (21:04 +0100)]
[PowerPC] Avoid call to undef in test (NFC)

Replace call to undef with a dummy function, to avoid affecting
this change by changes to call undef folding.

3 years ago[NFC] Test case refactor
Nathan James [Wed, 6 Jan 2021 20:00:15 +0000 (20:00 +0000)]
[NFC] Test case refactor

3 years ago[test] Pin partial-unswitch.ll to legacy PM
Arthur Eubanks [Wed, 6 Jan 2021 19:51:36 +0000 (11:51 -0800)]
[test] Pin partial-unswitch.ll to legacy PM

The new PM does not have loop-unswitch, it only has simple-loop-unswitch.

3 years ago[RISCV] Return a vXi1 vector type from getSetCCResultType if V extension is enabled.
Craig Topper [Wed, 6 Jan 2021 19:25:15 +0000 (11:25 -0800)]
[RISCV] Return a vXi1 vector type from getSetCCResultType if V extension is enabled.

nvxXi1 types are legal with V extension and that's the result
vmseq/vmsne/vmslt/etc instructions return.

No test cases yet because the setcc isel patterns aren't in
and we'll need more than basic tests to observe this. I locally
tested that this plus D947078, D94168, D94142, and D94149
was enough to be able to handle the overflow result from
llvm.sadd.overflow.

3 years ago[test] Pin AMDGPU/opt-pipeline.ll to legacy PM
Arthur Eubanks [Wed, 6 Jan 2021 19:43:28 +0000 (11:43 -0800)]
[test] Pin AMDGPU/opt-pipeline.ll to legacy PM

The pipeline being tested is specifically the legacy PM pipeline.

3 years agoFix non-assert builds after D93828
Arthur Eubanks [Wed, 6 Jan 2021 19:41:09 +0000 (11:41 -0800)]
Fix non-assert builds after D93828

3 years ago[InstSimplify] Fold out-of-bounds shift to poison
Nikita Popov [Sun, 3 Jan 2021 20:10:00 +0000 (21:10 +0100)]
[InstSimplify] Fold out-of-bounds shift to poison

Make InstSimplify return poison rather than undef for out-of-bounds
shifts, as specified by LandRef:

> If op2 is (statically or dynamically) equal to or larger than the
> number of bits in op1, this instruction returns a poison value.

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

3 years ago[GVN] Regenerate test checks (NFC)
Nikita Popov [Sun, 3 Jan 2021 21:09:12 +0000 (22:09 +0100)]
[GVN] Regenerate test checks (NFC)

3 years ago[SLP] use reduction kind's opcode to create new instructions; NFC
Sanjay Patel [Wed, 6 Jan 2021 19:10:40 +0000 (14:10 -0500)]
[SLP] use reduction kind's opcode to create new instructions; NFC

Similar to 5a1d31a28 -
This should be no-functional-change because the reduction kind
opcodes are 1-for-1 mappings to the instructions we are matching
as reductions. But we want to remove the need for the
`OperationData` opcode field because that does not work when
we start matching intrinsics (eg, maxnum) as reduction candidates.

3 years ago[SLP] reduce code for propagating flags on reductions; NFC
Sanjay Patel [Wed, 6 Jan 2021 19:00:25 +0000 (14:00 -0500)]
[SLP] reduce code for propagating flags on reductions; NFC

If we add/change to match intrinsics, this might get more
wordy, but there's no need to list each kind currently.

3 years ago[CGSCC][Coroutine][NewPM] Properly support function splitting/outlining
Arthur Eubanks [Sat, 26 Dec 2020 18:25:34 +0000 (10:25 -0800)]
[CGSCC][Coroutine][NewPM] Properly support function splitting/outlining

Previously when trying to support CoroSplit's function splitting, we
added in a hack that simply added the new function's node into the
original function's SCC (https://reviews.llvm.org/D87798). This is
incorrect since it might be in its own SCC.

Now, more similar to the previous design, we have callers explicitly
notify the LazyCallGraph that a function has been split out from another
one.

In order to properly support CoroSplit, there are two ways functions can
be split out.

One is the normal expected "outlining" of one function into a new one.
The new function may only contain references to other functions that the
original did. The original function must reference the new function. The
new function may reference the original function, which can result in
the new function being in the same SCC as the original function. The
weird case is when the original function indirectly references the new
function, but the new function directly calls the original function,
resulting in the new SCC being a parent of the original function's SCC.
This form of function splitting works with CoroSplit's Switch ABI.

The second way of splitting is more specific to CoroSplit. CoroSplit's
Retcon and Async ABIs split the original function into multiple
functions that all reference each other and are referenced by the
original function. In order to keep the LazyCallGraph in a valid state,
all new functions must be processed together, else some nodes won't be
populated. To keep things simple, this only supports the case where all
new edges are ref edges, and every new function references every other
new function. There can be a reference back from any new function to the
original function, putting all functions in the same RefSCC.

This also adds asserts that all nodes in a (Ref)SCC can reach all other
nodes to prevent future incorrect hacks.

The original hacks in https://reviews.llvm.org/D87798 are no longer
necessary since all new functions should have been registered before
calling updateCGAndAnalysisManagerForPass.

This fixes all coroutine tests when opt's -enable-new-pm is true by
default. This also fixes PR48190, which was likely due to the previous
hack breaking SCC invariants.

Reviewed By: rnk

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