platform/upstream/llvm.git
3 years ago[SLP] Add test case showing a bug when dealing with padded types
Bjorn Pettersson [Tue, 12 Jan 2021 15:28:16 +0000 (16:28 +0100)]
[SLP] Add test case showing a bug when dealing with padded types

We shouldn't vectorize stores of non-packed types (i.e. types that
has padding between consecutive variables in a scalar layout,
but being packed in a vector layout).

The problem was detected as a miscompile in a downstream test case.

This is a pre-commit of a test case for the fix in D94446.

3 years ago[mlir][spirv] NFC: place ops in the proper file for their categories
Lei Zhang [Mon, 11 Jan 2021 14:58:31 +0000 (09:58 -0500)]
[mlir][spirv] NFC: place ops in the proper file for their categories

This commit moves dangling ops in the main ops.td file to the proper
file matching their categories. This makes ops.td as purely including
all category files.

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

3 years ago[VE] Update VELIntrinsic tests
Kazushi (Jam) Marukawa [Tue, 12 Jan 2021 12:36:55 +0000 (21:36 +0900)]
[VE] Update VELIntrinsic tests

Update comment and style of regression tests for VELIntrinsic

Reviewed By: simoll

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

3 years ago[X86] Improved lowering for saturating float to int.
Bevin Hansson [Tue, 12 Jan 2021 14:40:36 +0000 (15:40 +0100)]
[X86] Improved lowering for saturating float to int.

Adapted from D54696 by @nikic.

This patch improves lowering of saturating float to
int conversions, FP_TO_[SU]INT_SAT, for X86.

Reviewed By: craig.topper

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

3 years ago[mlir][openacc] Use TableGen information for default enum
Valentin Clement [Tue, 12 Jan 2021 14:42:25 +0000 (09:42 -0500)]
[mlir][openacc] Use TableGen information for default enum

Use TableGen and information in ACC.td for the Default enum in the OpenACC dialect.
This patch generalize what was done for OpenMP for directives.

Follow up patch after D93576

Reviewed By: kiranchandramohan

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

3 years ago[TableGen] Improve error message for semicolon after braced body.
Paul C. Anagnostopoulos [Mon, 11 Jan 2021 14:46:27 +0000 (09:46 -0500)]
[TableGen] Improve error message for semicolon after braced body.

Add a test for this message.

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

3 years ago[mlir][Linalg] NFC - Refactor fusion APIs
Nicolas Vasilache [Tue, 12 Jan 2021 14:01:59 +0000 (14:01 +0000)]
[mlir][Linalg] NFC - Refactor fusion APIs

This revision uniformizes fusion APIs to allow passing OpOperand, OpResult and adds a finer level of control fusion.

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

3 years ago[X86][SSE] getFauxShuffleMask - handle PACKSS(SRAI(),SRAI()) shuffle patterns.
Simon Pilgrim [Tue, 12 Jan 2021 14:07:53 +0000 (14:07 +0000)]
[X86][SSE] getFauxShuffleMask - handle PACKSS(SRAI(),SRAI()) shuffle patterns.

We can't easily treat ASHR a faux shuffle, but if it was just feeding a PACKSS then it was likely being used as sign-extension for a truncation, so just peek through and adjust the mask accordingly.

3 years ago[X86][SSE] combineSubToSubus - add v16i32 handling on pre-AVX512BW targets.
Simon Pilgrim [Tue, 12 Jan 2021 13:43:56 +0000 (13:43 +0000)]
[X86][SSE] combineSubToSubus - add v16i32 handling on pre-AVX512BW targets.

v16i32 -> v16i16/v8i16 truncation is now good enough using PACKSS/PACKUS + shuffle combining that its no longer necessary to early-out on pre-AVX512BW targets.

This was noticed while looking at completing PR40111 and moving combineSubToSubus to DAGCombine entirely.

3 years ago[Fixed Point] Add codegen for conversion between fixed-point and floating point.
Bevin Hansson [Mon, 11 Jan 2021 21:46:42 +0000 (22:46 +0100)]
[Fixed Point] Add codegen for conversion between fixed-point and floating point.

The patch adds the required methods to FixedPointBuilder
for converting between fixed-point and floating point,
and uses them from Clang.

This depends on D54749.

Reviewed By: leonardchan

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

3 years ago[X86][SSE] combineSubToSubus - remove SSE2 early-out.
Simon Pilgrim [Tue, 12 Jan 2021 11:50:09 +0000 (11:50 +0000)]
[X86][SSE] combineSubToSubus - remove SSE2 early-out.

SSE2 truncation codegen has improved over the past few years (mainly due to better shuffle lowering/combining and computeKnownBits) - its no longer necessary to early-out from v8i32/v8i64 truncations.

This was noticed while looking at completing PR40111 and moving combineSubToSubus to DAGCombine entirely.

3 years ago[RISCV] Improve scalable-vector shift tests (NFC)
Fraser Cormack [Fri, 8 Jan 2021 17:14:08 +0000 (17:14 +0000)]
[RISCV] Improve scalable-vector shift tests (NFC)

All i8/i16 and several i32 tests were testing immediate shift amounts
which exceeded the bits in the vector elements, creating poison values.
Amend the tests to test well-behaved shift amounts.

3 years agoChange the LLVM_ATTRIBUTE_DEPRECATED macro to use C++14 attribute.
Christian Sigg [Thu, 7 Jan 2021 08:41:36 +0000 (09:41 +0100)]
Change the LLVM_ATTRIBUTE_DEPRECATED macro to use C++14 attribute.

C++14 attributes are superior because they can be applied to functions with inline definition and the syntax is cleaner.

I intend to convert all uses and then remove the macro.

One issue that might hold back switching uses to C++14  attributes is that
clang-format does not put long attributes on separate lines and formatted code will look like:

```
template <typename T>
[[deprecated("blah blah")]] void
    foooooooooooooooooooooooooooo() {
  ...
}
```

Putting long attributes on a separate line would be prettier.
See https://stackoverflow.com/questions/45740466/clang-format-setting-to-control-c-attributes

AttributeMacros probably won't help because it can't match the custom message.
https://clang.llvm.org/docs/ClangFormatStyleOptions.html

Reviewed By: rriddle, MaskRay

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

3 years agoRevert "[Test] Add failing test for PR48725"
Nico Weber [Tue, 12 Jan 2021 11:30:32 +0000 (06:30 -0500)]
Revert "[Test] Add failing test for PR48725"

This reverts commit e8287cb2b2923af9da72fd953e2ec5495c33861a.
Test unexpectedly passes on mac, see comment 2 on PR48725.

