platform/upstream/llvm.git
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

3 years ago[flang][openacc] Add more parsing/sema tests for init and shutdown directives
Valentin Clement [Wed, 6 Jan 2021 19:15:07 +0000 (14:15 -0500)]
[flang][openacc] Add more parsing/sema tests for init and shutdown directives

This patch adds some positive and failure tests for init and shutdown directives.

Reviewed By: kiranktp

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

3 years ago[lld-macho] Fix GCC -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build
Fangrui Song [Wed, 6 Jan 2021 18:58:46 +0000 (10:58 -0800)]
[lld-macho] Fix GCC -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build

3 years ago[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and...
Fangrui Song [Wed, 6 Jan 2021 18:55:40 +0000 (10:55 -0800)]
[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl

Several `#if SANITIZER_LINUX && !SANITIZER_ANDROID` guards are replaced
with the more appropriate `#if SANITIZER_GLIBC` (the headers are glibc
extensions, not specific to Linux (i.e. if we ever support GNU/kFreeBSD
or Hurd, the guards may automatically work)).

Several `#if SANITIZER_LINUX && !SANITIZER_ANDROID` guards are refined
with `#if SANITIZER_GLIBC` (the definitions are available on Linux glibc,
but may not be available on other libc (e.g. musl) implementations).

This patch makes `ninja asan cfi lsan msan stats tsan ubsan xray` build on a musl based Linux distribution (apk install musl-libintl)
Notes about disabled interceptors for musl:

* `SANITIZER_INTERCEPT_GLOB`: musl does not implement `GLOB_ALTDIRFUNC` (GNU extension)
* Some ioctl structs and functions operating on them.
* `SANITIZER_INTERCEPT___PRINTF_CHK`: `_FORTIFY_SOURCE` functions are GNU extension
* `SANITIZER_INTERCEPT___STRNDUP`: `dlsym(RTLD_NEXT, "__strndup")` errors so a diagnostic is formed. The diagnostic uses `write` which hasn't been intercepted => SIGSEGV
* `SANITIZER_INTERCEPT_*64`: the `_LARGEFILE64_SOURCE` functions are glibc specific. musl does something like `#define pread64 pread`
* Disabled `msg_iovlen msg_controllen cmsg_len` checks: musl is conforming while many implementations (Linux/FreeBSD/NetBSD/Solaris) are non-conforming. Since we pick the glibc definition, exclude the checks for musl (incompatible sizes but compatible offsets)

Pass through LIBCXX_HAS_MUSL_LIBC to make check-msan/check-tsan able to build libc++ (https://bugs.llvm.org/show_bug.cgi?id=48618).

Many sanitizer features are available now.

```
% ninja check-asan
(known issues:
* ASAN_OPTIONS=fast_unwind_on_malloc=0 odr-violations hangs
)
...
Testing Time: 53.69s
  Unsupported      : 185
  Passed           : 512
  Expectedly Failed:   1
  Failed           :  12

% ninja check-ubsan check-ubsan-minimal check-memprof # all passed

% ninja check-cfi
( all cross-dso/)
...
Testing Time: 8.68s
  Unsupported      : 264
  Passed           :  80
  Expectedly Failed:   8
  Failed           :  32

% ninja check-lsan
(With GetTls (D93972), 10 failures)
Testing Time: 4.09s
  Unsupported:  7
  Passed     : 65
  Failed     : 22

% ninja check-msan
(Many are due to functions not marked unsupported.)
Testing Time: 23.09s
  Unsupported      :   6
  Passed           : 764
  Expectedly Failed:   2
  Failed           :  58

% ninja check-tsan
Testing Time: 23.21s
  Unsupported      :  86
  Passed           : 295
  Expectedly Failed:   1
  Failed           :  25
```

Used `ASAN_OPTIONS=verbosity=2` to verify there is no unneeded interceptor.

Partly based on Jari Ronkainen's https://reviews.llvm.org/D63785#1921014

Note: we need to place `_FILE_OFFSET_BITS` above `#include "sanitizer_platform.h"` to avoid `#define __USE_FILE_OFFSET64 1` in 32-bit ARM `features.h`

Reviewed By: vitalybuka

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

3 years ago[NVPTX] Fix debugging information being added to NVPTX target if remarks are enabled
Joseph Huber [Wed, 6 Jan 2021 15:20:34 +0000 (10:20 -0500)]
[NVPTX] Fix debugging information being added to NVPTX target if remarks are enabled
Summary:
Optimized debugging is not supported by ptxas. Debugging information is degraded to line information only if optimizations are enabled, but debugging information would be added back in by the driver if remarks were enabled. This solves https://bugs.llvm.org/show_bug.cgi?id=48153.

Reviewers: jdoerfert tra jholewinski serge-sans-paille

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

3 years ago[NFC] Removed unused prefixes in CodeGen/AMDGPU
Mircea Trofin [Wed, 6 Jan 2021 17:35:52 +0000 (09:35 -0800)]
[NFC] Removed unused prefixes in CodeGen/AMDGPU

This covers tests starting with m-r.

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

3 years ago[X86] Add commuted patterns test coverage for D93599
Simon Pilgrim [Wed, 6 Jan 2021 17:50:22 +0000 (17:50 +0000)]
[X86] Add commuted patterns test coverage for D93599

Suggested by @spatel

3 years ago[Clang] Remove unnecessary Attr.isArgIdent checks.
Florian Hahn [Wed, 6 Jan 2021 14:59:27 +0000 (14:59 +0000)]
[Clang] Remove unnecessary Attr.isArgIdent checks.

The MatrixType, ExtVectorType, VectorSize and AddressSpace attributes
have arguments defined as ExprArguments in Attr.td. So their arguments
should never be ArgIdents and the logic to handle this case can be
removed.

The logic has been replaced by an assertion to ensure the arguments
are always ArgExpressions

Reviewed By: erichkeane

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

3 years ago[X86] Remove [ER]SP from all CSR lists
Reid Kleckner [Tue, 5 Jan 2021 21:45:02 +0000 (13:45 -0800)]
[X86] Remove [ER]SP from all CSR lists

The CSR lists control which registers are spilled and reloaded in the
prologue and epilogue. The stack pointer is managed explicitly, and
should never be pushed or popped. Remove it from these lists. This
affected regcall and preserves all / most.

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

3 years agoRemove allow-unregistered-dialect from some tests that don't need it
Sanjoy Das [Sun, 3 Jan 2021 06:56:44 +0000 (22:56 -0800)]
Remove allow-unregistered-dialect from some tests that don't need it

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

3 years agoNit: fix spacing
Sanjoy Das [Sun, 3 Jan 2021 18:33:34 +0000 (10:33 -0800)]
Nit: fix spacing

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

3 years ago[mlir] NFC: fix trivial typos
Kazuaki Ishizaki [Wed, 6 Jan 2021 17:35:29 +0000 (02:35 +0900)]
[mlir] NFC: fix trivial typos
fix typos under docs, test, and tools directories

Reviewed By: ftynse

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

3 years ago[NFC] Removed unused prefixes from CodeGen/AMDGPU
Mircea Trofin [Wed, 6 Jan 2021 04:23:39 +0000 (20:23 -0800)]
[NFC] Removed unused prefixes from CodeGen/AMDGPU

All the 'l'-starting tests.

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

3 years agoAMDGPU/GlobalISel: Update fdiv lowering for denormal/ulp interaction
Matt Arsenault [Wed, 6 Jan 2021 02:14:42 +0000 (21:14 -0500)]
AMDGPU/GlobalISel: Update fdiv lowering for denormal/ulp interaction

Change the GlobalISel fast fdiv handling to match the changes in
2531535984ad989ce88aeee23cb92a827da6686e and
884acbb9e167d5668e43581630239d688edec8ad

3 years ago[llvm][NFC] Disallow all warnings in TypeSize tests
Peter Waller [Wed, 6 Jan 2021 17:16:38 +0000 (17:16 +0000)]
[llvm][NFC] Disallow all warnings in TypeSize tests

This is a follow-up to a request from a reviewer [0]. The text may change in
the future and these tests should not produce any warning output.

[0] https://reviews.llvm.org/D91806#inline-879243

Reviewed By: sdesmalen, david-arm

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

3 years ago[InstCombine] Update valueCoversEntireFragment to use TypeSize
Francesco Petrogalli [Wed, 6 Jan 2021 17:12:23 +0000 (17:12 +0000)]
[InstCombine] Update valueCoversEntireFragment to use TypeSize

* Update valueCoversEntireFragment to use TypeSize.
* Add a regression test.
* Assertions have been added to protect untested codepaths.

Reviewed By: sdesmalen

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

3 years agoAMDGPU/GlobalISel: Add baseline IR tests for fdiv
Matt Arsenault [Wed, 6 Jan 2021 02:33:42 +0000 (21:33 -0500)]
AMDGPU/GlobalISel: Add baseline IR tests for fdiv

The fdiv lowering is currently split between an IR pass and codegen,
so make sure this works end to end. We also currently differ from the
DAG on some edge cases, which this will show in a future change.

3 years agoAMDGPU: Explicitly use SelectionDAG in legacy intrinsic tests
Matt Arsenault [Thu, 30 Jul 2020 02:50:02 +0000 (22:50 -0400)]
AMDGPU: Explicitly use SelectionDAG in legacy intrinsic tests

GlobalISel will probably not support the legacy buffer intrinsics, so
don't fail when the default is switched.

3 years ago[flang][driver] Add support for `-D`, `-U`
Faris Rehman [Wed, 6 Jan 2021 15:42:24 +0000 (15:42 +0000)]
[flang][driver] Add support for `-D`, `-U`

Add support for options -D and -U in the new Flang driver.

Summary of changes:
  - Create PreprocessorOptions, to be used by the driver then translated
    into Fortran::parser::Options
  - Create CompilerInvocation::setFortranOpts to pass preprocessor
    options into the parser options
  - Add a dedicated method, Flang::AddPreprocessingOptions, to extract
    preprocessing options from the driver arguments into the preprocessor
    command arguments

Macros specified like -DName will default to definition 1.

When defining macros, the new driver will drop anything after an
end-of-line character. This is consistent with gfortran and clang, but
different to what currently f18 does. However, flang (which is a bash
wrapper for f18), also drops everything after an end-of-line character.
So gfortran-like behaviour felt like the natural choice. Test is added
to demonstrate this behaviour.

Reviewed By: awarzynski

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

3 years ago[TargetLowering] Add icmp ne/eq (srl (ctlz x), log2(bw)) vector support.
Simon Pilgrim [Wed, 6 Jan 2021 16:13:36 +0000 (16:13 +0000)]
[TargetLowering] Add icmp ne/eq (srl (ctlz x), log2(bw)) vector support.

3 years ago[AArch64] Rearrange mul(dup(sext/zext)) to mul(sext/zext(dup))
Nicholas Guy [Wed, 2 Dec 2020 15:15:23 +0000 (15:15 +0000)]
[AArch64] Rearrange mul(dup(sext/zext)) to mul(sext/zext(dup))

Performing this rearrangement allows for existing patterns
to match cases where the vector may be built after an extend,
instead of before.

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

3 years agoRemove some unused <vector> includes. NFCI.
Simon Pilgrim [Wed, 6 Jan 2021 15:50:11 +0000 (15:50 +0000)]
Remove some unused <vector> includes. NFCI.

<vector> (unlike many other c++ headers) is relatively clean, so if the file doesn't use std::vector then it shouldn't need the header.

3 years ago[X86] Add icmp ne/eq (srl (ctlz x), log2(bw)) test coverage.
Simon Pilgrim [Wed, 6 Jan 2021 15:44:36 +0000 (15:44 +0000)]
[X86] Add icmp ne/eq (srl (ctlz x), log2(bw)) test coverage.

Add vector coverage as well (which isn't currently supported).

3 years ago[Hexagon] Wrap functions only used in asserts in ifndef NDEBUG
Krzysztof Parzyszek [Wed, 6 Jan 2021 15:11:04 +0000 (09:11 -0600)]
[Hexagon] Wrap functions only used in asserts in ifndef NDEBUG

3 years ago[mlir][spirv] Update pass docs
Lei Zhang [Wed, 6 Jan 2021 15:28:01 +0000 (10:28 -0500)]
[mlir][spirv] Update pass docs

Reviewed By: hanchung

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

3 years agoFix MaterializeTemporaryExpr's type when its an incomplete array.
Erich Keane [Wed, 6 Jan 2021 14:46:01 +0000 (06:46 -0800)]
Fix MaterializeTemporaryExpr's type when its an incomplete array.

Like the VarDecl that gets its type updated based on an init-list, this
patch corrects the MaterializeTemporaryExpr's type to make sure it isn't
creating an incomplete type, which leads to a handful of CodeGen crashes
(see PR 47636).

Based on @rsmith 's comments on D88236

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

3 years ago[Driver][MachineOutliner] Support outlining option with LTO
Yvan Roux [Wed, 6 Jan 2021 15:01:38 +0000 (16:01 +0100)]
[Driver][MachineOutliner] Support outlining option with LTO

This patch propagates the -moutline flag when LTO is enabled and avoids
passing it explicitly to the linker plugin.

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

3 years ago[LoopDeletion] Also consider loops with subloops for deletion.
Florian Hahn [Wed, 6 Jan 2021 11:51:52 +0000 (11:51 +0000)]
[LoopDeletion] Also consider loops with subloops for deletion.

Currently, LoopDeletion does skip loops that have sub-loops, but this
means we currently fail to remove some no-op loops.

One example are inner loops with live-out values. Those cannot be
removed by itself. But the containing loop may itself be a no-op and the
whole loop-nest can be deleted.

The legality checks do not seem to rely on analyzing inner-loops only
for correctness.

With LoopDeletion being a LoopPass, the change means that we now
unfortunately need to do some extra work in parent loops, by checking
some conditions we already checked. But there appears to be no
noticeable compile time impact:
http://llvm-compile-time-tracker.com/compare.php?from=02d11f3cda2ab5b8bf4fc02639fd1f4b8c45963e&to=843201e9cf3b6871e18c52aede5897a22994c36c&stat=instructions

This changes patch leads to ~10 more loops being deleted on
MultiSource, SPEC2000, SPEC2006 with -O3 & LTO

This patch is also required (together with a few others) to eliminate a
no-op loop in omnetpp as discussed on llvm-dev 'LoopDeletion / removal of
empty loops.' (http://lists.llvm.org/pipermail/llvm-dev/2020-December/147462.html)

This change becomes relevant after removing potentially infinite loops
is made possible in 'must-progress' loops (D86844).

Note that I added a function call with side-effects to an outer loop in
`llvm/test/Transforms/LoopDeletion/update-scev.ll` to preserve the
original spirit of the test.

Reviewed By: reames

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