platform/upstream/llvm.git
3 years ago[InstCombine] Add tests for PR48577 (NFC)
Nikita Popov [Wed, 23 Dec 2020 19:56:16 +0000 (20:56 +0100)]
[InstCombine] Add tests for PR48577 (NFC)

3 years ago[mlir][spirv] De-template serialization
Lei Zhang [Wed, 23 Dec 2020 19:48:17 +0000 (14:48 -0500)]
[mlir][spirv] De-template serialization

Previously for each op we generate a separate serialization
method for it. Those serialization methods duplicate the logic
of parsing operands/results/attributes and such.

This commit creates a generic method and let suitable op-specific
serialization method to call into it.

wc -l SPIRVSerialization.inc: before 8304; after: 5597 (So -2707)

Reviewed By: hanchung, ThomasRaoux

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

3 years ago[mlir][spirv] De-template deserialization
Lei Zhang [Wed, 23 Dec 2020 19:37:52 +0000 (14:37 -0500)]
[mlir][spirv] De-template deserialization

Previously for each op we generate a separate deserialization
method for it. Those deserialization methods duplicate the logic
of parsing operands/results/attributes and such.

This commit creates a generic method and let suitable op-specific
deserialization method to call into it.

wc -l SPIRVSerialization.inc: before 13290; after: 8304 (So -4986)

Reviewed By: hanchung, ThomasRaoux

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

3 years ago[IROutliner] Use isa instead of dyn_cast where the casted value isn't used. NFC
Craig Topper [Wed, 23 Dec 2020 19:39:50 +0000 (11:39 -0800)]
[IROutliner] Use isa instead of dyn_cast where the casted value isn't used. NFC

Fixes unused variable warnings.

3 years ago[mlir][spirv] NFC: rename SPIR-V conversion files for consistency
Lei Zhang [Wed, 23 Dec 2020 19:32:31 +0000 (14:32 -0500)]
[mlir][spirv] NFC: rename SPIR-V conversion files for consistency

This commit renames various SPIR-V related conversion files for
consistency. It drops the "Convert" prefix to various files and
fixes various comment headers.

Reviewed By: hanchung, ThomasRaoux

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

3 years agoAppend ".__part." to every basic block section symbol.
Sriraman Tallam [Wed, 23 Dec 2020 17:51:35 +0000 (09:51 -0800)]
Append ".__part." to every basic block section symbol.

Every basic block section symbol created by -fbasic-block-sections will contain
".__part." to know that this symbol corresponds to a basic block fragment of
the function.

This patch solves two problems:

a) Like D89617, we want function symbols with suffixes to be properly qualified
   so that external tools like profile aggregators know exactly what this
   symbol corresponds to.
b) The current basic block naming just adds a ".N" to the symbol name where N is
   some integer. This collides with how clang creates __cxx_global_var_init.N.
   clang creates these symbol names to call constructor functions and basic
   block symbol naming should not use the same style.

Fixed all the test cases and added an extra test for __cxx_global_var_init
breakage.

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

3 years ago[mlir][spirv] Create a pass for testing SCFToSPIRV patterns
Lei Zhang [Wed, 23 Dec 2020 18:37:27 +0000 (13:37 -0500)]
[mlir][spirv] Create a pass for testing SCFToSPIRV patterns

Previously all SCF to SPIR-V conversion patterns were tested as
the -convert-gpu-to-spirv pass. That obscured the structure we
want. This commit fixed it.

Reviewed By: ThomasRaoux, hanchung

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

