platform/upstream/llvm.git
3 years ago[mlir] Add better support for f80 and f128
Valentin Clement [Fri, 15 Jan 2021 15:29:37 +0000 (10:29 -0500)]
[mlir] Add better support for f80 and f128

Add builtin f80 and f128 following @schweitz proposition
https://llvm.discourse.group/t/rfc-adding-better-support-for-higher-precision-floating-point/2526/5

Reviewed By: ftynse, rriddle

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

3 years ago[DAG] visitVECTOR_SHUFFLE - MergeInnerShuffle - improve shuffle(shuffle(x,y),shuffle...
Simon Pilgrim [Fri, 15 Jan 2021 15:08:17 +0000 (15:08 +0000)]
[DAG] visitVECTOR_SHUFFLE - MergeInnerShuffle - improve shuffle(shuffle(x,y),shuffle(x,y)) merging

MergeInnerShuffle currently attempts to merge shuffle(shuffle(x,y),z) patterns into a single shuffle, using 1 or 2 of the x,y,z ops.

However if we already match 2 ops we might be able to handle the third op if its also a shuffle that references one of the previous ops, allowing us to handle some cases like:

shuffle(shuffle(x,y),shuffle(x,y))
shuffle(shuffle(shuffle(x,z),y),z)
shuffle(shuffle(x,shuffle(x,y)),z)
etc.

This isn't an exhaustive match and is dependent on the order the candidate ops are encountered - if one of the matched ops was a shuffle that was peek-able we don't go back and try to split that, I haven't found much need for that amount of analysis yet.

This is a preliminary patch that will allow us to later improve x86 HADD/HSUB matching - but needs to be reviewed separately as its in generic code and affects existing Thumb2 tests.

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

3 years agoSet option default for enabling memory ssa for new pass manager loop sink pass to...
Jamie Schmeiser [Fri, 15 Jan 2021 14:51:34 +0000 (09:51 -0500)]
Set option default for enabling memory ssa for new pass manager loop sink pass to true.
Summary:
Set the default for the option enabling memory ssa use in the loop sink
pass to true for the new pass manager.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: asbirlea (Alina Sbirlea)
Differential Revision: https://reviews.llvm.org/D92486

3 years ago[X86] Add umin knownbits/demandedbits ult test for D94532
Simon Pilgrim [Fri, 15 Jan 2021 14:42:42 +0000 (14:42 +0000)]
[X86] Add umin knownbits/demandedbits ult test for D94532

3 years ago[clang][cli] Parse & generate options necessary for LangOptions defaults manually
Jan Svoboda [Fri, 15 Jan 2021 13:47:55 +0000 (14:47 +0100)]
[clang][cli] Parse & generate options necessary for LangOptions defaults manually

It turns out we need to handle `LangOptions` separately from the rest of the options. `LangOptions` used to be conditionally parsed only when `!(DashX.getFormat() == InputKind::Precompiled || DashX.getLanguage() == Language::LLVM_IR)` and we need to restore this order (for more info, see D94682).

D94682 moves the parsing of marshalled `LangOpts` from `parseSimpleArgs` back to `ParseLangArgs`.

We need to parse marshalled `LangOpts` **after** `ParseLangArgs` calls `setLangDefaults`. This will enable future patches, where values of some `LangOpts` depend on the defaults.

However, two language options (`-finclude-default-header` and `-fdeclare-opencl-builtins`) need to be parsed **before** `ParseLangArgs` calls `setLangDefaults`, because they are necessary for setting up OpenCL defaults correctly.
This patch implements this by removing their marshalling info and manually parsing (and generating) them exactly where necessary.

Reviewed By: Bigcheese

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

3 years ago[OpenCL][Docs] Fixed malformed table in OpenCLSupport
Anastasia Stulova [Fri, 15 Jan 2021 14:25:32 +0000 (14:25 +0000)]
[OpenCL][Docs] Fixed malformed table in OpenCLSupport

 Tags: #clang

3 years ago[SVE] Fix unused variable.
Stephan Herhut [Fri, 15 Jan 2021 14:03:08 +0000 (15:03 +0100)]
[SVE] Fix unused variable.

Introduced by [SVE] Restrict the usage of REINTERPRET_CAST.

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

3 years ago[mlir][linalg] Support generating builders for named op attributes
Lei Zhang [Fri, 15 Jan 2021 13:57:07 +0000 (08:57 -0500)]
[mlir][linalg] Support generating builders for named op attributes

This commit adds support to generate an additional builder for
each named op that has attributes. This gives better experience
when creating the named ops.

Along the way adds support for i64.

Reviewed By: hanchung

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

3 years ago[ARM] Don't run the block placement pass at O0
Sam Tebbs [Fri, 15 Jan 2021 11:42:44 +0000 (11:42 +0000)]
[ARM] Don't run the block placement pass at O0

The block placement pass shouldn't run unless optimisations are enabled.

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

3 years ago[WebAssembly] MC layer writes table symbols to object files
Andy Wingo [Fri, 27 Nov 2020 08:19:46 +0000 (09:19 +0100)]
[WebAssembly] MC layer writes table symbols to object files

Now that the linker handles table symbols, we can allow the frontend to
produce them.

Depends on D91870.

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

3 years ago[X86][AVX] combineHorizOpWithShuffle - support target shuffles in HOP(SHUFFLE(X,Y...
Simon Pilgrim [Fri, 15 Jan 2021 13:41:40 +0000 (13:41 +0000)]
[X86][AVX] combineHorizOpWithShuffle - support target shuffles in HOP(SHUFFLE(X,Y),SHUFFLE(X,Y)) -> SHUFFLE(HOP(X,Y))

Be more aggressive on (AVX2+) folds of lane shuffles of 256-bit horizontal ops by working on target/faux shuffles as well.

3 years ago[lldb][docs] Translate ASCII art to restructured text formatting
Raphael Isemann [Fri, 15 Jan 2021 13:43:26 +0000 (14:43 +0100)]
[lldb][docs] Translate ASCII art to restructured text formatting

This translates most of the old ASCII art in our documentation to the
equivalent in restructured text (which the new version of the LLDB docs
is using).

3 years ago[clangd] Set correct CWD when using compile_flags.txt
Adam Czachorowski [Thu, 14 Jan 2021 17:21:23 +0000 (18:21 +0100)]
[clangd] Set correct CWD when using compile_flags.txt

This fixes a bug where clangd would attempt to set CWD to the
compile_flags.txt file itself.

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

3 years ago[clangd] Make ExpandAutoType not available on template params.
Adam Czachorowski [Thu, 14 Jan 2021 21:41:10 +0000 (22:41 +0100)]
[clangd] Make ExpandAutoType not available on template params.

We cannot expand auto when used inside a template param (C++17 feature),
so do not offer it there.

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

3 years agoRevert "[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference"
Raphael Isemann [Fri, 15 Jan 2021 13:07:45 +0000 (14:07 +0100)]
Revert "[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference"

This reverts commit bab121a1b66e85390cad019ec921febcba35519d. It seems the
docs buildbot doesn't have the required Python headers.

3 years ago[Orc] Fix OrcV2Examples after D94690
Stefan Gränitz [Fri, 15 Jan 2021 12:32:02 +0000 (13:32 +0100)]
[Orc] Fix OrcV2Examples after D94690

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

3 years ago[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference
Raphael Isemann [Fri, 15 Jan 2021 12:24:24 +0000 (13:24 +0100)]
[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference

Currently LLDB uses epydoc to generate the Python API reference for the website.
epydoc however is unmaintained since more than a decade and no longer works with
Python 3. Also whatever setup we had once for generating the documentation on
the website server no longer seems to work, so the current website documentation
has been stale since more than a year.

This patch replaces epydoc with sphinx and its automodapi plugin that can
generate Python API references. LLVM already uses sphinx for the rest of the
documentation, so this way we are more consistent with the rest of LLVM. The
only new dependency is the automodapi plugin for sphinx.

This patch effectively does the following things:
* Remove the epydoc code.
* Make a new dummy Python API page in our website that just calls the Sphinx
  command for generated the API documentation.
* Add a mock _lldb module that is only used when generating the Python API.
 This way we don't have to build all of LLDB to generate the API reference.

Some notes:
* The long list of skips is necessary due to boilerplate functions that SWIG
  is generating. Sadly automodapi is not really scriptable from what I can see,
  so we have to blacklist this stuff manually.
* The .gitignore change because automodapi wants a subfolder of our
  documentation directory to place generated documentation files there. The path
  is also what is used on the website, so we can't really workaround this
  (without copying the whole `docs` dir somewhere else when we build).
* We have to use environment variables to pass our build path to our sphinx
  configuration. Sphinx doesn't support passing variables onto that script.

Reviewed By: JDevlieghere

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

3 years ago[NFC][RISCV] Remove useless code in RISCVRegisterInfo.td.
Hsiangkai Wang [Fri, 15 Jan 2021 03:23:18 +0000 (11:23 +0800)]
[NFC][RISCV] Remove useless code in RISCVRegisterInfo.td.

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

3 years ago[Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors
Stefan Gränitz [Fri, 15 Jan 2021 11:26:04 +0000 (12:26 +0100)]
[Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors

It can be useful for an ObjectLinkingLayerCreator to allow callee errors to get propagated to the builder. Specifically, this is the case when the ObjectLayer uses the EHFrameRegistrationPlugin, because it requires a TPCEHFrameRegistrar and instantiation for it may fail (e.g. if the required registration symbols are missing in the target process).

Reviewed By: lhames

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

3 years ago[Orc][NFC] Turn LLJIT member ObjTransformLayer into unique_ptr
Stefan Gränitz [Fri, 15 Jan 2021 11:25:57 +0000 (12:25 +0100)]
[Orc][NFC] Turn LLJIT member ObjTransformLayer into unique_ptr

All other layers in LLJIT are stored as unique_ptr's already. At this point, it is not strictly necessary for ObjTransformLayer, but it makes a follow-up change more straightforward.

Reviewed By: lhames

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

3 years ago[SVE] Restrict the usage of REINTERPRET_CAST.
Paul Walker [Wed, 13 Jan 2021 11:45:54 +0000 (11:45 +0000)]
[SVE] Restrict the usage of REINTERPRET_CAST.

In order to limit the number of combinations of REINTERPRET_CAST,
whilst at the same time prevent overlap with BITCAST, this patch
establishes the following rules:

1. The operand and result element types must be the same.
2. The operand and/or result type must be an unpacked type.

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

3 years ago[RISCV] Optimize Branch Comparisons
Sam Elliott [Fri, 15 Jan 2021 11:20:28 +0000 (11:20 +0000)]
[RISCV] Optimize Branch Comparisons

I noticed in D94450 that there were quite a few places where we generate
the sequence:
```
  xN <- comparison ...
  xN <- xor xN, 1
  bnez xN, symbol
```

Given we know the XOR will be used by BRCOND, which only looks at the lowest
bit, I think we can remove the XOR and just invert the branch condition in
these cases?

The case mostly seems to come up in floating point tests, where there is often
more logic to combine the results of multiple SETCCs, rather than a single
(BRCOND (SETCC ...) ...).

Reviewed By: craig.topper

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

3 years agoDynamicRegisterInfo calculate offsets in separate function
Muhammad Omair Javaid [Fri, 15 Jan 2021 11:12:20 +0000 (16:12 +0500)]
DynamicRegisterInfo calculate offsets in separate function

This patch pull offset calculation logic out of DynamicRegisterInfo::Finalize
into a separate function. We are going to call this function whenever we
update SVE register sizes.

Reviewed By: labath

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

3 years ago[LLDB] Add per-thread register infos shared pointer in gdb-remote
Muhammad Omair Javaid [Fri, 15 Jan 2021 10:33:31 +0000 (15:33 +0500)]
[LLDB] Add per-thread register infos shared pointer in gdb-remote

In gdb-remote process we have register infos defind as a refernce object of
GDBRemoteDynamicRegisterInfo class. In past register infos have remained
constant througout the life time of a process.

This has changed after AArch64 SVE support where register infos will have
per-thread configuration. SVE registers will have per-thread size and can
be updated while running. This patch aims to build up for that support by
changing GDBRemoteDynamicRegisterInfo reference to a shared pointer deinfed
per-thread.

Reviewed By: labath

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

3 years ago[clangd] exclude symbols from document outline which do not originate from the main...
Ilya Golovenko [Fri, 15 Jan 2021 07:47:28 +0000 (10:47 +0300)]
[clangd] exclude symbols from document outline which do not originate from the main file

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

3 years ago[llvm-readobj][test] - Remove excessive YAML fields from tests.
Georgii Rymar [Thu, 14 Jan 2021 09:35:01 +0000 (12:35 +0300)]
[llvm-readobj][test] - Remove excessive YAML fields from tests.

This removes excessive YAML keys from `SHT_GNU_verdef` sections.
Those keys are set by default.

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

3 years ago[yaml2obj/obj2yaml] - Refine handling of SHT_GNU_verdef sections.
Georgii Rymar [Wed, 13 Jan 2021 14:16:55 +0000 (17:16 +0300)]
[yaml2obj/obj2yaml] - Refine handling of SHT_GNU_verdef sections.

This patch:
1) Makes `Version`, `Flags`, `VersionNdx` and `Hash` fields to be `Optional<>`.
2) Disallows dumping version definitions that have `vd_version != 1`.
   `vd_version` identifies the version of the structure itself.
   (https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html,
    https://docs.oracle.com/cd/E19683-01/816-7777/chapter6-80869/index.html)
3) Stops dumping default values for `Version`, `Flags`, `VersionNdx` and `Hash` fields.
4) Refines testing.

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

3 years ago[ARM][GISel] Treat calls as variadic even if only fixed arguments provided
Oliver Stannard [Wed, 6 Jan 2021 12:12:58 +0000 (12:12 +0000)]
[ARM][GISel] Treat calls as variadic even if only fixed arguments provided

For the ARM hard-float calling convention, calls to variadic functions
need to be treated diffrently, even if only the fixed arguments are
provided.

This fixes GCC-C-execute-pr68390 in the test-suite, which is failing on
the ARM GlobaISel bot.

3 years ago[llvm-nm] - Simplify the code in dumpSymbolNamesFromObject. NFC.
Georgii Rymar [Thu, 14 Jan 2021 11:45:05 +0000 (14:45 +0300)]
[llvm-nm] - Simplify the code in dumpSymbolNamesFromObject. NFC.

It is possible to simplify the logic that extracts symbol names.

D94667 made the `NMSymbol::Name` to be `std::string`,
what allowed this simplification.

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

3 years ago[libc] Allow customization of memcpy via flags.
Guillaume Chatelet [Fri, 15 Jan 2021 09:26:45 +0000 (09:26 +0000)]
[libc] Allow customization of memcpy via flags.

 - Adds LLVM_LIBC_IS_DEFINED macro to libc/src/__support/common.h
 - Adds a few knobs to memcpy to help with experimentations:
   - LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB replaces the implementation with a single call to rep;movsb
   - LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE customizes where the usage of rep;movsb

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

3 years ago[llvm-nm] - Move MachO specific logic out from the dumpSymbolNamesFromObject(). NFC.
Georgii Rymar [Thu, 14 Jan 2021 10:45:44 +0000 (13:45 +0300)]
[llvm-nm] - Move MachO specific logic out from the dumpSymbolNamesFromObject(). NFC.

`dumpSymbolNamesFromObject` is the method that dumps symbol names.

It has 563 lines, mostly because of huge piece of MachO specific code.
In this patch I move it to separate helper method.

The new size of `dumpSymbolNamesFromObject` is 93 lines. With it it becomes
much easier to maintain it.

I had to change the type of 2 name fields to `std::string`, because MachO logic
uses temporarily buffer strings (e.g `ExportsNameBuffer`, `BindsNameBuffer` etc):

```
  std::string ExportsNameBuffer;
  raw_string_ostream EOS(ExportsNameBuffer);
```

these buffers were moved to `dumpSymbolsFromDLInfoMachO` by this patch and
invalidated after return. Technically, before this patch we had a situation
when local pointers (symbol names) were assigned to members of global static `SymbolList`,
what is dirty by itself.

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

3 years ago[Debuginfo][DW_OP_implicit_pointer] (1/7) Support for DW_OP_LLVM_implicit_pointer
Alok Kumar Sharma [Fri, 15 Jan 2021 08:10:33 +0000 (13:40 +0530)]
[Debuginfo][DW_OP_implicit_pointer] (1/7) Support for DW_OP_LLVM_implicit_pointer

New dwarf operator DW_OP_LLVM_implicit_pointer is introduced (present only in LLVM IR)
This operator is required as it is different than DWARF operator
DW_OP_implicit_pointer in representation and specification (number
and types of operands) and later can not be used as multiple level.

Reviewed By: aprantl

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

3 years ago[libcxx testing] Fix UB in tests for std::lock_guard
Igor Kudrin [Thu, 14 Jan 2021 08:03:44 +0000 (15:03 +0700)]
[libcxx testing] Fix UB in tests for std::lock_guard

If mutex::try_lock() is called in a thread that already owns the mutex,
the behavior is undefined. The patch fixes the issue by creating another
thread, where the call is allowed.

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

3 years ago[AArch64][GlobalISel] Fix fallbacks introduced for G_SITOFP in 8f283cafddfa8d6d01a94b...
Amara Emerson [Fri, 15 Jan 2021 08:57:51 +0000 (00:57 -0800)]
[AArch64][GlobalISel] Fix fallbacks introduced for G_SITOFP in 8f283cafddfa8d6d01a94b48cdc5d25817569e91

If we have an integer->fp convert that has differing sizes, e.g. s32 to s64,
then don't try to convert it to AArch64::G_SITOF since it won't select.

3 years ago[llvm-readobj] - Fix the compilation with GCC < 7.0.
Georgii Rymar [Fri, 15 Jan 2021 08:57:32 +0000 (11:57 +0300)]
[llvm-readobj] - Fix the compilation with GCC < 7.0.

This addressed post commit comments for D93900.

GCC had an issue and requires placing a specialization of
`printUnwindInfo` to a namespace to compile:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

3 years ago[Clang] Mutate long-double math builtins into f128 under IEEE-quad
Qiu Chaofan [Fri, 15 Jan 2021 08:40:41 +0000 (16:40 +0800)]
[Clang] Mutate long-double math builtins into f128 under IEEE-quad

Under -mabi=ieeelongdouble on PowerPC, IEEE-quad floating point semantic
is used for long double. This patch mutates call to related builtins
into f128 version on PowerPC. And in theory, this should be applied to
other targets when their backend supports IEEE 128-bit style libcalls.

GCC already has these mutations except nansl, which is not available on
PowerPC along with other variants (nans, nansf).

Reviewed By: RKSimon, nemanjai

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

3 years agoRevert "Reapply "ADT: Fix reference invalidation in SmallVector::push_back and single...
Nikita Popov [Fri, 15 Jan 2021 07:59:17 +0000 (08:59 +0100)]
Revert "Reapply "ADT: Fix reference invalidation in SmallVector::push_back and single-element insert""

This reverts commit 260a856c2abcef49c7cb3bdcd999701db3e2af38.
This reverts commit 3043e5a5c33c4c871f4a1dfd621a8839f9a1f0b3.
This reverts commit 49142991a685bd427d7e877c29c77371dfb7634c.

This change had a larger than anticipated compile-time impact,
possibly because the small value optimization is not working as
intended. See D93779.

3 years ago[WebAssembly] Add support for table linking to wasm-ld
Andy Wingo [Thu, 14 Jan 2021 09:15:56 +0000 (10:15 +0100)]
[WebAssembly] Add support for table linking to wasm-ld

This patch adds support to wasm-ld for linking multiple table references
together, in a manner similar to wasm globals. The indirect function
table is synthesized as needed.

To manage the transitional period in which the compiler doesn't yet
produce TABLE_NUMBER relocations and doesn't residualize table symbols,
the linker will detect object files which have table imports or
definitions, but no table symbols. In that case it will synthesize
symbols for the defined and imported tables.

As a change, relocatable objects are now written with table symbols,
which can cause symbol renumbering in some of the tests. If no object
file requires an indirect function table, none will be written to the
file. Note that for legacy ObjFile inputs, this test is conservative: as
we don't have relocs for each use of the indirecy function table, we
just assume that any incoming indirect function table should be
propagated to the output.

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

3 years ago[AArch64] Add Fujitsu A64FX scheduling model
KAWASHIMA Takahiro [Mon, 4 Jan 2021 02:25:42 +0000 (11:25 +0900)]
[AArch64] Add Fujitsu A64FX scheduling model

Basic support of A64FX was added in D75594 but its scheduling model
was missing. This commit adds the scheduling model. Also, this commit
amends/adds some subtarget parameters of A64FX.

The A64FX Microarchitecture Manual, which is source information of
this commit, is on GitHub.

https://github.com/fujitsu/A64FX/

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

3 years ago[clang][cli] Specify KeyPath prefixes via TableGen classes
Jan Svoboda [Wed, 13 Jan 2021 11:50:19 +0000 (12:50 +0100)]
[clang][cli] Specify KeyPath prefixes via TableGen classes

It turns out we need to handle `LangOptions` separately from the rest of the options. `LangOptions` used to be conditionally parsed only when `!(DashX.getFormat() == InputKind::Precompiled || DashX.getLanguage() == Language::LLVM_IR)` and we need to restore this order (for more info, see D94682).

We could do this similarly to how `DiagnosticOptions` are handled: via a counterpart to the `IsDiag` mix-in (e.g. `IsLang`). These mix-ins would prefix the option key path with the appropriate `CompilerInvocation::XxxOpts` member. However, this solution would be problematic, as we'd now have two kinds of options (`Lang` and `Diag`) with seemingly incomplete key paths in the same file. To understand what `CompilerInvocation` member an option affects, one would need to read the whole option definition and notice the `IsDiag` or `IsLang` class.

Instead, this patch introduces more robust way to handle different kinds of options separately: via the `KeyPathAndMacroPrefix` class. We have one specialization of that class per `CompilerInvocation` member (e.g. `LangOpts`, `DiagnosticOpts`, etc.). Now, instead of specifying a key path with `"LangOpts->UndefPrefixes"`, we use `LangOpts<"UndefPrefixes">`. This keeps the readability intact (you don't have to look for the `IsLang` mix-in, the key path is complete on its own) and allows us to specify a custom macro prefix within `LangOpts`.

Reviewed By: Bigcheese

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

3 years ago[clang][cli] NFC: Decrease the scope of ParseCodeGenArgs parameters
Jan Svoboda [Thu, 14 Jan 2021 07:34:17 +0000 (08:34 +0100)]
[clang][cli] NFC: Decrease the scope of ParseCodeGenArgs parameters

Instead of passing the whole `TargetOptions` and `FrontendOptions` to `ParseCodeGenArgs` give it only the necessary members.
This makes tracking the dependencies between various parsers and option groups easier.

Reviewed By: Bigcheese

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

3 years ago[clang][cli] NFC: Decrease the scope of ParseLangArgs parameters
Jan Svoboda [Thu, 14 Jan 2021 07:26:12 +0000 (08:26 +0100)]
[clang][cli] NFC: Decrease the scope of ParseLangArgs parameters

Instead of passing the whole `TargetOptions` and `PreprocessorOptions` to `ParseLangArgs` give it only the necessary members.
This makes tracking the dependencies between various parsers and option groups easier.

Reviewed By: Bigcheese

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

3 years ago[mlir][sparse] retry sparse-only for cyclic iteration graphs
Aart Bik [Thu, 14 Jan 2021 20:04:49 +0000 (12:04 -0800)]
[mlir][sparse] retry sparse-only for cyclic iteration graphs

This is a very minor improvement during iteration graph construction.
If the first attempt considering the dimension order of all tensors fails,
a second attempt is made using the constraints of sparse tensors only.
Dense tensors prefer dimension order (locality) but provide random access
if needed, enabling the compilation of more sparse kernels.

Reviewed By: penpornk

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

3 years agoAdd Semantic check for Flang OpenMP 4.5 - 2.7.1 Do Loop restrictions on single direc...
Yashaswini [Fri, 15 Jan 2021 05:42:49 +0000 (11:12 +0530)]
Add Semantic check for Flang OpenMP 4.5 - 2.7.1  Do Loop restrictions on single directive and firstprivate clause.

Semantic checks added to check the worksharing 'single' region closely nested inside a worksharing 'do' region. And also to check whether the 'do' iteration variable is a variable in 'Firstprivate' clause.

Files:
check-directive-structure.h
check-omp-structure.h
check-omp-structure.cpp

Testcases:
omp-do01-positivecase.f90
omp-do01.f90
omp-do05-positivecase.f90
omp-do05.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan , Valentin Clement @clementval

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

3 years ago[llvm] Remove redundant return and continue statements (NFC)
Kazu Hirata [Fri, 15 Jan 2021 04:30:34 +0000 (20:30 -0800)]
[llvm] Remove redundant return and continue statements (NFC)

Identified with readability-redundant-control-flow.

3 years ago[llvm] Use llvm::drop_begin (NFC)
Kazu Hirata [Fri, 15 Jan 2021 04:30:32 +0000 (20:30 -0800)]
[llvm] Use llvm::drop_begin (NFC)

3 years ago[CodeGen, Transforms] Use llvm::sort (NFC)
Kazu Hirata [Fri, 15 Jan 2021 04:30:31 +0000 (20:30 -0800)]
[CodeGen, Transforms] Use llvm::sort (NFC)

3 years ago[libc] Add memmove implementation.
Cheng Wang [Wed, 25 Nov 2020 13:12:48 +0000 (21:12 +0800)]
[libc] Add memmove implementation.

Use `memcpy` rather than copying bytes one by one, for there might be large
size structs to move.

Reviewed By: gchatelet, sivachandra

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

3 years ago[AArch64][GlobalISel] Add selection support for fpr bank source variants of G_SITOFP...
Amara Emerson [Thu, 14 Jan 2021 18:56:04 +0000 (10:56 -0800)]
[AArch64][GlobalISel] Add selection support for fpr bank source variants of G_SITOFP and G_UITOFP.

In order to import patterns for these, we need to define new ops that can map to
the AArch64ISD::[SU]ITOF nodes. We then transform fpr->fpr variants of the generic
opcodes to these custom opcodes in preisel-lowering. We have to do it here and
not the PostLegalizer combiner because this has to run after regbankselect.

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

3 years ago[libTooling] Change `addInclude` to use expansion locs.
Yitzhak Mandelbaum [Tue, 22 Dec 2020 15:02:56 +0000 (15:02 +0000)]
[libTooling] Change `addInclude` to use expansion locs.

This patch changes the default range used to anchor the include insertion to use
an expansion loc.  This ensures that the location is valid, when the user relies
on the default range.

Driveby: extend a FIXME for a problem that was emphasized by this change; fix some spellings.

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

3 years ago[libomptarget][nvptx] Reduce calls to cuda header
Jon Chesterfield [Fri, 15 Jan 2021 02:16:32 +0000 (02:16 +0000)]
[libomptarget][nvptx] Reduce calls to cuda header

[libomptarget][nvptx] Reduce calls to cuda header

Remove use of clock_t in favour of a builtin. Drop a preprocessor branch.

Reviewed By: jdoerfert

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

3 years agoReland "[AsmParser] make .ascii support spaces as separators"
Jian Cai [Fri, 15 Jan 2021 01:33:20 +0000 (17:33 -0800)]
Reland "[AsmParser] make .ascii support spaces as separators"

This relands commit e0963ae274be5b071d1e1b00f5e4e019483c09e9, which was
reverted on commit 82c4153e66fa284729da86a8d6c302d4b8cec86c due to a
test failure, which turned out to be a false positive.

3 years ago[AArch64][GlobalISel] Assign FPR banks to loads which are used by integer->float...
Amara Emerson [Thu, 14 Jan 2021 18:53:56 +0000 (10:53 -0800)]
[AArch64][GlobalISel] Assign FPR banks to loads which are used by integer->float conversions.

G_[US]ITOFP users of loads on AArch64 can operate on both gpr and fpr banks for scalars.
Because of this, if their source is a load, then that load can be assigned to an fpr
bank and therefore avoid having to do a cross bank copy via a gpr->fpr conversion.

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

3 years ago[flang] Fix use-associated procedure in generic
Tim Keith [Fri, 15 Jan 2021 00:31:48 +0000 (16:31 -0800)]
[flang] Fix use-associated procedure in generic

When a use-associated procedure was included in a generic, we weren't
correctly recording that fact. The ultimate symbol was added rather than
the local symbol.

Also, improve the message emitted for the specific procedure by
mentioning the module it came from.

This fixes one of the problems in https://bugs.llvm.org/show_bug.cgi?id=48648.

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

3 years ago[libomptarget][nvptx][nfc] Move target_impl functions out of header
Jon Chesterfield [Fri, 15 Jan 2021 00:19:48 +0000 (00:19 +0000)]
[libomptarget][nvptx][nfc] Move target_impl functions out of header

[libomptarget][nvptx][nfc] Move target_impl functions out of header

This removes most of the differences between the two target_impl.h.

Also change name mangling from C to C++ for __kmpc_impl_*_lock.

Reviewed By: tianshilei1992

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

3 years ago[mlir][Linalg] NFC: Verify tiling on linalg.generic operation on tensors.
MaheshRavishankar [Thu, 14 Jan 2021 23:41:12 +0000 (15:41 -0800)]
[mlir][Linalg] NFC: Verify tiling on linalg.generic operation on tensors.

With the recent changes to linalg on tensor semantics, the tiling
operations works out-of-the-box for generic operations. Add a test to
verify that and some minor refactoring.

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

3 years ago[mlir][Linalg] Add canonicalization of linalg op -> dim op.
MaheshRavishankar [Thu, 14 Jan 2021 23:41:04 +0000 (15:41 -0800)]
[mlir][Linalg] Add canonicalization of linalg op -> dim op.

Add canonicalization to replace use of the result of a linalg
operation on tensors in a dim operation, to use one of the operands of
the linalg operations instead. This allows the linalg op itself to be
deleted when all its non-dim uses are removed (say through tiling, etc.)

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

3 years ago[OpenMP] Remove omptarget-nvptx from deps as it is no longer a valid target
Shilei Tian [Fri, 15 Jan 2021 00:14:19 +0000 (19:14 -0500)]
[OpenMP] Remove omptarget-nvptx from deps as it is no longer a valid target

`omptarget-nvptx` is still a dependence for `check-libomptarget-nvtpx`
although it has been removed by D94573.

Reviewed By: JonChesterfield

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

3 years ago[SLP] remove unnecessary state in matching reductions
Sanjay Patel [Thu, 14 Jan 2021 22:26:48 +0000 (17:26 -0500)]
[SLP] remove unnecessary state in matching reductions

This is NFC-intended. I'm still trying to figure out
how the loop where this is used works. It does not
seem like we require this data at all, but it's
hard to confirm given the complicated predicates.

3 years ago[mlir][Linalg] Add canonicalization to remove no-op linalg operations.
MaheshRavishankar [Thu, 14 Jan 2021 22:58:04 +0000 (14:58 -0800)]
[mlir][Linalg] Add canonicalization to remove no-op linalg operations.

linalg.generic/indexed_generic operations on tensors whose body is
just yielding the (non-induction variable) arguments of the operation
can be canonicalized by replacing uses of the result with the
corresponding arguments.

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

3 years ago[clangd] Reduce logspam for CDB scanning
Sam McCall [Thu, 14 Jan 2021 22:54:51 +0000 (23:54 +0100)]
[clangd] Reduce logspam for CDB scanning

3 years ago[mlir] Remove over specified memory effects
Andrew Young [Thu, 14 Jan 2021 10:07:29 +0000 (02:07 -0800)]
[mlir] Remove over specified memory effects

The standard and gpu dialect both have `alloc` operations which use the
memory effect `MemAlloc`.  In both cases, it is specified on both  the
operation itself and on the result.  This results in two memory effects
being created for these operations.  When `MemAlloc` is defined on an
operation, it represents some background effect which the compiler
cannot reason about, and  inhibits the ability of the compiler to
remove dead `std.alloc` operations.  This change removes the uneeded
`MemAlloc` effect from these operations and leaves the effect on the
result, which allows dead allocs to be erased.

There is the same problem, but to a lesser extent, with MemFree, MemRead
and MemWrite. Over-specifying these traits is not currently inhibiting
any optimization.

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

3 years ago[RISCV][NFC] Regenerate Calling Convention Tests
Sam Elliott [Thu, 14 Jan 2021 22:32:17 +0000 (22:32 +0000)]
[RISCV][NFC] Regenerate Calling Convention Tests

This regenerates these tests using utils/update_llc_test_checks.py so
that future changes in this area don't have the noise of lots of `@plt`
lines being added.

I also removed the `nounwind`s from the stack-realignment.ll test to
increase coverage on the generated call frame information.

3 years ago[LTO] Test format fix (NFC)
Teresa Johnson [Thu, 14 Jan 2021 22:07:11 +0000 (14:07 -0800)]
[LTO] Test format fix (NFC)

As requested in D91583, use ';;' instead of ';' to preceed comments in
lld test. I did this in the equivalent gold test as well.

3 years agoRe-land [Support] On Windows, take the affinity mask into account
Alexandre Ganea [Thu, 14 Jan 2021 22:03:13 +0000 (17:03 -0500)]
Re-land [Support] On Windows, take the affinity mask into account

The number of hardware threads available to a ThreadPool can be limited if setting an affinity mask.
For example:

    > start /B /AFFINITY 0xF lld-link.exe ...

Would let LLD only use 4 hyper-threads.

Previously, there was an outstanding issue on Windows Server 2019 on dual-CPU machines, which was preventing from using both CPU sockets. In normal conditions, when no affinity mask was set, ProcessorGroup::AllThreads was different from ProcessorGroup::UsableThreads. The previous code in llvm/lib/Support/Windows/Threading.inc L201 was improperly assuming those two values to be equal, and consequently was limiting the execution to only one CPU socket.

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

3 years ago[RISCV] Optimize select_cc after fp compare expansion
Craig Topper [Thu, 14 Jan 2021 21:41:35 +0000 (13:41 -0800)]
[RISCV] Optimize select_cc after fp compare expansion

Some FP compares expand to a sequence ending with (xor X, 1) to invert the result. If
the consumer is a select_cc we can likely get rid of this xor by fixing
up the select_cc condition.

This patch combines (select_cc (xor X, 1), 0, setne, trueV, falseV) -
(select_cc X, 0, seteq, trueV, falseV) if we can prove X is 0/1.

Reviewed By: lenary

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

3 years agoAdd -fexceptions to test as it uses them and fails on platforms where it is not on...
Douglas Yung [Thu, 14 Jan 2021 21:26:21 +0000 (13:26 -0800)]
Add -fexceptions to test as it uses them and fails on platforms where it is not on by default (like the PS4).

3 years ago[libc] Use #undef isascii in specific header
Roland McGrath [Thu, 14 Jan 2021 01:22:45 +0000 (17:22 -0800)]
[libc] Use #undef isascii in specific header

Standard C allows all standard headers to declare macros for all
their functions.  So after possibly including any standard header
like <ctype.h>, it's perfectly normal for any and all of the
functions it declares to be defined as macros.  Standard C requires
explicit `#undef` before using that identifier in a way that is not
compatible with function-like macro definitions.

The C standard's rules for this are extended to POSIX as well for
the interfaces it defines, and it's the expected norm for
nonstandard extensions declared by standard C library headers too.

So far the only place this has come up for llvm-libc's code is with
the isascii function in Fuchsia's libc.  But other cases can arise
for any standard (or common extension) function names that source
code in llvm-libc is using in nonstandard ways, i.e. as C++
identifiers.

The only correct and robust way to handle the possible inclusion of
standard C library headers when building llvm-libc source code is to
use `#undef` explicitly for each identifier before using it.  The
easy and obvious place to do that is in the per-function header.
This requires that all code, such as test code, that might include
any standard C library headers, e.g. via utils/UnitTest/Test.h, make
sure to include those *first* before the per-function header.

This change does that for isascii and its test.  But it should be
done uniformly for all the code and documented as a consistent
convention so new implementation files are sure to get this right.

Reviewed By: sivachandra

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

3 years ago[gn build] (manually) port 387d3c24792f
Nico Weber [Thu, 14 Jan 2021 21:19:25 +0000 (16:19 -0500)]
[gn build] (manually) port 387d3c24792f

3 years ago[PowerPC] Only use some extend mne if assembler is modern enough
Jinsong Ji [Thu, 14 Jan 2021 20:35:56 +0000 (20:35 +0000)]
[PowerPC] Only use some extend mne if assembler is modern enough

Legacy AIX assembly might not support all extended mnes,
add one feature bit to control the generation in MC,
and avoid generating them by default on AIX.

Reviewed By: sfertile

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

3 years ago[mlir][docs] Bring bufferization docs up to date.
Sean Silva [Sat, 9 Jan 2021 00:25:47 +0000 (16:25 -0800)]
[mlir][docs] Bring bufferization docs up to date.

This spilts out BufferDeallocationInternals.md, since buffer
deallocation is not part of bufferization per se.

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

3 years ago[clang] Do not crash when CXXRecordDecl has a non-CXXRecordDecl base.
Adam Czachorowski [Thu, 14 Jan 2021 19:54:16 +0000 (20:54 +0100)]
[clang] Do not crash when CXXRecordDecl has a non-CXXRecordDecl base.

This can happen on some invalid code, like the included test case.

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

3 years ago[mlir] Remove TosaToLinalg dependency on all Passes
Tres Popp [Thu, 14 Jan 2021 20:04:37 +0000 (21:04 +0100)]
[mlir] Remove TosaToLinalg dependency on all Passes

TosaToLinalg was depending on its header file indirectly through
Passes.h rather than directly. This removes that indirection.

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

3 years ago[mlir][PatternRewriter] Add a new hook to selectively replace uses of an operation
River Riddle [Thu, 14 Jan 2021 19:57:17 +0000 (11:57 -0800)]
[mlir][PatternRewriter] Add a new hook to selectively replace uses of an operation

This revision adds a new `replaceOpWithIf` hook that replaces uses of an operation that satisfy a given functor. If all uses are replaced, the operation gets erased in a similar manner to `replaceOp`. DialectConversion support will be added in a followup as this requires adjusting how replacements are tracked there.

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

3 years ago[RISCV] Merge Utils library into MCTargetDesc
Craig Topper [Thu, 14 Jan 2021 19:44:02 +0000 (11:44 -0800)]
[RISCV] Merge Utils library into MCTargetDesc

MCTargetDesc includes headers from Utils and Utils includes headers
from MCTargetDesc. So from a library layering perspective it makes sense
for them to be in the same library. I guess the other option might be to
move the tablegen includes from RISCVMCTargetDesc.h to RISCVBaseInfo.h
so that RISCVBaseInfo.h didn't need to include RISCVMCTargetDesc.h.
Everything else that depends on Utils also depends on MCTargetDesc so
having one library seemed simpler.

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

3 years ago[Driver] -gsplit-dwarf: Produce .dwo regardless of -gN for IR input
Fangrui Song [Thu, 14 Jan 2021 19:46:22 +0000 (11:46 -0800)]
[Driver] -gsplit-dwarf: Produce .dwo regardless of -gN for IR input

This generalizes D94647 to IR input, as suggested by @tejohnson.
Ideally the driver should just forward split dwarf options, but doing this currently will cause `clang -gsplit-dwarf -c a.c` to create a .dwo with just `.strtab`.

Reviewed By: dblaikie, tejohnson

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

3 years ago[mlir][OpFormatGen] Format enum attribute cases as keywords when possible
River Riddle [Thu, 14 Jan 2021 19:35:15 +0000 (11:35 -0800)]
[mlir][OpFormatGen] Format enum attribute cases as keywords when possible

In the overwhelmingly common case, enum attribute case strings represent valid identifiers in MLIR syntax. This revision updates the format generator to format as a keyword in these cases, removing the need to wrap values in a string. The parser still retains the ability to parse the string form, but the printer will use the keyword form when applicable.

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

3 years ago[mlir][ODS] Add new RangedTypesMatchWith operation predicate
River Riddle [Thu, 14 Jan 2021 19:34:55 +0000 (11:34 -0800)]
[mlir][ODS] Add new RangedTypesMatchWith operation predicate

This is a variant of TypesMatchWith that provides support for variadic arguments. This is necessary because ranges generally can't use the default operator== comparators for checking equality.

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

3 years ago[BasicAA] Handle recursive queries more efficiently
Nikita Popov [Tue, 10 Nov 2020 19:43:46 +0000 (20:43 +0100)]
[BasicAA] Handle recursive queries more efficiently

An alias query currently works out roughly like this:

 * Look up location pair in cache.
 * Perform BasicAA logic (including cache lookup and insertion...)
 * Perform a recursive query using BestAAResults.
   * Look up location pair in cache (and thus do not recurse into BasicAA)
   * Query all the other AA providers.
 * Query all the other AA providers.

This is a lot of unnecessary work, all ultimately caused by the
BestAAResults query at the end of aliasCheck(). The reason we perform
it, is that aliasCheck() is getting called recursively, and we of
course want those recursive queries to also make use of other AA
providers, not just BasicAA. We can solve this by making the recursive
queries directly use BestAAResults (which will check both BasicAA
and other providers), rather than recursing into aliasCheck().

There are some tradeoffs:

 * We can no longer pass through the precomputed underlying object
   to aliasCheck(). This is not a major concern, because nowadays
   getUnderlyingObject() is quite cheap.
 * Results from other AA providers are no longer cached inside
   BasicAA. The way this worked was already a bit iffy, in that a
   result could be cached, but if it was MayAlias, we'd still end
   up re-querying other providers anyway. If we want to cache
   non-BasicAA results, we should do that in a more principled manner.

In any case, despite those tradeoffs, this works out to be a decent
compile-time improvment. I think it also simplifies the mental model
of how BasicAA works. It took me quite a while to fully understand
how these things interact.

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

3 years agoAdd newline to terminate debug message (NFC)
Mehdi Amini [Thu, 14 Jan 2021 19:28:49 +0000 (19:28 +0000)]
Add newline to terminate debug message (NFC)

3 years ago[MLIR][TOSA] First lowerings from Tosa to Linalg
Rob Suderman [Tue, 5 Jan 2021 22:26:48 +0000 (14:26 -0800)]
[MLIR][TOSA] First lowerings from Tosa to Linalg

Initial commit to add support for lowering from TOSA to Linalg. The focus is on
the essential infrastructure for these lowerings and integration with existing
passes.

Includes lowerings for a subset of operations including:
  abs, add, sub, pow, and, or, xor, left shift, right shift, tanh

Lit tests are used to validate correctness.

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

3 years ago[NFC] Update test to not check for 'opaque' in the file name.
Erich Keane [Thu, 14 Jan 2021 19:00:49 +0000 (11:00 -0800)]
[NFC] Update test to not check for 'opaque' in the file name.

The intent presumably is to avoid generating 'opaque' in the IR, but the
header contains the filename. Thus, having the workspace in a directory
with opaque in it causes this test to fail.

This just adds a 'CHECK' line on target-triple, which is the last line
of the IR-header.

3 years ago[openacc] Rename generated file from ACC.cpp.inc to ACC.inc to match D92955
Valentin Clement [Thu, 14 Jan 2021 19:19:35 +0000 (14:19 -0500)]
[openacc] Rename generated file from ACC.cpp.inc to ACC.inc to match D92955

This patch rename the tablegen generated file ACC.cpp.inc to ACC.inc in order
to match what was done in D92955. This file is included in header file as well as .cpp
file so it make more sense.

Reviewed By: sameeranjoshi

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

3 years ago[GWP-ASan] Minor refactor of optional components.
Mitch Phillips [Thu, 14 Jan 2021 01:28:10 +0000 (17:28 -0800)]
[GWP-ASan] Minor refactor of optional components.

In preparation for the inbuilt options parser, this is a minor refactor
of optional components including:
 - Putting certain optional elements in the right header files,
 according to their function and their dependencies.
 - Cleaning up some old and mostly-dead code.
 - Moving some functions into anonymous namespaces to prevent symbol
 export.

Reviewed By: cryptoad, eugenis

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

3 years ago[OpenMP] Dropped unnecessary define when compiling deviceRTLs for NVPTX
Shilei Tian [Thu, 14 Jan 2021 18:55:05 +0000 (13:55 -0500)]
[OpenMP] Dropped unnecessary define when compiling deviceRTLs for NVPTX

The comment said CUDA 9 header files use the `nv_weak` attribute which
`clang` is not yet prepared to handle. It's three years ago and now things have
changed. Based on my test, removing the definition doesn't have any problem on
my machine with CUDA 11.1 installed.

Reviewed By: jdoerfert

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

3 years ago[X86] Add the FSRM feature (Fast Short Rep Mov) to Zen3.
Hiroshi Yamauchi [Mon, 11 Jan 2021 19:02:37 +0000 (11:02 -0800)]
[X86] Add the FSRM feature (Fast Short Rep Mov) to Zen3.

Note -x86-use-fsrm-for-memcpy is still disabled by default and there's no
default behavior change.

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

3 years ago[clang][MSVC] Fix missing MSInheritanceAttr in template specialization.
Zequan Wu [Thu, 14 Jan 2021 03:14:25 +0000 (19:14 -0800)]
[clang][MSVC] Fix missing MSInheritanceAttr in template specialization.

Fix PR48687.

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

3 years ago[OpenMP] Drop the static library libomptarget-nvptx
Shilei Tian [Thu, 14 Jan 2021 18:34:18 +0000 (13:34 -0500)]
[OpenMP] Drop the static library libomptarget-nvptx

For NVPTX target, OpenMP provides a static library `libomptarget-nvptx`
built by NVCC, and another bitcode `libomptarget-nvptx-sm_{$sm}.bc` generated by
Clang. When compiling an OpenMP program, the `.bc` file will be fed to `clang`
in the second run on the program that compiles the target part. Then the generated
PTX file will be fed to `ptxas` to generate the object file, and finally the driver
invokes `nvlink` to generate the binary, where the static library will be appened
to `nvlink`.

One question is, why do we need two libraries? The only difference is, the static
library contains `omp_data.cu` and the bitcode library doesn't. It's unclear why
they were implemented in this way, but per D94565, there is no issue if we also
include the file into the bitcode library. Therefore, we can safely drop the
static library.

This patch is about the change in OpenMP. The driver will be updated as well if
this patch is accepted.

Reviewed By: jdoerfert, JonChesterfield

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

3 years agoSupport emptiness checks for unbounded FlatAffineConstraints.
Arjun P [Thu, 14 Jan 2021 18:29:51 +0000 (19:29 +0100)]
Support emptiness checks for unbounded FlatAffineConstraints.

With this, we have complete support for emptiness checks. This also paves the way for future support to check if two FlatAffineConstraints are equal.

Reviewed By: ftynse

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

3 years ago[HIP] Add signbit(long double) decl
Aaron En Ye Shi [Thu, 14 Jan 2021 17:52:27 +0000 (17:52 +0000)]
[HIP] Add signbit(long double) decl

An _MSC_VER version of signbit(long double) is required for MSVC headers.

Fixes: SWDEV-256409

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

3 years ago[LLDB] MinidumpParser: Prefer executable module even at higher address
Joseph Tremoulet [Thu, 14 Jan 2021 18:17:02 +0000 (13:17 -0500)]
[LLDB] MinidumpParser: Prefer executable module even at higher address

When a program maps one of its own modules for reading, and then
crashes, breakpad can emit two entries for that module in the
ModuleList.  We have logic to identify this case by checking permissions
on mapped memory regions and report just the module with an executable
region.  As currently written, though, the check is asymmetric -- the
entry with the executable region must be the second one encountered for
the preference to kick in.

This change makes the logic symmetric, so that the first-encountered
module will similarly be preferred if it has an executable region but
the second-encountered module does not.  This happens for example when
the module in question is the executable itself, which breakpad likes to
report first -- we need to ignore the other entry for that module when
we see it later, even though it may be mapped at a lower virtual
address.

Reviewed By: clayborg

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

3 years ago[SelectionDAG] Remove an early-out from computeKnownBits for smin/smax
Jay Foad [Thu, 3 Sep 2020 18:22:33 +0000 (19:22 +0100)]
[SelectionDAG] Remove an early-out from computeKnownBits for smin/smax

Even if we know nothing about LHS, it can still be useful to know that
smax(LHS, RHS) >= RHS and smin(LHS, RHS) <= RHS.

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

3 years ago[libomptarget][amdgpu] Fix kernel launch tracing to match previous behavior
Jon Chesterfield [Thu, 14 Jan 2021 18:13:22 +0000 (18:13 +0000)]
[libomptarget][amdgpu] Fix kernel launch tracing to match previous behavior

Restore control of kernel launch tracing to be >= 1 as it was before

export LIBOMPTARGET_KERNEL_TRACE=1

Reviewed By: JonChesterfield

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

3 years ago[X86][AVX] Adjust unsigned saturation downconvert negative test
Simon Pilgrim [Thu, 14 Jan 2021 17:51:06 +0000 (17:51 +0000)]
[X86][AVX] Adjust unsigned saturation downconvert negative test

D87145 was showing that this test (added in D45315) could always be constant folded (with suitable value tracking).

What we actually needed was smax(smin()) negative test coverage, the invert of negative_test2_smax_usat_trunc_wb_256_mem, so I've tweaked the test to provide that instead.

3 years ago[NewPM] Fix placement of LoopFlatten
Arthur Eubanks [Thu, 14 Jan 2021 05:46:25 +0000 (21:46 -0800)]
[NewPM] Fix placement of LoopFlatten

https://reviews.llvm.org/D90402 was inconsistent with where it put
LoopFlatten between the two pass managers. It also missed adding it to
the non-O1 function simplification pipeline.

PR48738

Reviewed By: SjoerdMeijer

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

3 years ago[NFC] Disallow unused prefixes under MC/AArch64
Mircea Trofin [Wed, 13 Jan 2021 18:39:25 +0000 (10:39 -0800)]
[NFC] Disallow unused prefixes under MC/AArch64

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

3 years ago[flang] Fix some module file issues exposed by Whizard
peter klausler [Wed, 13 Jan 2021 22:12:23 +0000 (14:12 -0800)]
[flang] Fix some module file issues exposed by Whizard

Generic type-bound interfaces for user-defined operators need to be formatted
as "OPERATOR(.op.)", not just ".op."

PRIVATE generics need to be marked as such.

Declaration ordering: when a generic interface shadows a
derived type of the same name, it needs to be emitted to the
module file at the point of definition of the derived type;
otherwise, the derived type's definition may appear after its
first use.

The module symbol for a module read from a module file needs
to be marked as coming from a module file before semantic
processing is performed on the contents of the module so that
any special handling for declarations in module files can be
properly activated.

IMPORT statements were sometimes missing for use-associated
symbols in surrounding scopes; fine-tune NeedImport().

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

3 years ago[gn build] Port 2f395b7092bd
LLVM GN Syncbot [Thu, 14 Jan 2021 17:39:58 +0000 (17:39 +0000)]
[gn build] Port 2f395b7092bd

3 years ago[clangd] Trivial: Documentation fix in ASTSignals.
Utkarsh Saxena [Thu, 14 Jan 2021 17:38:42 +0000 (18:38 +0100)]
[clangd] Trivial: Documentation fix in ASTSignals.

3 years ago[clangd] Make AST-based signals available to runWithPreamble.
Utkarsh Saxena [Sun, 10 Jan 2021 15:23:03 +0000 (16:23 +0100)]
[clangd] Make AST-based signals available to runWithPreamble.

Many useful signals can be derived from a valid AST which is regularly updated by
the ASTWorker. `runWithPreamble` does not have access to the ParsedAST
but it can be provided access to some signals derived from a (possibly
stale) AST.

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