3 years ago[obj2yaml] - Don't crash when an object has an empty symbol table.
Georgii Rymar [Tue, 22 Dec 2020 14:36:16 +0000 (17:36 +0300)]
[obj2yaml] - Don't crash when an object has an empty symbol table.

Currently we crash when we have an object with SHT_SYMTAB/SHT_DYNSYM sections
of size 0.

With this patch instead of the crash we start to dump them properly.

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

3 years ago[obj2yaml,yaml2obj] - Fix issues with creating/dumping group sections.
Georgii Rymar [Mon, 28 Dec 2020 09:20:51 +0000 (12:20 +0300)]
[obj2yaml,yaml2obj] - Fix issues with creating/dumping group sections.

We have the following issues related to group sections:
1) yaml2obj is unable to set the custom `sh_entsize` value, because the `EntSize`
   key is currently ignored.
2) obj2yaml is unable to dump the group section which `sh_entsize != 4`.
3) obj2yaml always dumps the "EntSize" for group sections, though
   usually we are trying to omit dumping default values when dumping keys.
   I.e. we should not print the "EntSize" key when `sh_entsize` == 4.

This patch fixes (1),(3) and adds the test case to document the behavior of (2).

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

3 years ago[AMDGPU][GlobalISel] Remove some duplicate RUN lines
Jay Foad [Wed, 26 Aug 2020 13:08:14 +0000 (14:08 +0100)]
[AMDGPU][GlobalISel] Remove some duplicate RUN lines

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

3 years ago[SlotIndexes] Fix and simplify basic block splitting
Jay Foad [Fri, 8 Jan 2021 13:40:29 +0000 (13:40 +0000)]
[SlotIndexes] Fix and simplify basic block splitting

Remove the InsertionPoint argument from SlotIndexes::insertMBBInMaps
because it was confusing: what does it mean to insert a new block
between two instructions, in the middle of an existing block?

Instead, support the case that MachineBasicBlock::splitAt really needs,
where the new block contains some instructions that are already in the
maps because they have been moved there from the tail of the previous
block.

In all other use cases the new block is empty.

Based on work by Carl Ritson!

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

3 years ago[clang][AST] Get rid of an alignment hack in DeclObjC.h [NFCI]
Mikhail Maltsev [Tue, 12 Jan 2021 10:22:35 +0000 (10:22 +0000)]
[clang][AST] Get rid of an alignment hack in DeclObjC.h [NFCI]

This code currently uses a union object to increase the
alignment of the type ObjCTypeParamList. The original intent of this
trick was to be able to use the expression `this + 1` to access the
beginning of a tail-allocated array of `ObjCTypeParamDecl *` pointers.

The code has since been refactored and uses `llvm::TrailingObjects` to
manage the tail-allocated array. This template takes care of
alignment, so the hack is no longer necessary.

This patch removes the union so that the `SourceRange` class can be
used directly instead of being re-implemented with raw representations
of source locations.

Reviewed By: aprantl

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

3 years ago[llvm-readobj] - One more attempt to fix BB.
Georgii Rymar [Tue, 12 Jan 2021 10:17:23 +0000 (13:17 +0300)]
[llvm-readobj] - One more attempt to fix BB.

Add `this->` for `W`, which is the member of `ObjDumper`

An example of error:
readobj/ELFDumper.cpp:738:13: error: use of undeclared identifier 'W'
    assert(&W.getOStream() == &llvm::fouts());

3 years ago[mlir][openmp][NFCI] Rename `continuationIP` to `continuationBlock`
Sourabh Singh Tomar [Tue, 12 Jan 2021 10:13:33 +0000 (15:43 +0530)]
[mlir][openmp][NFCI] Rename `continuationIP` to `continuationBlock`

Argument is a `Block` not a `point`.

3 years ago[llvm-readobj] - An attempt to fix BB.
Georgii Rymar [Tue, 12 Jan 2021 10:09:49 +0000 (13:09 +0300)]
[llvm-readobj] - An attempt to fix BB.

This adds the `template` keyword for 'getAsArrayRef' calls.

An example of error:
/b/1/openmp-gcc-x86_64-linux-debian/llvm.src/llvm/tools/llvm-readobj/ELFDumper.cpp:4491:50: error: use 'template' keyword to treat 'getAsArrayRef' as a dependent template name
    for (const Elf_Rel &Rel : this->DynRelRegion.getAsArrayRef<Elf_Rel>())

3 years ago[llvm-readobj] - Add 'override' to fix build bots.
Georgii Rymar [Tue, 12 Jan 2021 10:01:15 +0000 (13:01 +0300)]
[llvm-readobj] - Add 'override' to fix build bots.

This should fix bots after landing D93900.

An example of error is:

/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:883:8: warning: 'printSectionMapping' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  void printSectionMapping() {}

3 years ago[llvm-readef/obj] - Change the design structure of ELF dumper. NFCI.
Georgii Rymar [Tue, 29 Dec 2020 13:03:37 +0000 (16:03 +0300)]
[llvm-readef/obj] - Change the design structure of ELF dumper. NFCI.

This is a refactoring for design of stuff in `ELFDumper.cpp`.
The current design of ELF dumper is far from ideal.

Currently most overridden functions (inherited from `ObjDumper`) in `ELFDumper` just forward to
the functions of `ELFDumperStyle` (which can be either `GNUStyle` or `LLVMStyle`).
A concrete implementation may be in any of `ELFDumper`/`DumperStyle`/`GNUStyle`/`LLVMStyle`.

This patch reorganizes the classes by introducing `GNUStyleELFDumper`/`LLVMStyleELFDumper`
which inherit from `ELFDumper`. The implementations are moved:

`DumperStyle` -> `ELFDumper`
`GNUStyle` -> `GNUStyleELFDumper`
`LLVMStyle` -> `LLVMStyleELFDumper`

With that we can avoid having a lot of redirection calls and helper methods.
The number of code lines changes from 7142 to 6922 (reduced by ~3%) and the
code overall looks cleaner.

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

3 years ago[WebAssembly] Remove more unnecessary brs in CFGStackify
Heejin Ahn [Tue, 29 Dec 2020 03:48:44 +0000 (19:48 -0800)]
[WebAssembly] Remove more unnecessary brs in CFGStackify

After placing markers, we removed some unnecessary branches, but it only
handled the simplest case. This makes more unnecessary branches to be
removed.

Reviewed By: dschuff, tlively

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

3 years ago[Test] Add failing test for PR48725
Max Kazantsev [Tue, 12 Jan 2021 09:04:12 +0000 (16:04 +0700)]
[Test] Add failing test for PR48725