3 years ago[LoopIdiom] 'left-shift until bittest' idiom: support rewriting loop as countable...
Roman Lebedev [Wed, 23 Dec 2020 19:26:40 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support rewriting loop as countable, allow extra cruft

The current state of the transform is still not enough to support
my motivational pattern, because it has one more "induction variable".

I have delayed posting this patch, because originally even just rewriting
the loop as countable wasn't enough to nicely transform my motivational pattern,
because i expected that extra IV to be rewritten afterwards,
but it wasn't happening until i fixed that in D91800.

So, this patch allows the  'left-shift until bittest' loop idiom
as long as the inserted ops are cheap,
and lifts any and all extra use checks on the instructions.

Reviewed By: craig.topper

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

3 years ago[LoopIdiom] 'left-shift until bittest' idiom: support canonical sign bit mask
Roman Lebedev [Wed, 23 Dec 2020 19:26:39 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support canonical sign bit mask

If the bitmask is for sign bit, instcombine would have canonicalized
the pattern into a proper sign bit check. Supporting that is still
simple, but requires a bit of a roundtrip - we first have to use
`decomposeBitTestICmp()`, and the rest again just works.

Reviewed By: craig.topper

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

3 years ago[LoopIdiom] 'left-shift until bittest' idiom: support constant bit mask
Roman Lebedev [Wed, 23 Dec 2020 19:26:34 +0000 (22:26 +0300)]
[LoopIdiom] 'left-shift until bittest' idiom: support constant bit mask

The handing of the case where the mask is a constant is trivial,
if said constant is a power of two, the bit in question is log2(mask),
rest just works.

Reviewed By: craig.topper

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

3 years ago[LoopIdiom] Introduce 'left-shift until bittest' idiom
Roman Lebedev [Wed, 23 Dec 2020 19:26:28 +0000 (22:26 +0300)]
[LoopIdiom] Introduce 'left-shift until bittest' idiom

The motivation here is the following inner loop in fp16/fp24 -> fp32 expander,
that runs as part of the floating-point DNG decompression in RawSpeed library:
https://github.com/darktable-org/rawspeed/blob/cd380bb9a209bd2e7a0e7022b0cab04528d151e7/src/librawspeed/decompressors/DeflateDecompressor.cpp#L112-L115
```
      while (!(fp32_fraction & (1 << 23))) {
        fp32_exponent -= 1;
        fp32_fraction <<= 1;
      }
```
(https://godbolt.org/z/r13YMh)
As one might notice, that loop is currently uncountable, and that whole code stays scalar.
Yet, it is rather trivial to make that loop countable:
 https://godbolt.org/z/do8WMz
and we can prove that via alive2:
 https://alive2.llvm.org/ce/z/7vQnji (ha nice, isn't it?)
... and that allow for the whole fp16->fp32 code to vectorize:
 https://godbolt.org/z/7hYr13

Now, while i'd love to get there, i feel like i should take it in steps.

For now, this introduces support for the most basic case,
where the bit position is known as a variable,
and the loop *will* go away (has no live-outs other than the recurrence,
no extra instructions in the loop).

I have added sufficient (i believe) test coverage,
and alive2 is happy with those transforms.

Reviewed By: craig.topper

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

3 years agoclang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too
Nico Weber [Wed, 23 Dec 2020 19:25:34 +0000 (14:25 -0500)]
clang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too

They seem to pass fine with the analyzer off, and with this I would've
noticed my last check-clang break locally.

3 years ago[mlir][vector] Add more vector Ops canonicalization
Thomas Raoux [Fri, 11 Dec 2020 15:08:55 +0000 (07:08 -0800)]
[mlir][vector] Add more vector Ops canonicalization

Add canonicalization for BroadcastOp, ExtractStrideSlicesOp and ShapeCastOp

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

3 years agoRevert more changes that landed on top of 741978d727
Nico Weber [Wed, 23 Dec 2020 19:13:23 +0000 (14:13 -0500)]
Revert more changes that landed on top of 741978d727

This should've been in 7ad666798f12456d9 but wasn't.

Squashes these twoc commits:
Revert "[clang][cli] Let denormalizer decide how to render the option based on the option class"
This reverts commit 70410a264949101ced3ce3458f37dd4cc2f5af85.

Revert "[clang][cli] Implement `getAllArgValues` marshalling"
This reverts commit 63a24816f561a5d8e28ca7054892bd8602618be4.

3 years agoRevert "This is a test commit"
Alan Phipps [Wed, 23 Dec 2020 19:01:46 +0000 (13:01 -0600)]
Revert "This is a test commit"

This reverts commit b920adf3b4f16bef8dde937b67874d8e8ac1030e.

3 years ago[IROutliner] Adding support for elevating constants that are not the same in each...
Andrew Litteken [Tue, 15 Sep 2020 23:20:09 +0000 (18:20 -0500)]
[IROutliner] Adding support for elevating constants that are not the same in each region to arguments

When there are constants that have the same structural location, but not
the same value, between different regions, we cannot simply outline the
region. Instead, we find the constants that are not the same in each
location, and promote them to arguments to be passed into the respective
functions. At each call site, we pass the constant in as an argument
regardless of type.

Added/Edited Tests:

llvm/test/Transforms/IROutliner/outlining-constants-vs-registers.ll
llvm/test/Transforms/IROutliner/outlining-different-constants.ll
llvm/test/Transforms/IROutliner/outlining-different-globals.ll

Reviewers: paquette, jroelofs

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

3 years agoUpdated GettingInvolved.md to reflect Flang Biweekly Call changes
AlexisPerry [Wed, 23 Dec 2020 17:57:36 +0000 (10:57 -0700)]
Updated GettingInvolved.md to reflect Flang Biweekly Call changes

   - updated the link to join the meeting to reflect the new WebEx information
   - Added a note about the new Google Doc for keeping track of notes, and who
     to contact if you experience access issues with the document
   - Left a reference to the minutes from previous meetings being available
     through a search of the flang-dev mailing list

Reviewed By: jdoerfert

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

3 years agoThis is a test commit
Alan Phipps [Wed, 23 Dec 2020 18:57:27 +0000 (12:57 -0600)]
This is a test commit

3 years ago[RISCV] Add intrinsics for vfmv.v.f
Craig Topper [Wed, 23 Dec 2020 18:01:43 +0000 (10:01 -0800)]
[RISCV] Add intrinsics for vfmv.v.f

Also include a special case pattern to use vmv.v.x vd, zero when
the argument is 0.0.

Reviewed By: khchen

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

3 years ago[lldb] Refactor and simplify GetCommandSPExact interface
Jonas Devlieghere [Tue, 22 Dec 2020 22:02:18 +0000 (14:02 -0800)]
[lldb] Refactor and simplify GetCommandSPExact interface

GetCommandSPExact is called exaclty once with include_aliases set to
true, so make it a default argument. Use early returns to simplify the
implementation.

3 years ago[lldb] Don't instrument demangling.
Jonas Devlieghere [Tue, 22 Dec 2020 21:17:17 +0000 (13:17 -0800)]
[lldb] Don't instrument demangling.

Don't instrument demangling calls. These functions are very hot and
instrumenting them quickly results in too much data to be useful.

3 years ago[mlir][spirv] Convert functions returning one value
Lei Zhang [Wed, 23 Dec 2020 18:21:57 +0000 (13:21 -0500)]
[mlir][spirv] Convert functions returning one value

Reviewed By: hanchung, ThomasRaoux

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

3 years agoRevert 741978d727 and things that landed on top of it.
Nico Weber [Wed, 23 Dec 2020 17:39:16 +0000 (12:39 -0500)]
Revert 741978d727 and things that landed on top of it.

741978d727 made clang produce output that's 2x as large at least in
sanitizer builds. https://reviews.llvm.org/D83892#2470185 has a
standalone repro.

This reverts the following commits:

Revert "[clang][cli] Port CodeGenOpts simple string flags to new option parsing system"
This reverts commit 95d3cc67caac04668ef808f65c30ced60ed14f5d.

Revert "[clang][cli] Port LangOpts simple string based options to new option parsing system"
This reverts commit aec2991d083a9c5b92f94d84a7b3a7bbed405af8.

Revert "[clang][cli] Streamline MarshallingInfoFlag description"
This reverts commit 27b7d646886d499c70dec3481dfc3c82dfc43dd7.

Revert "[clang][cli] Port LangOpts option flags to new option parsing system"
This reverts commit 383778e2171b4993f555433745466e211e713548.

Revert "[clang][cli] Port CodeGen option flags to new option parsing system"
This reverts commit 741978d727a445fa279d5952a86ea634adb7dc52.

3 years ago[OpenMP] Fixing typo on memory size in Documenation
Joseph Huber [Wed, 23 Dec 2020 16:45:46 +0000 (11:45 -0500)]
[OpenMP] Fixing typo on memory size in Documenation

3 years ago[lld-macho] Simulator & DriverKit executables should always be PIE
Jez Ng [Wed, 23 Dec 2020 16:24:02 +0000 (11:24 -0500)]
[lld-macho] Simulator & DriverKit executables should always be PIE

We didn't have support for parsing DriverKit in our `-platform`
flag, so add that too. Also remove a bunch of unnecessary namespace
prefixes.

Reviewed By: #lld-macho, thakis

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

3 years ago[TableGen] Add the !substr() bang operator
Paul C. Anagnostopoulos [Wed, 16 Dec 2020 14:55:16 +0000 (09:55 -0500)]
[TableGen] Add the !substr() bang operator

Update the documentation and add a test.

Build failed: Change SIZE_MAX to std::numeric_limits<int64_t>::max().

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

3 years ago[BPI] Improve static heuristics for "cold" paths.
Evgeniy Brevnov [Thu, 18 Jun 2020 09:20:55 +0000 (16:20 +0700)]
[BPI] Improve static heuristics for "cold" paths.

Current approach doesn't work well in cases when multiple paths are predicted to be "cold". By "cold" paths I mean those containing "unreachable" instruction, call marked with 'cold' attribute and 'unwind' handler of 'invoke' instruction. The issue is that heuristics are applied one by one until the first match and essentially ignores relative hotness/coldness
 of other paths.

New approach unifies processing of "cold" paths by assigning predefined absolute weight to each block estimated to be "cold". Then we propagate these weights up/down IR similarly to existing approach. And finally set up edge probabilities based on estimated block weights.

One important difference is how we propagate weight up. Existing approach propagates the same weight to all blocks that are post-dominated by a block with some "known" weight. This is useless at least because it always gives 50\50 distribution which is assumed by default anyway. Worse, it causes the algorithm to skip further heuristics and can miss setting more accurate probability. New algorithm propagates the weight up only to the blocks that dominates and post-dominated by a block with some "known" weight. In other words, those blocks that are either always executed or not executed together.

In addition new approach processes loops in an uniform way as well. Essentially loop exit edges are estimated as "cold" paths relative to back edges and should be considered uniformly with other coldness/hotness markers.

Reviewed By: yrouban

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

3 years ago[clangd] Do not take stale definition from the static index.
Aleksandr Platonov [Wed, 23 Dec 2020 14:04:54 +0000 (17:04 +0300)]
[clangd] Do not take stale definition from the static index.

This is follow up to D93393.
Without this patch clangd takes the symbol definition from the static index if this definition was removed from the dynamic index.

Reviewed By: sammccall

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

3 years ago[MLIR][SPIRV] Add rewrite pattern to convert select+cmp into GLSL clamp.
ergawy [Wed, 23 Dec 2020 14:32:31 +0000 (15:32 +0100)]
[MLIR][SPIRV] Add rewrite pattern to convert select+cmp into GLSL clamp.

Adds rewrite patterns to convert select+cmp instructions into clamp
instructions whenever possible. Support is added to convert:

- FOrdLessThan, FOrdLessThanEqual to GLSLFClampOp.
- SLessThan, SLessThanEqual to GLSLSClampOp.
- ULessThan, ULessThanEqual to GLSLUClampOp.

Reviewed By: mravishankar

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

3 years ago[clang-format] PR48539 ReflowComments breaks Qt translation comments
mydeveloperday [Wed, 23 Dec 2020 14:44:31 +0000 (14:44 +0000)]
[clang-format] PR48539 ReflowComments breaks Qt translation comments

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

Add support for Qt Translator Comments to reflow

When reflown and a part of the comments are added on a new line, it should repeat these extra characters as part of the comment token.

Reviewed By: curdeius, HazardyKnusperkeks

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

3 years ago[clang-format] PR48535 clang-format Incorrectly Removes Space After C Style Cast...
mydeveloperday [Wed, 23 Dec 2020 14:41:06 +0000 (14:41 +0000)]
[clang-format] PR48535 clang-format Incorrectly Removes Space After C Style Cast When Type Is Not a Pointer

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

using `SpaceAfterCStyleCast: true`

```
size_t idx = (size_t) a;
size_t idx = (size_t) (a - 1);
```

is formatted as:

```
size_t idx = (size_t) a;
size_t idx = (size_t)(a - 1);
```

This revision aims to improve that by improving the function which tries to identify a CastRParen

Reviewed By: curdeius

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

3 years ago[OpenMP] Fixing Typo in Documentation
Joseph Huber [Wed, 23 Dec 2020 14:16:55 +0000 (09:16 -0500)]
[OpenMP] Fixing Typo in Documentation

3 years ago[ARM] Add bank conflict hazarding
David Penry [Wed, 23 Dec 2020 14:00:59 +0000 (14:00 +0000)]
[ARM] Add bank conflict hazarding

Adds ARMBankConflictHazardRecognizer. This hazard recognizer
looks for a few situations where the same base pointer is used and
then checks whether the offsets lead to a bank conflict. Two
parameters are also added to permit overriding of the target
assumptions:

arm-data-bank-mask=<int> - Mask of bits which are to be checked for
conflicts.  If all these bits are equal in the offsets, there is a
conflict.
arm-assume-itcm-bankconflict=<bool> - Assume that there will be bank
conflicts on any loads to a constant pool.

This hazard recognizer is enabled for Cortex-M7, where the Technical
Reference Manual states that there are two DTCM banks banked using bit
2 and one ITCM bank.

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

3 years ago[NFC] Uniquify 'const' in TargetTransformInfoImpl.h
Simon Moll [Wed, 23 Dec 2020 13:21:41 +0000 (14:21 +0100)]
[NFC] Uniquify 'const' in TargetTransformInfoImpl.h

Some member functions of class TargetTransformInfoImplBase in
TargetTransformInfoImpl.h are marked const while others are not. Yet all
of the should be marked const since they are just providing default TTI
values. This patch fixes the inconsistency.

Authored-by: Jinzheng Tu <b1f6c1c4@gmail.com>
Reviewed By: simoll

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

3 years ago[VE] Vector 'and' isel and tests
Simon Moll [Wed, 23 Dec 2020 12:27:55 +0000 (13:27 +0100)]
[VE] Vector 'and' isel and tests

Reviewed By: kaz7

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

3 years ago[mlir] Remove static constructors from LLVMType
Alex Zinenko [Tue, 22 Dec 2020 10:22:56 +0000 (11:22 +0100)]
[mlir] Remove static constructors from LLVMType

LLVMType contains numerous static constructors that were initially introduced
for API compatibility with LLVM. Most of these merely forward to arguments to
`SpecificType::get` (MLIR defines classes for all types, unlike LLVM IR), while
some introduce subtle semantics differences due to different modeling of MLIR
types (e.g., structs are not auto-renamed in case of conflicts). Furthermore,
these constructors don't match MLIR idioms and actively prevent us from making
the LLVM dialect type system more open. Remove them and use `SpecificType::get`
instead.

Depends On D93680

Reviewed By: mehdi_amini

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

3 years ago[format] Add overload to parseConfiguration that accept llvm::MemoryBufferRef
Nathan James [Wed, 23 Dec 2020 12:08:28 +0000 (12:08 +0000)]
[format] Add overload to parseConfiguration that accept llvm::MemoryBufferRef

This overload should be used for better diagnostics when parsing configurations.
Now a failure to parse will list the filename (or <command-line>) instead of just `YAML`.

Reviewed By: MyDeveloperDay

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

3 years agoRevert "PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of"
Adrian Kuegel [Wed, 23 Dec 2020 11:31:52 +0000 (12:31 +0100)]
Revert "PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of"

This reverts commit d3bf0bb18952d830fe6df6f791a64552b271000b.
This causes compilation in certain cases to fail.
Reproducer TBD.

3 years ago[mlir] Rename ConvertToLLVMPattern::isSupportedMemRefType() to isConvertibleAndHasIde...
Christian Sigg [Wed, 23 Dec 2020 10:37:49 +0000 (11:37 +0100)]
[mlir] Rename ConvertToLLVMPattern::isSupportedMemRefType() to isConvertibleAndHasIdentityMaps().

Reviewed By: ftynse, herhut

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

3 years ago[mlir] Add translation of omp.wsloop to LLVM IR
Alex Zinenko [Tue, 8 Dec 2020 15:45:19 +0000 (16:45 +0100)]
[mlir] Add translation of omp.wsloop to LLVM IR

Introduce a translation of OpenMP workshare loop construct to LLVM IR. This is
a minimalist version to enable the pipeline and currently only supports static
loop schedule (default in the specification) on non-collapsed loops. Other
features will be added on per-need basis.

Reviewed By: kiranchandramohan

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

3 years ago[mlir] NFC: Remove ConvertToLLVMPattern::getDataPtr(). All call sites use getStridedE...
Christian Sigg [Wed, 23 Dec 2020 09:51:23 +0000 (10:51 +0100)]
[mlir] NFC: Remove ConvertToLLVMPattern::getDataPtr(). All call sites use getStridedElementPtr() now.

Reviewed By: ftynse

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

3 years ago[mlir] Modernize std-to-llvm operation conversion doc
Alex Zinenko [Wed, 23 Dec 2020 10:19:35 +0000 (11:19 +0100)]
[mlir] Modernize std-to-llvm operation conversion doc

This was long overdue. Replace the outdated type syntax with the new syntax,
and update the description of how memref load/stores are handled to reflect the
latest changes in the implementation.

Reviewed By: herhut

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

3 years ago[AMDGPU][GlobalISel] Fold flat vgpr + constant addresses
Sebastian Neubauer [Tue, 22 Dec 2020 12:53:38 +0000 (13:53 +0100)]
[AMDGPU][GlobalISel] Fold flat vgpr + constant addresses

Use getPtrBaseWithConstantOffset in selectFlatOffsetImpl to fold more
vgpr+constant addresses.

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

3 years ago[RISCV] Add intrinsics for vfwmacc, vfwnmacc, vfwmsac, vfwnmsac instructions
ShihPo Hung [Tue, 22 Dec 2020 13:30:24 +0000 (05:30 -0800)]
[RISCV] Add intrinsics for vfwmacc, vfwnmacc, vfwmsac, vfwnmsac instructions

This patch defines vfwmacc, vfwnmacc, vfwmsc, vfwnmsac intrinsics
and lower to V instructions.
We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93693

3 years ago[llvm-readobj] - Dump the ELF file type better.
Georgii Rymar [Tue, 22 Dec 2020 12:21:26 +0000 (15:21 +0300)]
[llvm-readobj] - Dump the ELF file type better.

Currently llvm-readelf might print "OS Specific/Processor Specific/<unknown>"
hint when dumping the ELF file type. The patch teaches llvm-readobj to do the same.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40868

I am removing `Object/elf-unknown-type.test` test because it is not in the right place,
it is outdated and very limited.
The `readobj/ELF/file-types.test` checks the functionality much better.

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

3 years ago[RISCV] Define vmerge/vfmerge intrinsics.
Zakk Chen [Tue, 22 Dec 2020 04:50:58 +0000 (20:50 -0800)]
[RISCV] Define vmerge/vfmerge intrinsics.

Define vmerge/vfmerge intrinsics and lower to V instructions.

Include support for vector-vector vfmerge by vmerge.vvm.

We work with @rogfer01 from BSC to come out this patch.

Reviewed By: craig.topper

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

3 years ago[RISCV] Define the vfmin, vfmax RVV intrinsics
Evandro Menezes [Wed, 23 Dec 2020 06:27:38 +0000 (00:27 -0600)]
[RISCV] Define the vfmin, vfmax RVV intrinsics

Define the vfmin, vfmax 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/D93673

3 years ago[NewPM] Fix objc-arc-apelim pass typo
Arthur Eubanks [Wed, 23 Dec 2020 05:40:43 +0000 (21:40 -0800)]
[NewPM] Fix objc-arc-apelim pass typo

3 years ago[NewGVN] Remove for_each_found (NFC)
Kazu Hirata [Wed, 23 Dec 2020 04:13:27 +0000 (20:13 -0800)]
[NewGVN] Remove for_each_found (NFC)

The last use of the function was removed on Sep 30, 2017 in commit
9b926e90d33e0f71c16618365333fc7b330b6bb5.

3 years ago[WebAssembly][NFC] Refactor SIMD load/store tablegen defs
Thomas Lively [Wed, 23 Dec 2020 04:06:12 +0000 (20:06 -0800)]
[WebAssembly][NFC] Refactor SIMD load/store tablegen defs

Introduce `Vec` records, each bundling all information related to a single SIMD
lane interpretation. This lets TableGen definitions take a single Vec parameter
from which they can extract information rather than taking multiple redundant
parameters. This commit refactors all of the SIMD load and store instruction
definitions to use the new `Vec`s. Subsequent commits will similarly refactor
additional instruction definitions.

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

3 years ago[MemorySSA] Use is_contained (NFC)
Kazu Hirata [Wed, 23 Dec 2020 03:58:54 +0000 (19:58 -0800)]
[MemorySSA] Use is_contained (NFC)

3 years agoGlobalISel: Return APInt from getConstantVRegVal
Matt Arsenault [Tue, 3 Nov 2020 14:50:17 +0000 (09:50 -0500)]
GlobalISel: Return APInt from getConstantVRegVal

Returning int64_t was arbitrarily limiting for wide integer types, and
the functions should handle the full generality of the IR.

Also changes the full form which returns the originally defined
vreg. Add another wrapper for the common case of just immediately
converting to int64_t (arguably this would be useful for the full
return value case as well).

One possible issue with this change is some of the existing uses did
break without conversion to getConstantVRegSExtVal, and it's possible
some without adequate test coverage are now broken.

3 years ago[lld/mac] Add --version flag
Nico Weber [Tue, 22 Dec 2020 20:51:20 +0000 (15:51 -0500)]
[lld/mac] Add --version flag

It's an extension to ld64, but all the other ports have it, and
someone asked for it in PR43721.

While here, change the COFF help text to match the other ports.

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

3 years agoAMDGPU: Use Register
Matt Arsenault [Fri, 18 Dec 2020 15:51:17 +0000 (10:51 -0500)]
AMDGPU: Use Register

3 years agoAMDGPU: Add spilled CSR SGPRs to entry block live ins
Matt Arsenault [Fri, 18 Dec 2020 16:51:59 +0000 (11:51 -0500)]
AMDGPU: Add spilled CSR SGPRs to entry block live ins

3 years ago[RISCV] Add intrinsics for vf[n]macc/vf[n]msac/vf[n]madd/vf[n]msub instructions
ShihPo Hung [Tue, 22 Dec 2020 12:50:19 +0000 (04:50 -0800)]
[RISCV] Add intrinsics for vf[n]macc/vf[n]msac/vf[n]madd/vf[n]msub instructions

This patch defines vfmadd/vfnmacc, vfmsac/vfnmsac, vfmadd/vfnmadd,
and vfmsub/vfnmsub lower to V instructions.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93691

3 years ago[RISCV] Add intrinsics for vwmacc[u|su|us] instructions
ShihPo Hung [Tue, 22 Dec 2020 08:01:46 +0000 (00:01 -0800)]
[RISCV] Add intrinsics for vwmacc[u|su|us] instructions

This patch defines vwmacc[u|su|us] intrinsics and lower to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93675

3 years ago[RISCV] Add intrinsics for vslide1up/down, vfslide1up/down instruction
ShihPo Hung [Mon, 21 Dec 2020 02:07:42 +0000 (18:07 -0800)]
[RISCV] Add intrinsics for vslide1up/down, vfslide1up/down instruction

This patch adds intrinsics for vslide1up, vslide1down, vfslide1up, vfslide1down.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93608

3 years agoAMDGPU: Fix assert when checking for implicit operand legality
Matt Arsenault [Mon, 21 Dec 2020 18:27:32 +0000 (13:27 -0500)]
AMDGPU: Fix assert when checking for implicit operand legality

3 years agoVirtRegMap: Use Register
Matt Arsenault [Thu, 17 Dec 2020 23:47:13 +0000 (18:47 -0500)]
VirtRegMap: Use Register

3 years agoReplace `T(x)` with `reinterpret_cast<T>(x)` everywhere it means reinterpret_cast...
Arthur O'Dwyer [Mon, 23 Mar 2020 02:20:04 +0000 (22:20 -0400)]
Replace `T(x)` with `reinterpret_cast<T>(x)` everywhere it means reinterpret_cast. NFC.

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

3 years agoscudo: Move the management of the UseMemoryTagging bit out of the Primary. NFCI.
Peter Collingbourne [Tue, 22 Dec 2020 19:48:53 +0000 (11:48 -0800)]
scudo: Move the management of the UseMemoryTagging bit out of the Primary. NFCI.

The primary and secondary allocators will need to share this bit,
so move the management of the bit to the combined allocator and
make useMemoryTagging() a free function.

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

3 years agoscudo: Replace the Cache argument on MapAllocator with a Config argument. NFCI.
Peter Collingbourne [Tue, 15 Dec 2020 23:32:32 +0000 (15:32 -0800)]
scudo: Replace the Cache argument on MapAllocator with a Config argument. NFCI.

This will allow the secondary allocator to access the
MaySupportMemoryTagging bool.

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

3 years ago[AMDGPU][GlobalISel] GlobalISel for flat scratch
Stanislav Mekhanoshin [Mon, 21 Dec 2020 20:31:06 +0000 (12:31 -0800)]
[AMDGPU][GlobalISel] GlobalISel for flat scratch

It does not seem to fold offsets but this is not specific
to the flat scratch as getPtrBaseWithConstantOffset() does
not return the split for these tests unlike its SDag
counterpart.

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

3 years ago[AMDGPU] Support unaligned flat scratch in TLI
Stanislav Mekhanoshin [Mon, 21 Dec 2020 23:40:46 +0000 (15:40 -0800)]
[AMDGPU] Support unaligned flat scratch in TLI

Adjust SITargetLowering::allowsMisalignedMemoryAccessesImpl for
unaligned flat scratch support. Mostly needed for global isel.

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

3 years agoscudo: Move the configuration for the primary allocator to Config. NFCI.
Peter Collingbourne [Tue, 15 Dec 2020 22:26:10 +0000 (14:26 -0800)]
scudo: Move the configuration for the primary allocator to Config. NFCI.

This will allow the primary and secondary allocators to share
the MaySupportMemoryTagging bool.

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

3 years ago[IR] Add an ImplicitLocOpBuilder helper class for building IR with the same loc.
Chris Lattner [Tue, 22 Dec 2020 18:35:15 +0000 (10:35 -0800)]
[IR] Add an ImplicitLocOpBuilder helper class for building IR with the same loc.

One common situation is to create a lot of IR at a well known location,
e.g. when doing a big rewrite from one dialect to another where you're expanding
ops out into lots of other ops.

For these sorts of situations, it is annoying to pass the location into
every create call.  As we discused in a few threads on the forum, a way to help
with this is to produce a new sort of builder that holds a location and provides
it to each of the create<> calls automatically.

This patch implements an ImplicitLocOpBuilder class that does this.  We've had
good experience with this in the CIRCT project, and it makes sense to upstream to
MLIR.

I picked a random pass to adopt it to show the impact, but I don't think there is
any particular need to force adopt it in the codebase.

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

3 years ago[OpenMP] Add OpenMP Documentation for Libomptarget environment variables
Joseph Huber [Tue, 22 Dec 2020 20:14:30 +0000 (15:14 -0500)]
[OpenMP] Add OpenMP Documentation for Libomptarget environment variables

Add support to the OpenMP web pages for environment variables supported
by Libomptarget and their usage.

Reviewed By: jdoerfert

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

3 years ago[mlir] Remove instance methods from LLVMType
Alex Zinenko [Tue, 22 Dec 2020 10:22:21 +0000 (11:22 +0100)]
[mlir] Remove instance methods from LLVMType

LLVMType contains multiple instance methods that were introduced initially for
compatibility with LLVM API. These methods boil down to `cast` followed by
type-specific call. Arguably, they are mostly used in an LLVM cast-follows-isa
anti-pattern. This doesn't connect nicely to the rest of the MLIR
infrastructure and actively prevents it from making the LLVM dialect type
system more open, e.g., reusing built-in types when appropriate. Remove such
instance methods and replaces their uses with apporpriate casts and methods on
derived classes. In some cases, the result may look slightly more verbose, but
most cases should actually use a stricter subtype of LLVMType anyway and avoid
the isa/cast.

Reviewed By: mehdi_amini

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

3 years ago[WebAssembly][SIMD] Rename shuffle, swizzle, and load_splats
Thomas Lively [Tue, 22 Dec 2020 22:29:06 +0000 (14:29 -0800)]
[WebAssembly][SIMD] Rename shuffle, swizzle, and load_splats

These instructions previously used prefixes like v8x16 to signify that they were
agnostic between float and int interpretations. We renamed these instructions to
remove this form of prefix in https://github.com/WebAssembly/simd/issues/297 and
https://github.com/WebAssembly/simd/issues/316 and this commit brings the names
in LLVM up to date.

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

3 years ago[clangd] Release notes for b8c37153d5393aad96
Sam McCall [Tue, 22 Dec 2020 21:58:39 +0000 (22:58 +0100)]
[clangd] Release notes for b8c37153d5393aad96

3 years ago[mlir] Lower gpu.memcpy to GPU runtime calls.
Christian Sigg [Tue, 22 Dec 2020 16:42:59 +0000 (17:42 +0100)]
[mlir] Lower gpu.memcpy to GPU runtime calls.

Reviewed By: herhut

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

3 years ago[clangd] Use atomics instead of locks to track periodic memory trimming
Sam McCall [Tue, 22 Dec 2020 20:36:41 +0000 (21:36 +0100)]
[clangd] Use atomics instead of locks to track periodic memory trimming

Instead of always locking/unlocking a contended mutex, we now do one atomic read
in the common case, and one read + one exchange if the timer has expried.

Also use this for memory profiling which has similar/compatible requirements.

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

3 years ago[SLP] add reduction tests for maxnum/minnum intrinsics; NFC
Sanjay Patel [Tue, 22 Dec 2020 19:54:09 +0000 (14:54 -0500)]
[SLP] add reduction tests for maxnum/minnum intrinsics; NFC

3 years ago[SLP] use operand index abstraction for number of operands
Sanjay Patel [Tue, 22 Dec 2020 19:13:39 +0000 (14:13 -0500)]
[SLP] use operand index abstraction for number of operands

I think this is NFC currently, but the bug would be exposed
when we allow binary intrinsics (maxnum, etc) as candidates
for reductions.

The code in matchAssociativeReduction() is using
OperationData::getNumberOfOperands() when comparing whether
the "EdgeToVisit" iterator is in-bounds, so this code must
use the same (potentially offset) operand value to set
the "EdgeToVisit".

3 years agoglld/mac] Don't add names of unreferenced symbols to string table
Nico Weber [Tue, 22 Dec 2020 16:00:57 +0000 (11:00 -0500)]
glld/mac] Don't add names of unreferenced symbols to string table

Before this, a hello world program would contain many many unnecessary
entries in its string table.

No behavior change, just makes the string table in the output smaller
and more like ld64's.

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

3 years agoTry to fix build on Windows
Stephen Kelly [Tue, 22 Dec 2020 20:25:10 +0000 (20:25 +0000)]
Try to fix build on Windows

3 years ago[RISCV] Remove unneeded !eq comparing a single bit value to 0/1 in RISCVInstrInfoVPse...
Craig Topper [Tue, 22 Dec 2020 19:40:51 +0000 (11:40 -0800)]
[RISCV] Remove unneeded !eq comparing a single bit value to 0/1 in RISCVInstrInfoVPseudos.td. NFC

Instead we can either use the bit directly. If it was checking for
0 we need to swap the operands or use !not.

3 years ago[OpenMP][Docs] Fix Typo
Johannes Doerfert [Tue, 22 Dec 2020 19:05:45 +0000 (13:05 -0600)]
[OpenMP][Docs] Fix Typo

3 years ago[OpenMP][Docs] Fixed a typo in the doc that can mislead users to a CMake error
Shilei Tian [Tue, 22 Dec 2020 19:05:46 +0000 (14:05 -0500)]
[OpenMP][Docs] Fixed a typo in the doc that can mislead users to a CMake error

When setting `LLVM_ENABLE_RUNTIMES`, lower case word should be used;
otherwise, it can cause a CMake error that specific path is not found.

Reviewed By: ye-luo

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

3 years ago[OpenMP][Docs] Add FAQ entry about math and complex on GPUs
Johannes Doerfert [Tue, 22 Dec 2020 18:49:11 +0000 (12:49 -0600)]
[OpenMP][Docs] Add FAQ entry about math and complex on GPUs

Reviewed By: tianshilei1992

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

3 years agoAdd a llvm.coro.end.async intrinsic
Arnold Schwaighofer [Tue, 15 Dec 2020 21:28:52 +0000 (13:28 -0800)]
Add a llvm.coro.end.async intrinsic

The llvm.coro.end.async intrinsic allows to specify a function that is
to be called as the last action before returning. This function will be
inlined after coroutine splitting.

This function can contain a 'musttail' call to allow for guaranteed tail
calling as the last action.

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

3 years ago[AMDGPU] Folding of FI operand with flat scratch
Stanislav Mekhanoshin [Fri, 18 Dec 2020 00:48:04 +0000 (16:48 -0800)]
[AMDGPU] Folding of FI operand with flat scratch

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

3 years ago[clang-tidy] Handle template instantiations in container size check
Stephen Kelly [Tue, 27 Oct 2020 23:24:20 +0000 (23:24 +0000)]
[clang-tidy] Handle template instantiations in container size check

readability-container-size-empty currently modifies source code based on
AST nodes in template instantiations, which means that it makes
transformations based on substituted types.  This can lead to
transforming code to be broken.

Change the matcher implementation to ignore template instantiations
explicitly, and add a matcher to explicitly handle template declarations
instead of instantiations.

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

3 years agoRevert "[LLDB] Unbreak the build after recent clang changes"
Arthur Eubanks [Tue, 22 Dec 2020 18:33:09 +0000 (10:33 -0800)]
Revert "[LLDB] Unbreak the build after recent clang changes"

This reverts commit 430d5d8429473c2b10b109991d7577a3cea41140.

Depends on a reverted change.

3 years agoRevert "[clangd] zap a few warnings"
Arthur Eubanks [Tue, 22 Dec 2020 18:31:21 +0000 (10:31 -0800)]
Revert "[clangd] zap a few warnings"

This reverts commit 95c7b6cadbc9a3d4376ef44edbeb3c8bb5b8d7fc.

Depends on a reverted change.

3 years agoRevert "[Flang][openmp][5.0] Add task_reduction clause."
sameeran joshi [Tue, 22 Dec 2020 18:16:51 +0000 (23:46 +0530)]
Revert "[Flang][openmp][5.0] Add task_reduction clause."

This reverts commit 9a7895dc20852b662a66976d06871ec2a0b968c8.
Reverting due to missing Co-author attribution.

https://reviews.llvm.org/D93105

3 years agoRevert "DR2064: decltype(E) is only a dependent type if E is type-dependent, not"
Arthur Eubanks [Tue, 22 Dec 2020 18:12:44 +0000 (10:12 -0800)]
Revert "DR2064: decltype(E) is only a dependent type if E is type-dependent, not"

This reverts commit 638867afd4bce4a2c56dea041299428af3727d61.

This is part of 5 commits being reverted due to https://crbug.com/1161059. See bug for repro.

3 years agoRevert "Following up on PR48517, fix handling of template arguments that refer"
Arthur Eubanks [Tue, 22 Dec 2020 18:12:40 +0000 (10:12 -0800)]
Revert "Following up on PR48517, fix handling of template arguments that refer"

This reverts commit 8c1f2d15b826591cdf6bd6b468b8a7d23377b29e.

This is part of 5 commits being reverted due to https://crbug.com/1161059. See bug for repro.

3 years agoRevert "[c++20] P1907R1: Support for generalized non-type template arguments of scala...
Arthur Eubanks [Tue, 22 Dec 2020 18:12:37 +0000 (10:12 -0800)]
Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type."

This reverts commit 9e08e51a20d0d2b1c5724bb17e969d036fced4cd.

This is part of 5 commits being reverted due to https://crbug.com/1161059. See bug for repro.

3 years agoRevert "Fix MSVC "not all control paths return a value" warnings. NFCI."
Arthur Eubanks [Tue, 22 Dec 2020 18:12:33 +0000 (10:12 -0800)]
Revert "Fix MSVC "not all control paths return a value" warnings. NFCI."

This reverts commit 7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0.

This is part of 5 commits being reverted due to https://crbug.com/1161059. See bug for repro.

3 years agoRevert "Fix memory leak complicated non-type template arguments."
Arthur Eubanks [Tue, 22 Dec 2020 18:11:31 +0000 (10:11 -0800)]
Revert "Fix memory leak complicated non-type template arguments."

This reverts commit ed13d8c66781b50ff007cb089c5905f9bb9e8af2.

This is part of 5 commits being reverted due to https://crbug.com/1161059. See bug for repro.

3 years ago[OpenMP][Docs] Updated the faq about building an OpenMP offloading capable compiler
Shilei Tian [Tue, 22 Dec 2020 18:14:34 +0000 (13:14 -0500)]
[OpenMP][Docs] Updated the faq about building an OpenMP offloading capable compiler

After some issues about building runtimes along with LLVM were fixed,
building an OpenMP offloading capable compiler is pretty simple. This patch updates
the FAQ part in the doc.

Reviewed By: jdoerfert

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

3 years ago[lldb] Add SBType::GetEnumerationIntegerType method
Andy Yankovsky [Tue, 22 Dec 2020 18:07:44 +0000 (10:07 -0800)]
[lldb] Add SBType::GetEnumerationIntegerType method

Add a method for getting the enumeration underlying type.

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

3 years ago[lldb] Add SBType::IsScopedEnumerationType method
Andy Yankovsky [Tue, 22 Dec 2020 18:06:46 +0000 (10:06 -0800)]
[lldb] Add SBType::IsScopedEnumerationType method

Add a method to check if the type is a scoped enumeration (i.e. "enum
class/struct").

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

3 years ago[ADT] Fix some tests after 5d10b8ad
Nathan James [Tue, 22 Dec 2020 18:06:19 +0000 (18:06 +0000)]
[ADT] Fix some tests after 5d10b8ad

Some bots were failing due to signed/unsigned comparison.

3 years ago[LoopDeletion] Add test case where outer loop needs to be deleted.
Florian Hahn [Tue, 22 Dec 2020 17:48:01 +0000 (17:48 +0000)]
[LoopDeletion] Add test case where outer loop needs to be deleted.

In the test case @test1, the inner loop cannot be removed, because it
has a live-out value. But the outer loop is a no-op and can be removed.

3 years ago[tests] precommit a test mentioned in review for D93317
Philip Reames [Tue, 22 Dec 2020 17:47:11 +0000 (09:47 -0800)]
[tests] precommit a test mentioned in review for D93317

3 years ago[ADT] Add resize_for_overwrite method to SmallVector.
Nathan James [Tue, 22 Dec 2020 17:18:59 +0000 (17:18 +0000)]
[ADT] Add resize_for_overwrite method to SmallVector.

Analagous to the std::make_(unqiue|shared)_for_overwrite added in c++20.
If T is POD, and the container gets larger, any new values added wont be initialized.
This is useful when using SmallVector as a buffer where its planned to overwrite any potential new values added.
If T is not POD, `new (Storage) T` functions identically to `new (Storage) T()` so this will function identically to `resize(size_type)`.

Reviewed By: dexonsmith

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

3 years agoFix some misnamed variables in sve-fixed-length-int-minmax.ll.
Paul Walker [Tue, 22 Dec 2020 17:05:02 +0000 (17:05 +0000)]
Fix some misnamed variables in sve-fixed-length-int-minmax.ll.