3 years ago[mlir] use built-in vector types instead of LLVM dialect types when possible
Alex Zinenko [Mon, 11 Jan 2021 12:58:05 +0000 (13:58 +0100)]
[mlir] use built-in vector types instead of LLVM dialect types when possible

Continue the convergence between LLVM dialect and built-in types by using the
built-in vector type whenever possible, that is for fixed vectors of built-in
integers and built-in floats. LLVM dialect vector type is still in use for
pointers, less frequent floating point types that do not have a built-in
equivalent, and scalable vectors. However, the top-level `LLVMVectorType` class
has been removed in favor of free functions capable of inspecting both built-in
and LLVM dialect vector types: `LLVM::getVectorElementType`,
`LLVM::getNumVectorElements` and `LLVM::getFixedVectorType`. Additional work is
necessary to design an implemented the extensions to built-in types so as to
remove the `LLVMFixedVectorType` entirely.

Note that the default output format for the built-in vectors does not have
whitespace around the `x` separator, e.g., `vector<4xf32>` as opposed to the
LLVM dialect vector type format that does, e.g., `!llvm.vec<4 x fp128>`. This
required changing the FileCheck patterns in several tests.

Reviewed By: mehdi_amini, silvas

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

3 years ago[clang][cli] Remove -f[no-]trapping-math from -cc1 command line
Jan Svoboda [Tue, 12 Jan 2021 08:09:06 +0000 (09:09 +0100)]
[clang][cli] Remove -f[no-]trapping-math from -cc1 command line

This patch removes the -f[no-]trapping-math flags from the -cc1 command line. These flags are ignored in the command line parser and their semantics is fully handled by -ffp-exception-mode.

This patch does not remove -f[no-]trapping-math from the driver command line. The driver flags are being used and do affect compilation.

Reviewed By: dexonsmith, SjoerdMeijer

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

3 years ago[AMDGPU] Fix failing assert with scratch ST mode
Sebastian Neubauer [Mon, 11 Jan 2021 13:20:36 +0000 (14:20 +0100)]
[AMDGPU] Fix failing assert with scratch ST mode

In ST mode, flat scratch instructions have neither an sgpr nor a vgpr
for the address. This lead to an assertion when inserting hard clauses.

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

3 years ago[LiveDebugValues] Fix comparison operator in VarLocBasedImpl
Sander de Smalen [Tue, 12 Jan 2021 08:32:21 +0000 (08:32 +0000)]
[LiveDebugValues] Fix comparison operator in VarLocBasedImpl

The issue was introduced in commit rG84a1120943a651184bae507fed5d648fee381ae4
and would cause a VarLoc's StackOffset to be compared with its own, instead of
the StackOffset from the other VarLoc. This patch fixes that.

3 years agoAdapt CastExpr::getSubExprAsWritten to ConstantExpr
Stephan Bergmann [Wed, 2 Sep 2020 14:04:56 +0000 (16:04 +0200)]
Adapt CastExpr::getSubExprAsWritten to ConstantExpr

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

3 years ago[WebAssembly] Misc. refactoring in CFGStackify (NFC)
Heejin Ahn [Mon, 28 Dec 2020 13:23:48 +0000 (05:23 -0800)]
[WebAssembly] Misc. refactoring in CFGStackify (NFC)

Updating `ScopeTops` is something we frequently do in CFGStackify, so
this factors it out as a function. This also makes a few utility
functions templated so that they are not dependent on input vector
types and simplifies function parameters.

Reviewed By: tlively

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

3 years ago[ELF] Drop .rel[a].debug_gnu_pub{names,types} for --gdb-index --emit-relocs
Fangrui Song [Tue, 12 Jan 2021 08:07:28 +0000 (00:07 -0800)]
[ELF] Drop .rel[a].debug_gnu_pub{names,types} for --gdb-index --emit-relocs

Fixes PR48693: --emit-relocs keeps relocation sections. --gdb-index drops
.debug_gnu_pubnames and .debug_gnu_pubtypes but not their relocation sections.
This can cause a null pointer dereference in `getOutputSectionName`.

Also delete debug-gnu-pubnames.s which is covered by gdb-index.s

Reviewed By: grimar

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

3 years ago[DAGCombiner] Replace static helper function isConstantFPBuildVectorOrConstantFP...
Craig Topper [Tue, 12 Jan 2021 07:38:49 +0000 (23:38 -0800)]
[DAGCombiner] Replace static helper function isConstantFPBuildVectorOrConstantFP with the identical version in SelectionDAG. NFC

3 years ago[CMake] Split the target side of runtimes build
Petr Hosek [Wed, 16 Dec 2020 18:26:42 +0000 (10:26 -0800)]
[CMake] Split the target side of runtimes build

Previously, llvm/runtimes/CMakeLists.txt played two different roles:
1. host side which could used  to set up the build of runtimes for
   different targets in the right order;
2. target side to build the runtimes for the specified target.

This change splits llvm/runtimes/CMakeLists.txt and moves the target
side to runtimes/CMakeLists laying down the foundation for the "A vision
for building the runtimes" proposal. From the user perspective, there
shouldn't be any visible difference at the moment.

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

3 years ago[SelectionDAG] Make isConstantIntBuildVectorOrConstantInt and isConstantFPBuildVector...
Craig Topper [Tue, 12 Jan 2021 07:18:57 +0000 (23:18 -0800)]
[SelectionDAG] Make isConstantIntBuildVectorOrConstantInt and isConstantFPBuildVectorOrConstantFP methods const.

3 years agoAdd unconditional logging to debugserver for launch/attach processes
Jason Molenda [Tue, 12 Jan 2021 06:17:10 +0000 (22:17 -0800)]
Add unconditional logging to debugserver for launch/attach processes

Debugging app launch/attach failures can be difficult because of
all of the messages logged to the console on a darwin system;
emitting specific messages around critical API calls can make it
easier to narrow the search for the console messages related to
the failure.

<rdar://problem/67220442>

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

3 years ago[CodeGen] Try to make the print of memory operand alignment a little more user friendly.
Craig Topper [Tue, 12 Jan 2021 03:58:35 +0000 (19:58 -0800)]
[CodeGen] Try to make the print of memory operand alignment a little more user friendly.

Memory operands store a base alignment that does not factor in
the effect of the offset on the alignment.

Previously the printing code only printed the base alignment if
it was different than the size. If there is an offset, the reader
would need to figure out the effective alignment themselves. This
has confused me before and someone else was recently confused on
IRC.

This patch prints the possibly offset adjusted alignment if it is
different than the size. And prints the base alignment if it is
different than the alignment. The MIR parser has been updated to
read basealign in addition to align.

Reviewed By: arsenm

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

3 years ago[llvm] Simplify string comparisons (NFC)
Kazu Hirata [Tue, 12 Jan 2021 02:48:09 +0000 (18:48 -0800)]
[llvm] Simplify string comparisons (NFC)

Identified with readability-string-compare.

3 years ago[llvm] Use *Set::contains (NFC)
Kazu Hirata [Tue, 12 Jan 2021 02:48:07 +0000 (18:48 -0800)]
[llvm] Use *Set::contains (NFC)

3 years ago[llvm] Use llvm::find_if (NFC)
Kazu Hirata [Tue, 12 Jan 2021 02:48:05 +0000 (18:48 -0800)]
[llvm] Use llvm::find_if (NFC)

3 years ago[OpenMP] Move memory manager to plugin and make it a common interface
Shilei Tian [Tue, 12 Jan 2021 02:33:25 +0000 (21:33 -0500)]
[OpenMP] Move memory manager to plugin and make it a common interface

The lifetime of `libomptarget` and its opened plugins are not aligned
and it's hard for `libomptarget` to determine when the plugins are destroyed.
As a result, some issues (see D94256 for details) occur on some platforms.
Actually, if we take target memory as target resources, same as other resources,
such as CUDA streams, in each plugin, then the memory manager should also be in
the plugin. Also considering some platforms may want to opt out the feature, it
makes sense to move the memory manager to plugin, make it a common interface, and
let plguin developers determine whether they need it. This is what this patch does.
CUDA plugin is taken as example to show how to integrate it. In this way, we can
also get a bonus that different thresholds can be set for different platforms.

Reviewed By: jdoerfert, JonChesterfield

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

3 years ago[NFC][LICM] Minor improvements to debug output
Quentin Colombet [Tue, 12 Jan 2021 00:31:40 +0000 (16:31 -0800)]
[NFC][LICM] Minor improvements to debug output

Added a utility function in Value class to print block name and use
block labels for unnamed blocks.
Changed LICM to call this function in its debug output.

Patch by Xiaoqing Wu <xiaoqing_wu@apple.com>

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

3 years ago[WebAssembly] Ensure terminate pads are a single BB
Heejin Ahn [Sun, 27 Dec 2020 11:02:22 +0000 (03:02 -0800)]
[WebAssembly] Ensure terminate pads are a single BB

This ensures every single terminate pad is a single BB in the form of:
```
%exn = catch $__cpp_exception
call @__clang_call_terminate(%exn)
unreachable
```

This is a preparation for HandleEHTerminatePads pass, which will be
added in a later CL and will run after CFGStackify. That pass duplicates
terminate pads with a `catch_all` instruction, and duplicating it
becomes simpler if we can ensure every terminate pad is a single BB.

Reviewed By: dschuff, tlively

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

3 years ago[VE][compiler-rt] Add VE as a target of crt
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 23:41:46 +0000 (08:41 +0900)]
[VE][compiler-rt] Add VE as a target of crt

SX Aurora VE is an experimental target.  We upstreamed many part of
ported llvm and clang.  In order to continue this move, we need to
support libraries next, then we need to show the ability of llvm for
VE through test cases.  As a first step for that, we need to use
crt in compiler-rt.  VE has it's own crt but they are a part of
proprietary compiler.  So, we want to use crt in compiler-rt as an
alternative.

This patch enables VE as a candidate of crt in compiler-rt.

Reviewed By: phosek, compnerd

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

3 years ago[JITLink] Add a new PostAllocationPasses list.
Lang Hames [Mon, 11 Jan 2021 09:00:45 +0000 (20:00 +1100)]
[JITLink] Add a new PostAllocationPasses list.

Passes in the new PostAllocationPasses list will run immediately after memory
allocation and address assignment for defined symbols, and before
JITLinkContext::notifyResolved is called. These passes can set up state
associated with the addresses of defined symbols before any query for these
addresses completes.

3 years ago[MC] Make getEHFrameSection const like every other getter (NFC)
Jonas Devlieghere [Tue, 12 Jan 2021 00:56:02 +0000 (16:56 -0800)]
[MC] Make getEHFrameSection const like every other getter (NFC)

3 years ago[MLIR][Linalg] Refactor transforms to use linalg::getDynOperands helper
Rob Suderman [Fri, 8 Jan 2021 22:03:12 +0000 (14:03 -0800)]
[MLIR][Linalg] Refactor transforms to use linalg::getDynOperands helper

getDynOperands behavior is commonly used in a number of passes. Refactored to
use a helper function and avoid code reuse.

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

3 years ago[github] Move repo lockdown config into llvm-project repo
Tom Stellard [Tue, 12 Jan 2021 00:20:08 +0000 (16:20 -0800)]
[github] Move repo lockdown config into llvm-project repo

We were storing this in the .github repo and moving this into llvm-project
will allow us to delete the .github repo.

3 years ago[clang] Fix message text for `-Wpointer-sign` to account for plain char
Hubert Tong [Mon, 11 Jan 2021 23:36:28 +0000 (18:36 -0500)]
[clang] Fix message text for `-Wpointer-sign` to account for plain char

The `-Wpointer-sign` warning text is inappropriate for describing the
incompatible pointer conversion between plain `char` and explicitly
`signed`/`unsigned` `char` (whichever plain `char` has the same range
as) and vice versa.

Specifically, in part, it reads "converts between pointers to integer
types with different sign". This patch changes that portion to read
instead as "converts between pointers to integer types where one is of
the unique plain 'char' type and the other is not" when one of the types
is plain `char`.

C17 subclause 6.5.16.1 indicates that the conversions resulting in
`-Wpointer-sign` warnings in assignment-like contexts are constraint
violations. This means that strict conformance requires a diagnostic for
the case where the message text is wrong before this patch. The lack of
an even more specialized warning group is consistent with GCC.

Reviewed By: aaron.ballman

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

3 years agoNFC: Pre-commit test: -Wpointer-sign with plain char to [un]signed char
Hubert Tong [Mon, 11 Jan 2021 23:35:54 +0000 (18:35 -0500)]
NFC: Pre-commit test: -Wpointer-sign with plain char to [un]signed char

Add tests with bad message text for `-Wpointer-sign` and run them with
both signed and unsigned versions of plain `char`.

3 years ago[RISCV] Define the vfclass RVV intrinsics
Evandro Menezes [Thu, 31 Dec 2020 03:51:41 +0000 (21:51 -0600)]
[RISCV] Define the vfclass RVV intrinsics

Define the `vfclass` IR intrinsics for the respective V instructions.

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

3 years agoADT: Fix pointer comparison UB in SmallVector
Duncan P. N. Exon Smith [Wed, 23 Dec 2020 21:17:45 +0000 (13:17 -0800)]
ADT: Fix pointer comparison UB in SmallVector

The standard requires comparisons of pointers to unrelated storage to
use `std::less`. Split out some helpers that do that and update all the
code that was comparing using `<` and friends (mostly assertions).

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

3 years ago[SimplifyCFGPass] iterativelySimplifyCFG(): support lazy DomTreeUpdater
Roman Lebedev [Mon, 11 Jan 2021 21:36:18 +0000 (00:36 +0300)]
[SimplifyCFGPass] iterativelySimplifyCFG(): support lazy DomTreeUpdater

This boils down to how we deal with early-increment iterator
over function's basic blocks: not only we need to early-increment,
after that we also need to skip all the blocks
that are scheduled for removal, as per DomTreeUpdater.

3 years ago[SimplifyCFGPass] mergeEmptyReturnBlocks(): skip blocks scheduled for removal as...
Roman Lebedev [Mon, 11 Jan 2021 21:35:15 +0000 (00:35 +0300)]
[SimplifyCFGPass] mergeEmptyReturnBlocks(): skip blocks scheduled for removal as per DomTreeUpdater

Thus supporting lazy DomTreeUpdater mode,
where the domtree updates (and thus block removals)
aren't applied immediately, but are delayed
until last possible moment.

3 years ago[NFCI][Utils/Local] removeUnreachableBlocks(): cleanup support for lazy DomTreeUpdater
Roman Lebedev [Mon, 11 Jan 2021 21:29:55 +0000 (00:29 +0300)]
[NFCI][Utils/Local] removeUnreachableBlocks(): cleanup support for lazy DomTreeUpdater

When DomTreeUpdater is in lazy update mode, the blocks
that were scheduled to be removed, won't be removed
until the updates are flushed, e.g. by asking
DomTreeUpdater for a up-to-date DomTree.

From the function's current code, it is pretty evident
that the support for the lazy mode is an afterthought,
see e.g. how we roll-back NumRemoved statistic..

So instead of considering all the unreachable blocks
as the blocks-to-be-removed, simply additionally skip
all the blocks that are already scheduled to be removed

3 years ago[SimplifyCFG] FoldValueComparisonIntoPredecessors(): don't insert a DomTree edge...
Roman Lebedev [Mon, 11 Jan 2021 21:21:25 +0000 (00:21 +0300)]
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): don't insert a DomTree edge if it already exists

When we are adding edges to the terminator and potentially turning it
into a switch (if it wasn't already), it is possible that the
case we're adding will share it's destination with one of the
preexisting cases, in which case there is no domtree edge to add.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.

3 years ago[SimplifyCFG] SimplifyBranchOnICmpChain(): don't insert a DomTree edge that already...
Roman Lebedev [Mon, 11 Jan 2021 21:18:23 +0000 (00:18 +0300)]
[SimplifyCFG] SimplifyBranchOnICmpChain(): don't insert a DomTree edge that already exists

BB was already always branching to EdgeBB, there is no edge to add.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.

3 years ago[SimplifyCFG] SwitchToLookupTable(): don't insert a DomTree edge that already exists
Roman Lebedev [Mon, 11 Jan 2021 13:01:57 +0000 (16:01 +0300)]
[SimplifyCFG] SwitchToLookupTable(): don't insert a DomTree edge that already exists

SI is the terminator of BB, so the edge we are adding obviously already existed.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.

3 years ago[RISCV] Use vmv.v.i vd, 0 instead of vmv.v.x vd, x0 for llvm.riscv.vfmv.v.f with 0.0
Craig Topper [Mon, 11 Jan 2021 23:03:29 +0000 (15:03 -0800)]
[RISCV] Use vmv.v.i vd, 0 instead of vmv.v.x vd, x0 for llvm.riscv.vfmv.v.f with 0.0

This matches what we use for integer 0. It's also consistent with
the scalar 'mv' pseudo that uses addi rather than add with x0.

3 years agoUpdate syntax for tensor and memref types to match parser.
Richard Uhler [Mon, 11 Jan 2021 22:57:05 +0000 (22:57 +0000)]
Update syntax for tensor and memref types to match parser.

Based on the comments in lib/Parser/TypeParser.cpp on the
parseMemRefType and parseTensorType functions.

Reviewed By: mehdi_amini

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

3 years agoclang: Always pass PowerPC endian information to GNU as
Nathan Chancellor [Mon, 11 Jan 2021 22:39:01 +0000 (14:39 -0800)]
clang: Always pass PowerPC endian information to GNU as

When building a 64-bit big endian PowerPC Linux kernel with a 64-bit
little endian PowerPC target, the 32-bit vDSO errors:

```
$ make ARCH=powerpc CC=clang CROSS_COMPILE=powerpc64le-linux-gnu- \
       pseries_defconfig arch/powerpc/kernel/vdso32/
ld.lld: error: arch/powerpc/kernel/vdso32/sigtramp.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/gettimeofday.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/datapage.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/cacheflush.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/note.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/getcpu.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/vgettimeofday.o is incompatible with elf32-powerpc
...
```

This happens because the endian information is missing from the call to
the assembler, even though it was explicitly passed to clang. See the
below example.

```
$ echo | clang --target=powerpc64le-linux-gnu \
               --prefix=/usr/bin/powerpc64le-linux-gnu- \
               -no-integrated-as -m32 -mbig-endian -### -x c -c -
 ".../clang-12" "-cc1" "-triple" "powerpc-unknown-linux-gnu" ...
...
  "/usr/bin/powerpc64le-linux-gnu-as" "-a32" "-mppc" "-many" "-o" "-.o" "/tmp/--e69e28.s"
```

clang sets the right target with -m32 and -mbig-endian but -mbig-endian
does not make it to the assembler, resulting in a 32-bit little endian
binary. This differs from the little endian targets, which always pass
-mlittle-endian.

```
$ echo | clang --target=powerpc64-linux-gnu \
               --prefix=/usr/bin/powerpc64-linux-gnu- \
               -no-integrated-as -m32 -mlittle-endian -### -x c -c -
 ".../clang-12" "-cc1" "-triple" "powerpcle-unknown-linux-gnu" ...
...
 "/usr/bin/powerpc64-linux-gnu-as" "-a32" "-mppc" "-mlittle-endian" "-many" "-o" "-.o" "/tmp/--405dbd.s"
```

Do the same thing for the big endian targets so that there is no more
error. This matches GCC's behavior, where -mbig and -mlittle are always
passed along to GNU as.

```
$ echo | powerpc64-linux-gcc -### -x c -c -
...
.../powerpc64-linux/bin/as -a64 -mpower4 -many -mbig -o -.o /tmp/ccVn7NAm.s
...

$ echo | powerpc64le-linux-gcc -### -x c -c -
...
.../powerpc64le-linux/bin/as -a64 -mpower8 -many -mlittle -o -.o /tmp/ccPN9ato.s
...
```

Reviewed By: nickdesaulniers, MaskRay

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

3 years ago[RISCV] Add scalable vector vselect ISel patterns
Fraser Cormack [Fri, 8 Jan 2021 11:47:12 +0000 (11:47 +0000)]
[RISCV] Add scalable vector vselect ISel patterns

Reviewed By: craig.topper

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

3 years ago[OpenMP] Take elf_common.c as a interface library
Shilei Tian [Mon, 11 Jan 2021 22:34:17 +0000 (17:34 -0500)]
[OpenMP] Take elf_common.c as a interface library

For now `elf_common.c` is taken as a common part included into
different plugin implementations directly via
`#include "../../common/elf_common.c"`, which is not a best practice. Since it
is simple enough such that we don't need to create a real library for it, we just
take it as a interface library so that other targets can link it directly. Another
advantage of this method is, we don't need to add the folder into header search
path which can potentially pollute the search path.

VE and AMD platforms have not been tested because I don't have target machines.

Reviewed By: JonChesterfield

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

3 years agoRename debug linkage name with -funique-internal-linkage-names
Hongtao Yu [Sat, 9 Jan 2021 06:57:03 +0000 (22:57 -0800)]
Rename debug linkage name with -funique-internal-linkage-names

Functions that are renamed under -funique-internal-linkage-names have their debug linkage name updated as well.

Reviewed By: dblaikie

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

3 years agoCGDebugInfo: Delete unused parameters
Fangrui Song [Mon, 11 Jan 2021 21:39:03 +0000 (13:39 -0800)]
CGDebugInfo: Delete unused parameters

3 years ago[SCCP] Fix misclassified conditions in test (NFC)
Nikita Popov [Mon, 11 Jan 2021 21:32:59 +0000 (22:32 +0100)]
[SCCP] Fix misclassified conditions in test (NFC)

3 years ago[PredicateInfo] Add test for one unknown condition in and/or (NFC)
Nikita Popov [Mon, 11 Jan 2021 19:42:47 +0000 (20:42 +0100)]
[PredicateInfo] Add test for one unknown condition in and/or (NFC)

Test the case where one part of and/or is an icmp, while the other
one is an arbitrary value.

3 years ago[mlir][vector] verify memref of vector memory ops
Aart Bik [Mon, 11 Jan 2021 19:34:10 +0000 (11:34 -0800)]
[mlir][vector] verify memref of vector memory ops

This ensures the memref base + indices expression is well-formed

Reviewed By: ThomasRaoux, ftynse

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

3 years ago[RISCV] Add scalable vector fadd/fsub/fmul/fdiv ISel patterns
Fraser Cormack [Mon, 11 Jan 2021 14:02:35 +0000 (14:02 +0000)]
[RISCV] Add scalable vector fadd/fsub/fmul/fdiv ISel patterns

Original patch by @rogfer01.

This patch adds ISel patterns for the above operations to the
corresponding vector/vector and vector/scalar RVV instructions, as well
as extra patterns to match operand-swapped scalar/vector vfrsub and
vfrdiv.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper

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

3 years agoAdd an assert to CGDebugInfo::getTypeOrNull
Fangrui Song [Mon, 11 Jan 2021 21:25:20 +0000 (13:25 -0800)]
Add an assert to CGDebugInfo::getTypeOrNull

3 years ago[c++20] Don't consider string literal operator templates for numeric
Richard Smith [Mon, 11 Jan 2021 21:12:43 +0000 (13:12 -0800)]
[c++20] Don't consider string literal operator templates for numeric
literals.

A literal interpretation of the standard wording allows this, but it was
never intended that string literal operator templates would be used for
anything other than user-defined string literals.

3 years ago[libc][NFC] Make __support/common.h an in tree header.
Siva Chandra Reddy [Mon, 11 Jan 2021 20:35:34 +0000 (12:35 -0800)]
[libc][NFC] Make __support/common.h an in tree header.

It was previously a generated header. It can easily converted to a
generated header if required in future.

Reviewed By: michaelrj

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

3 years ago[GlobalISel] Map extractelt to G_EXTRACT_VECTOR_ELT
Bjorn Pettersson [Mon, 11 Jan 2021 15:19:01 +0000 (16:19 +0100)]
[GlobalISel] Map extractelt to G_EXTRACT_VECTOR_ELT

Before this patch there was generic mapping from vector_extract
to G_EXTRACT_VECTOR_ELT added in SelectionDAGCompat.td. That
mapping is now replaced by a mapping from extractelt instead.

The reasoning is that vector_extract is marked as deprecated,
so it is assumed that a majority of targets will use extractelt
and not vector_extract (and that the long term solution for all
targets would be to use extractelt).

Targets like AArch64 that still use vector_extract can add an
additional mapping from the deprecated vector_extract as target
specific tablegen definitions. Such a mapping is added for AArch64
in this patch to avoid breaking tests.

When adding the extractelt => G_EXTRACT_VECTOR_ELT mapping we
triggered some new code paths in GlobalISelEmitter, ending up in
an assert when trying to import a pattern containing EXTRACT_SUBREG
for ARM. Therefore this patch also adds a "failedImport" warning
for that situation (instead of hitting the assert).

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

3 years ago[InstCombine] reduce icmp(ashr X, C1), C2 to sign-bit test
Sanjay Patel [Mon, 11 Jan 2021 20:36:22 +0000 (15:36 -0500)]
[InstCombine] reduce icmp(ashr X, C1), C2 to sign-bit test

This is a more basic pattern that we should handle before trying to solve:
https://llvm.org/PR48640

There might be a better way to think about this because the pre-condition
that I came up with (number of sign bits in the compare constant) misses a
potential transform for each of ugt and ult as commented on in the test file.

Tried to model this is in Alive:
https://rise4fun.com/Alive/juX1
...but I couldn't get the ComputeNumSignBits() pre-condition to work as
expected, so replaced with leading 0/1 preconditions instead.

  Name: ugt
  Pre: countLeadingZeros(C2) <= C1 && countLeadingOnes(C2) <= C1
  %a = ashr %x, C1
  %r = icmp ugt i8 %a, C2
    =>
  %r = icmp slt i8 %x, 0

  Name: ult
  Pre: countLeadingZeros(C2) <= C1 && countLeadingOnes(C2) <= C1
  %a = ashr %x, C1
  %r = icmp ult i4 %a, C2
    =>
  %r = icmp sgt i4 %x, -1

Also approximated in Alive2:
https://alive2.llvm.org/ce/z/u5hCcz
https://alive2.llvm.org/ce/z/__szVL

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

3 years agoRevert "[mlir][linalg] Support parsing attributes in named op spec"
Mehdi Amini [Mon, 11 Jan 2021 20:42:10 +0000 (20:42 +0000)]
Revert "[mlir][linalg] Support parsing attributes in named op spec"

This reverts commit df86f15f0c53c395dac5a14aba08745bc12b9b9b.

The gcc-5 build was broken by this change:

  mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp:1275:77:   required from here
  /usr/include/c++/5/ext/new_allocator.h:120:4: error: no matching function for call to 'std::pair<const std::__cxx11::basic_string<char>, {anonymous}::TCParser::RegisteredAttr>::pair(llvm::StringRef&, {anonymous}::TCParser::RegisteredAttr'

3 years ago[mlir][CAPI] Introduce standard source layout for mlir-c dialect registration.
Stella Laurenzo [Sun, 10 Jan 2021 03:01:39 +0000 (19:01 -0800)]
[mlir][CAPI] Introduce standard source layout for mlir-c dialect registration.

* Registers a small set of sample dialects.
* NFC with respect to existing C-API symbols but some headers have been moved down a level to the Dialect/ sub-directory.
* Adds an additional entry point per dialect that is needed for dynamic discovery/loading.
* See discussion: https://llvm.discourse.group/t/dialects-and-the-c-api/2306/16

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

3 years agoEnable python bindings for tensor, shape and linalg dialects.
Stella Laurenzo [Sun, 10 Jan 2021 01:14:47 +0000 (17:14 -0800)]
Enable python bindings for tensor, shape and linalg dialects.

* We've got significant missing features in order to use most of these effectively (i.e. custom builders, region-based builders).
* We presently also lack a mechanism for actually registering these dialects but they can be use with contexts that allow unregistered dialects for further prototyping.

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

3 years ago[mlir][vector] Add side-effect information to different load/store ops
Thomas Raoux [Mon, 11 Jan 2021 18:35:30 +0000 (10:35 -0800)]
[mlir][vector] Add side-effect information to different load/store ops

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

3 years ago[NFC] Disallow unused prefixes under llvm/test/CodeGen
Mircea Trofin [Mon, 11 Jan 2021 17:34:45 +0000 (09:34 -0800)]
[NFC] Disallow unused prefixes under llvm/test/CodeGen

This patch finishes addressing unused prefixes under CodeGen: 2
remaining tests fixed, and then undo-ing the lit.local.cfg changes under
various subdirs and moving the policy under CodeGen.

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

3 years ago[tools] Mark output of tools as text if it is really text
Abhina Sreeskantharajan [Mon, 11 Jan 2021 20:13:40 +0000 (15:13 -0500)]
[tools] Mark output of tools as text if it is really text

This is a continuation of https://reviews.llvm.org/D67696. The following tools also need to set the OF_Text flag correctly.

  -   llvm-profdata
  -   llvm-link

Reviewed By: rnk

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

3 years ago[ADT] Add makeIntrusiveRefCnt helper function
Nathan James [Mon, 11 Jan 2021 20:12:53 +0000 (20:12 +0000)]
[ADT] Add makeIntrusiveRefCnt helper function

Works like std::make_unique but for IntrusiveRefCntPtr objects.
See https://lists.llvm.org/pipermail/llvm-dev/2021-January/147729.html

Reviewed By: dblaikie, MaskRay

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

3 years ago[mlir][IR][NFC] Move the definitions of Complex/Function/Integer/Opaque/TupleType...
River Riddle [Mon, 11 Jan 2021 19:55:09 +0000 (11:55 -0800)]
[mlir][IR][NFC] Move the definitions of Complex/Function/Integer/Opaque/TupleType to ODS

The type tablegen backend now has enough support to represent these types well enough, so we can now move them to be declaratively defined.

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

3 years ago[mlir][TypeDefGen] Add support for adding builders when generating a TypeDef
River Riddle [Mon, 11 Jan 2021 19:55:00 +0000 (11:55 -0800)]
[mlir][TypeDefGen] Add support for adding builders when generating a TypeDef

This allows for specifying additional get/getChecked methods that should be generated on the type, and acts similarly to how OpBuilders work. TypeBuilders have two additional components though:
* InferredContextParam
  - Bit indicating that the context parameter of a get method is inferred from one of the builder parameters
* checkedBody
  - A code block representing the body of the equivalent getChecked method.

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

3 years ago[mlir][ODS] Add a C++ abstraction for OpBuilders
River Riddle [Mon, 11 Jan 2021 19:54:51 +0000 (11:54 -0800)]
[mlir][ODS] Add a C++ abstraction for OpBuilders

This removes the need for OpDefinitionsGen to use raw tablegen API, and will also
simplify adding builders to TypeDefs as well.

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

3 years ago[NFC][AMDGPU] Clarify memory model support for volatile
Tony Tye [Sat, 9 Jan 2021 10:20:42 +0000 (10:20 +0000)]
[NFC][AMDGPU] Clarify memory model support for volatile

Reorder the AMDGPUUage description of the memory model code sequences
for volatile so clear that it applies independent of the nontemporal
setting.

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

3 years ago[libc++] Turn off auto-formatting of generated files. NFC.
Marek Kurdej [Mon, 11 Jan 2021 19:48:15 +0000 (20:48 +0100)]
[libc++] Turn off auto-formatting of generated files. NFC.

This adds `// clang-format off` in the auto-generated file to avoid lint warnings.

Reviewed By: ldionne, #libc

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

3 years ago[RISCV] Add scalable vector fcmp ISel patterns
Fraser Cormack [Wed, 6 Jan 2021 11:25:25 +0000 (11:25 +0000)]
[RISCV] Add scalable vector fcmp ISel patterns

Original patch by @rogfer01.

All ordered comparisons except ONE are supported natively, and all
unordered comparisons except UNE are expanded into sequences involving
explicit NaN checks and mask arithmetic.

Additionally, we expand GT,OGT,GE,OGE to their swapped-operand versions, and
pattern-match those back to the "original", swapping operands once more. This
way we catch both operations and both "vf" and "fv" forms with fewer patterns.

Also add support for floating-point splat_vector, with an optimization for
splatting fpimm0.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper

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

3 years ago[mlir] Add structural conversion to async dialect lowering.
Christian Sigg [Mon, 11 Jan 2021 19:34:44 +0000 (20:34 +0100)]
[mlir] Add structural conversion to async dialect lowering.

Lowering of async dialect uses a fixed type converter and therefore does not support lowering non-standard types.

This revision adds a structural conversion so that non-standard types in `!async.value`s can be lowered to LLVM before lowering the async dialect itself.

Reviewed By: ezhulenev

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

3 years ago[SystemZ][z/OS] Fix Permission denied pattern matching
Abhina Sreeskantharajan [Mon, 11 Jan 2021 19:27:10 +0000 (14:27 -0500)]
[SystemZ][z/OS] Fix Permission denied pattern matching

On z/OS, the error message "EDC5111I Permission denied." is not matched correctly in lit tests. This patch updates the check expression to match successfully.

Reviewed By: fanbo-meng

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

3 years agoFix minor build issue (NFC)
David Stuttard [Mon, 11 Jan 2021 19:20:47 +0000 (11:20 -0800)]
Fix minor build issue (NFC)

Change [x86] Fix tile register spill issue was causing problems for our build
using gcc-5.4.1

The problem was caused by this line:

for (const MachineInstr &MI : make_range(MIS.begin(), MI))

where MI was previously defined as a MachineBasicBlock iterator.

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

3 years agoIntroduce new quiet mode and new option handling for -print-changed.
Jamie Schmeiser [Mon, 11 Jan 2021 19:11:00 +0000 (14:11 -0500)]
Introduce new quiet mode and new option handling for -print-changed.
Summary:
Introduce a new mode of operation for -print-changed that only reports
after a pass changes the IR with all of the other messages suppressed (ie,
no initial IR and no messages about ignored, filtered or non-modifying
passes).

The option processing for -print-changed is changed to take an optional
string indicating options for print-changed. Initially, the only option
supported is quiet (as described above). This new quiet mode is specified
with -print-changed=quiet while -print-changed will continue to function
in the same way. It is intended that there will be more options in the
future.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D92589

3 years ago-funique-internal-linkage-names appends a hex md5hash suffix to the symbol name which...
Sriraman Tallam [Mon, 11 Jan 2021 19:08:36 +0000 (11:08 -0800)]
-funique-internal-linkage-names appends a hex md5hash suffix to the symbol name which is not demangler friendly, convert it to decimal.

Please see D93747 for more context which tries to make linkage names of internal
linkage functions to be the uniqueified names. This causes a problem with gdb
because breaking using the demangled function name will not work if the new
uniqueified name cannot be demangled. The problem is the generated suffix which
is a mix of integers and letters which do not demangle. The demangler accepts
either all numbers or all letters. This patch simply converts the hash to decimal.

There is no loss of uniqueness by doing this as the precision is maintained.
The symbol names get longer by a few characters though.

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

3 years ago[flang][openxx][NFC] Remove duplicated function to check required clauses
Valentin Clement [Mon, 11 Jan 2021 19:08:35 +0000 (14:08 -0500)]
[flang][openxx][NFC] Remove duplicated function to check required clauses

Remove duplicated function to check for required clauses on a directive. This was
still there from the merging of OpenACC and OpenMP common semantic checks and it can now be
removed so we use only one function.

Reviewed By: sameeranjoshi

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

3 years ago[mlir] Expose MemRef layout in Python bindings
Alex Zinenko [Fri, 8 Jan 2021 14:08:44 +0000 (15:08 +0100)]
[mlir] Expose MemRef layout in Python bindings

This wasn't possible before because there was no support for affine expressions
as maps. Now that this support is available, provide the mechanism for
constructing maps with a layout and inspecting it.

Rework the `get` method on MemRefType in Python to avoid needing an explicit
memory space or layout map. Remove the `get_num_maps`, it is too low-level,
using the length of the now-avaiable pseudo-list of layout maps is more
pythonic.

Depends On D94297

Reviewed By: mehdi_amini

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

3 years ago[mlir] More Python bindings for AffineMap
Alex Zinenko [Fri, 8 Jan 2021 12:36:27 +0000 (13:36 +0100)]
[mlir] More Python bindings for AffineMap

Now that the bindings for AffineExpr have been added, add more bindings for
constructing and inspecting AffineMap that consists of AffineExprs.

Depends On D94225

Reviewed By: mehdi_amini

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

3 years ago[mlir] Add Python bindings for AffineExpr
Alex Zinenko [Thu, 7 Jan 2021 10:09:09 +0000 (11:09 +0100)]
[mlir] Add Python bindings for AffineExpr

This adds the Python bindings for AffineExpr and a couple of utility functions
to the C API. AffineExpr is a top-level context-owned object and is modeled
similarly to attributes and types. It is required, e.g., to build layout maps
of the built-in memref type.

Reviewed By: mehdi_amini

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

3 years ago[AMDGPU] Deduplicate VOP tablegen asm & ins
Joe Nash [Tue, 5 Jan 2021 00:47:55 +0000 (19:47 -0500)]
[AMDGPU] Deduplicate VOP tablegen asm & ins

VOP3 and VOP DPP subroutines to generate input
operands and asm strings were essentially copy
pasted several times. They are deduplicated to
reduce the maintenance burden and allow faster
development.

Reviewed By: dp

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

Change-Id: I76225eed3c33239d9573351e0c8a0abfad0146ea

3 years ago[Hexagon] Custom-widen SETCC's operands
Krzysztof Parzyszek [Thu, 7 Jan 2021 15:30:56 +0000 (09:30 -0600)]
[Hexagon] Custom-widen SETCC's operands

The result cannot be widened, unfortunately, because widening vNi1
would depend on the context in which it appears (i.e. the type alone
is not sufficient to tell if it needs to be widened).

3 years ago[attributes] Add a facility for enforcing a Trusted Computing Base.
Sean Dooher [Mon, 11 Jan 2021 14:57:08 +0000 (06:57 -0800)]
[attributes]  Add a facility for enforcing a Trusted Computing Base.

Introduce a function attribute 'enforce_tcb' that prevents the function
from calling other functions without the same attribute. This allows
isolating code that's considered to be somehow privileged so that it could not
use its privileges to exhibit arbitrary behavior.

Introduce an on-by-default warning '-Wtcb-enforcement' that warns
about violations of the above rule.

Introduce a function attribute 'enforce_tcb_leaf' that suppresses
the new warning within the function it is attached to. Such leaf functions
may implement common functionality between the trusted and the untrusted code
but they require extra careful audit with respect to their capabilities.

Fixes after a revert in 419ef38a50293c58078f830517f5e305068dbee6:
Fix a test.
Add workaround for GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67274).
Attribute the patch appropriately!

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