platform/upstream/llvm.git
3 years ago[OpenMP] Add omp_realloc implementation
Nawrin Sultana [Fri, 6 Nov 2020 21:36:19 +0000 (15:36 -0600)]
[OpenMP] Add omp_realloc implementation

This patch adds omp_realloc function implementation according to
OpenMP 5.1 specification.

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

3 years ago[MachineScheduler] Inform pass infra of post-ra scheduler's dependencies
Jon Roelofs [Tue, 17 Nov 2020 18:54:41 +0000 (10:54 -0800)]
[MachineScheduler] Inform pass infra of post-ra scheduler's dependencies

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

3 years ago[libc] make part of libc's unit test framework independent of llvm
Michael Jones [Mon, 16 Nov 2020 22:20:14 +0000 (22:20 +0000)]
[libc] make part of libc's unit test framework independent of llvm

This is mostly changing stringref to std::string, outs() to cout,
and small supporting changes. This will make running unit tests possible
on systems that are only grabbing the libc part of llvm.

Reviewed By: sivachandra

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

3 years ago[InstCombine] allow vectors for masked-add -> xor fold
Sanjay Patel [Tue, 17 Nov 2020 18:24:47 +0000 (13:24 -0500)]
[InstCombine] allow vectors for masked-add -> xor fold

https://rise4fun.com/Alive/I4Ge

  Name: add with pow2 mask
  Pre: isPowerOf2(C2) && (C1 & C2) != 0 && (C1 & (C2-1)) == 0
  %a = add i8 %x, C1
  %r = and i8 %a, C2
  =>
  %n = and i8 %x, C2
  %r = xor i8 %n, C2

3 years ago[X86] byval tests - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 18:26:32 +0000 (18:26 +0000)]
[X86] byval tests - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] emutls.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 18:22:45 +0000 (18:22 +0000)]
[X86] emutls.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] emutls-pie.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 18:20:28 +0000 (18:20 +0000)]
[X86] emutls-pie.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] emutls-pic.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 18:14:36 +0000 (18:14 +0000)]
[X86] emutls-pic.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[OPENMP] Fix PR47999: correctly map implicit firstprivates in outer tasks.
Alexey Bataev [Tue, 17 Nov 2020 13:33:25 +0000 (05:33 -0800)]
[OPENMP] Fix PR47999: correctly map implicit firstprivates in outer tasks.

If the variable is implicitly firstprivatized in the inner task-based
region, it also must be firstprivatized in outer task-based regions.
Previously firstprivates were captured in tasks but later it was
optimized to reduce the memory usage. But still need to mark such
variables as implicit firstprivate in outer tasks.

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

3 years ago[libc++] Do not error out when we don't know the file format
Louis Dionne [Tue, 17 Nov 2020 18:17:40 +0000 (13:17 -0500)]
[libc++] Do not error out when we don't know the file format

Erroring out prevents the library from working with other file formats
(e.g. in embedded). Since that error does not guard us from doing something
incorrect, it seems fine to just remove it.

3 years ago[Transformer] Split ForStmt test into two
Stephen Kelly [Tue, 17 Nov 2020 18:13:35 +0000 (18:13 +0000)]
[Transformer] Split ForStmt test into two

It is apparently not possible to have two rewrites in one gtest function
because atomic changes in the test harness accumulate.

3 years ago[libc++] Only include_next <wctype.h> if it exists
Louis Dionne [Tue, 17 Nov 2020 18:14:36 +0000 (13:14 -0500)]
[libc++] Only include_next <wctype.h> if it exists

This allows building on platforms that don't provide that header.

3 years ago[AArch64][SVE] Add tests for VLST -> VLAT lax conversions
Joe Ellis [Tue, 17 Nov 2020 17:29:42 +0000 (17:29 +0000)]
[AArch64][SVE] Add tests for VLST -> VLAT lax conversions

These were previously missing from the SVE lax conversions tests
introduced in this commit:

    23a96b84a8d985b686a4e06dec1f7aebc0cca6c6
    (https://reviews.llvm.org/D91067)

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

3 years ago[X86] segmented-stacks tests - replace X32 check prefix with X86 for non-gnux32 tests...
Simon Pilgrim [Tue, 17 Nov 2020 17:59:05 +0000 (17:59 +0000)]
[X86] segmented-stacks tests - replace X32 check prefix with X86 for non-gnux32 tests. NFC.

Only use X32 for the gnux32 triples in the tests

3 years ago[X86] select-of-fp-constants.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 17:56:09 +0000 (17:56 +0000)]
[X86] select-of-fp-constants.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[InstCombine] visitAnd - remove unnecessary Value *X, *Y shadow variables. NFCI.
Simon Pilgrim [Tue, 17 Nov 2020 17:50:36 +0000 (17:50 +0000)]
[InstCombine] visitAnd - remove unnecessary Value *X, *Y shadow variables. NFCI.

Fixes a number of Wshadow warnings.

3 years agolld: Add --color-diagnostic to MachO port, harmonize others
Nico Weber [Tue, 17 Nov 2020 17:15:42 +0000 (12:15 -0500)]
lld: Add --color-diagnostic to MachO port, harmonize others

This adds `--[no-]color-diagnostics[=auto,never,always]` to
the MachO port and harmonizes the flag in the other ports:
- Consistently use MetaVarName
- Consistently document the non-eq version as alias of the eq version
- Use B<> in the ports that have it (no-op, shorter)
- Fix oversight in COFF port that made the --no flag have the wrong
  prefix

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

3 years ago[mlir] Simplify std.alloc lowering to LLVM.
Christian Sigg [Tue, 17 Nov 2020 17:00:55 +0000 (18:00 +0100)]
[mlir] Simplify std.alloc lowering to LLVM.

std.alloc only supports memrefs with identity layout, which means we can simplify the lowering to LLVM and compute strides only from (static and dynamic) sizes.

Reviewed By: ftynse

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

3 years agoComment out new test while I figure out what is wrong with it
Stephen Kelly [Tue, 17 Nov 2020 17:48:14 +0000 (17:48 +0000)]
Comment out new test while I figure out what is wrong with it

3 years ago[InstCombine] visitAnd - use m_SpecificInt instead of m_APInt + comparison. NFCI.
Simon Pilgrim [Tue, 17 Nov 2020 17:22:36 +0000 (17:22 +0000)]
[InstCombine] visitAnd - use m_SpecificInt instead of m_APInt + comparison. NFCI.

m_SpecificInt has the same 'no undef element' behaviour as m_APInt so no change there, and anyway we have test coverage for undef elements in the fold.

Noticed while fixing a Wshadow warning about shadow Value *X, *Y variables.

3 years ago[X86] rot16.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 16:51:24 +0000 (16:51 +0000)]
[X86] rot16.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] vec_fabs.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 16:50:08 +0000 (16:50 +0000)]
[X86] vec_fabs.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[BPI] Look through bitcasts in calcZeroHeuristic
Wei Wang [Fri, 13 Nov 2020 19:17:47 +0000 (11:17 -0800)]
[BPI] Look through bitcasts in calcZeroHeuristic

Constant hoisting may hide the constant value behind bitcast for And's
operand. Track down the constant to make the BFI result consistent
regardless of hoisting.

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

3 years ago[debugserver] Add option to propagate SIGSEGV to target process
Alessandro Arzilli [Tue, 17 Nov 2020 17:26:20 +0000 (09:26 -0800)]
[debugserver] Add option to propagate SIGSEGV to target process

Adds a command line option that makes debugserver propagate the SIGSEGV
signal to the target process.

Motivation: I'm one of the maintainers of Delve [1] a debugger for Go.
We use debugserver as our backend on macOS and one of the most often
reported bugs is that, on macOS, we don't propagate SIGSEGV back to the
target process [2]. Sometimes some programs will actually cause a
SIGSEGV, by design, and then handle it. Those programs can not be
debugged at all.

Since catching signals isn't very important for a Go debugger I'd much
rather have a command line option in debugserver that causes it to let
SIGSEGV go directly to the target process.

[1] https://github.com/go-delve/delve/
[2] https://github.com/go-delve/delve/issues/852

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

3 years ago[NFC] Add unit tests for printing/parsing of variadic operands and results.
Rahul Joshi [Tue, 17 Nov 2020 01:37:19 +0000 (17:37 -0800)]
[NFC] Add unit tests for printing/parsing of variadic operands and results.

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

3 years ago[InstCombine] remove scalar constraint for mask-of-add fold
Sanjay Patel [Tue, 17 Nov 2020 17:03:55 +0000 (12:03 -0500)]
[InstCombine] remove scalar constraint for mask-of-add fold

https://rise4fun.com/Alive/V6fP

  Name: add with low mask
  Pre: (C1 & (-1 u>> countLeadingZeros(C2))) == 0
  %a = add i8 %x, C1
  %r = and i8 %a, C2
  =>
  %r = and i8 %x, C2

3 years ago[InstCombine] add vector test for mask of add; NFC
Sanjay Patel [Tue, 17 Nov 2020 17:02:27 +0000 (12:02 -0500)]
[InstCombine] add vector test for mask of add; NFC

3 years ago[InstCombine] relax constraints on mask-of-add
Sanjay Patel [Tue, 17 Nov 2020 16:46:34 +0000 (11:46 -0500)]
[InstCombine] relax constraints on mask-of-add

There are 2 changes:
1. Remove the unnecessary one-use check.
2. Remove the unnecessary power-of-2 check.

https://rise4fun.com/Alive/V6fP

  Name: add with low mask
  Pre: (C1 & (-1 u>> countLeadingZeros(C2))) == 0
  %a = add i8 %x, C1
  %r = and i8 %a, C2
  =>
  %r = and i8 %x, C2

3 years ago[InstCombine] add tests for masked add; NFC
Sanjay Patel [Tue, 17 Nov 2020 16:28:33 +0000 (11:28 -0500)]
[InstCombine] add tests for masked add; NFC

3 years ago[MLIR][SPIRV] Rename `spv._address_of` to `spv.mlir.addressof`
ergawy [Tue, 17 Nov 2020 16:45:32 +0000 (11:45 -0500)]
[MLIR][SPIRV] Rename `spv._address_of` to `spv.mlir.addressof`

This commit does the renaming mentioned in the title in order to bring
`spv` dialect closer to the MLIR naming conventions.

Reviewed By: antiagainst

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

3 years ago[ELF] --gc-sections: collect unused .gcc_except_table in section groups and associate...
Fangrui Song [Tue, 17 Nov 2020 17:11:19 +0000 (09:11 -0800)]
[ELF] --gc-sections: collect unused .gcc_except_table in section groups and associated text sections

`try ... catch` in an inline function produces `.gcc_except_table.*` in a COMDAT
group with GCC or newer Clang (since D83655). For --gc-sections, currently we
scan `.eh_frame` pieces and mark liveness of such a `.gcc_except_table.*` and
then the associated `.text.*` (if a member in a section group is retained, the
others should be retained as well).

Essentially all `.text.*` and `.gcc_except_table.*` compiled from inline
functions with `try ... catch` cannot be discarded by the imprecise
--gc-sections.  Compared with the state before D83655, the output
`.gcc_except_table` is smaller (non-prevailing copies in COMDAT groups can now
be discarded) but `.text` may be larger, i.e. size regression.

This patch teaches the .eh_frame piece scanning code to not mark
`.gcc_except_table` in a section group, thus allow unused `.text.*` and
`.gcc_except_table.*` in a section group to be discarded.

Note, non-group `.gcc_except_table` can still not be discarded. That is the status quo.

Reviewed By: grimar, echristo

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

3 years ago[ARC] Correct ARCInstPrinter::getMnemonic after D90039
Fangrui Song [Tue, 17 Nov 2020 17:07:38 +0000 (09:07 -0800)]
[ARC] Correct ARCInstPrinter::getMnemonic after D90039

3 years ago[BasicAA] Make alias GEP positive offset handling symmetric
Nikita Popov [Thu, 12 Nov 2020 20:51:32 +0000 (21:51 +0100)]
[BasicAA] Make alias GEP positive offset handling symmetric

aliasGEP() currently implements some special handling for the case
where all variable offsets are positive, in which case the constant
offset can be taken as the minimal offset. However, it does not
perform the same handling for the all-negative case. This means that
the alias-analysis result between two GEPs is asymmetric:
If GEP1 - GEP2 is all-positive, then GEP2 - GEP1 is all-negative,
and the first will result in NoAlias, while the second will result
in MayAlias.

Apart from producing sub-optimal results for one order, this also
violates our caching assumption. In particular, if BatchAA is used,
the cached result depends on the order of the GEPs in the first query.
This results in an inconsistency in BatchAA and AA results, which
is how I noticed this issue in the first place.

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

3 years ago[mlir] Add a _get_default_loc_context utility to Python bindings
Alex Zinenko [Tue, 17 Nov 2020 13:17:22 +0000 (14:17 +0100)]
[mlir] Add a _get_default_loc_context utility to Python bindings

This utility function is helpful for dialect-specific builders that need
to access the context through location, and the location itself may be
either provided as an argument or expected to be recovered from the
implicit location stack.

Reviewed By: stellaraccident

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

3 years ago[AST] Update matchers to be traverse-aware
Stephen Kelly [Thu, 5 Nov 2020 18:42:21 +0000 (18:42 +0000)]
[AST] Update matchers to be traverse-aware

Don't match Stmt or Decl nodes not spelled in the source when using
TK_IgnoreUnlessSpelledInSource.  This prevents accidental modification
of source code at incorrect locations.

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

3 years ago[AST] Ignore implicit nodes in IgnoreUnlessSpelledInSource mode
Stephen Kelly [Wed, 4 Nov 2020 22:57:42 +0000 (22:57 +0000)]
[AST] Ignore implicit nodes in IgnoreUnlessSpelledInSource mode

Update the ASTNodeTraverser to dump only nodes spelled in source.  There
are only a few which need to be handled, but Decl nodes for which
isImplicit() is true are handled together.

Update the RAV instances used in ASTMatchFinder to ignore the nodes too.
As with handling of template instantiations, it is necessary to allow
the RAV to process the implicit nodes because they need to be visitable
before the first traverse() matcher is encountered.  An exception to
this is in the MatchChildASTVisitor, because we sometimes wish to make a
node matchable but make its children not-matchable.  This is the case
for defaulted CXXMethodDecls for example.

Extend TransformerTests to illustrate the kinds of problems that can
arise when performing source code rewriting due to matching implicit
nodes.

This change accounts for handling nodes not spelled in source when using
direct matching of nodes, and when using the has() and hasDescendant()
matchers.  Other matchers such as
cxxRecordDecl(hasMethod(cxxMethodDecl())) still succeed for
compiler-generated methods for example after this change.  Updating the
implementations of hasMethod() and other matchers is for a follow-up
patch.

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

3 years agoMove ASTMatchFinder definition so it can be accessed from other functions
Stephen Kelly [Tue, 17 Nov 2020 15:52:46 +0000 (15:52 +0000)]
Move ASTMatchFinder definition so it can be accessed from other functions

3 years agoRename API to not be constrained to template instantiations
Stephen Kelly [Tue, 17 Nov 2020 15:42:03 +0000 (15:42 +0000)]
Rename API to not be constrained to template instantiations

A follow-up commit will use this method to ignore implcit AST nodes.

3 years agoInvert accessor for checking traversal mode
Stephen Kelly [Tue, 17 Nov 2020 15:38:34 +0000 (15:38 +0000)]
Invert accessor for checking traversal mode

For now, there is a traversal mode which ignores implicit casts and
parenthesis. Invert the check in order to not obviously break that.

3 years ago[PPC] Fix dead store value clang static analyzer warning. NFCI.
Simon Pilgrim [Tue, 17 Nov 2020 16:27:32 +0000 (16:27 +0000)]
[PPC] Fix dead store value clang static analyzer warning. NFCI.

Simplify the SplatBits 2-byte -> 4-byte 'splat'.

3 years ago[mlir] Remove unused ConvertToLLVMPattern::linearizeSubscripts().
Christian Sigg [Tue, 17 Nov 2020 08:31:47 +0000 (09:31 +0100)]
[mlir] Remove unused ConvertToLLVMPattern::linearizeSubscripts().

Reviewed By: ftynse

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

3 years ago[VPlan] Add VPDef class.
Florian Hahn [Tue, 17 Nov 2020 09:46:22 +0000 (09:46 +0000)]
[VPlan] Add VPDef class.

This patch introduces a new VPDef class, which can be used to
manage VPValues defined by recipes/VPInstructions.

The idea here is to mirror VPUser for values defined by a recipe. A
VPDef can produce either zero (e.g. a store recipe), one (most recipes)
or multiple (VPInterleaveRecipe) result VPValues.

To traverse the def-use chain from a VPDef to its users, one has to
traverse the users of all values defined by a VPDef.

VPValues now contain a pointer to their corresponding VPDef, if one
exists. To traverse the def-use chain upwards from a VPValue, we first
need to check if the VPValue is defined by a VPDef. If it does not have
a VPDef, this means we have a VPValue that is not directly defined
iniside the plan and we are done.

If we have a VPDef, it is defined inside the region by a recipe, which
is a VPUser, and the upwards def-use chain traversal continues by
traversing all its operands.

Note that we need to add an additional field to to VPVAlue to link them
to their defs. The space increase is going to be offset by being able to
remove the SubclassID field in future patches.

Reviewed By: Ayal

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

3 years ago[IR] ShuffleVectorInst::isIdentityWithPadding - bail on non-fixed-type vector shuffles.
Simon Pilgrim [Tue, 17 Nov 2020 16:05:03 +0000 (16:05 +0000)]
[IR] ShuffleVectorInst::isIdentityWithPadding - bail on non-fixed-type vector shuffles.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27416

3 years ago[X86] nontemporal.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 14:26:53 +0000 (14:26 +0000)]
[X86] nontemporal.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] subvector-broadcast.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 14:16:44 +0000 (14:16 +0000)]
[X86] subvector-broadcast.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[OpenMP] NFC: remove tabs in message catalog file
Peyton, Jonathan L [Tue, 17 Nov 2020 16:14:36 +0000 (10:14 -0600)]
[OpenMP] NFC: remove tabs in message catalog file

3 years ago[WebAssembly] Fix parsing of linking section for named global imports
Andy Wingo [Tue, 17 Nov 2020 16:03:50 +0000 (08:03 -0800)]
[WebAssembly] Fix parsing of linking section for named global imports

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

3 years ago[OpenMP][stats] reset serial state when re-entering serial region
Peyton, Jonathan L [Thu, 5 Nov 2020 18:34:39 +0000 (12:34 -0600)]
[OpenMP][stats] reset serial state when re-entering serial region

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

3 years agoLinker: Fix linking of byref types
Matt Arsenault [Tue, 17 Nov 2020 15:47:43 +0000 (10:47 -0500)]
Linker: Fix linking of byref types

This wasn't properly remapping the type like with the other
attributes, so this would end up hitting a verifier error after
linking different modules using byref.

3 years ago[AMDGPU] Precommit more vccz workaround tests
Jay Foad [Mon, 16 Nov 2020 16:08:25 +0000 (16:08 +0000)]
[AMDGPU] Precommit more vccz workaround tests

3 years ago[SLPVectorizer] Fix assert
Anton Afanasyev [Tue, 17 Nov 2020 15:46:31 +0000 (18:46 +0300)]
[SLPVectorizer] Fix assert

3 years ago[clang][AVR] Improve avr-ld command line options
Ben Shi [Tue, 17 Nov 2020 15:28:41 +0000 (23:28 +0800)]
[clang][AVR] Improve avr-ld command line options

Reviewed By: dylanmckay

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

3 years ago[OPENMP]Fix PR48076: mapping of data member pointer.
Alexey Bataev [Mon, 16 Nov 2020 17:43:53 +0000 (09:43 -0800)]
[OPENMP]Fix PR48076: mapping of data member pointer.

If the data member pointer is mapped, the compiler tries to optimize the
mapping of such data by discarding explicit mapping flags and trying to
emit combined data instead. In some cases, this optimization is not
quite correctly implemented and it leads to a program crash at the
runtime. Instead, if the data member is mapped, just emit it as is and
do not emit combined mapping flags for it.

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

3 years ago[Matrix] Add inline assembly test case.
Florian Hahn [Tue, 17 Nov 2020 14:24:37 +0000 (14:24 +0000)]
[Matrix] Add inline assembly test case.

This patch adds a new test cases which uses a matrix value as memory
inline assembly argument. Currently the pointer element type does not
match the vector type.

3 years ago[SLP] Make SLPVectorizer to use `llvm.masked.gather` intrinsic
Anton Afanasyev [Fri, 30 Oct 2020 07:22:50 +0000 (10:22 +0300)]
[SLP] Make SLPVectorizer to use `llvm.masked.gather` intrinsic

For the scattered operands of load instructions it makes sense
to use gathering load intrinsic, which can lower to native instruction
for X86/AVX512 and ARM/SVE. This also enables building
vectorization tree with entries containing scattered operands.
The next step is to add scattered store.

Fixes PR47629 and PR47623

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

3 years ago[WebAssembly][MC] Remove useless overrides in MCWasmStreamer
Andy Wingo [Tue, 17 Nov 2020 15:09:30 +0000 (07:09 -0800)]
[WebAssembly][MC] Remove useless overrides in MCWasmStreamer

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

3 years ago[AArch64][SVE] Support implicit lax vector conversions for SVE types
Joe Ellis [Tue, 17 Nov 2020 14:34:31 +0000 (14:34 +0000)]
[AArch64][SVE] Support implicit lax vector conversions for SVE types

Lax vector conversions was behaving incorrectly for implicit casts
between scalable and fixed-length vector types. For example, this:

    #include <arm_sve.h>

    #define N __ARM_FEATURE_SVE_BITS
    #define FIXED_ATTR __attribute__((arm_sve_vector_bits(N)))

    typedef svfloat32_t fixed_float32_t FIXED_ATTR;

    void allowed_depending() {
      fixed_float32_t fs32;
      svfloat64_t s64;

      fs32 = s64;
    }

... would fail because the vectors have differing lane sizes. This patch
implements the correct behaviour for
-flax-vector-conversions={none,all,integer}. Specifically:

- -flax-vector-conversions=none prevents all lax vector conversions
  between scalable and fixed-sized vectors.
- -flax-vector-conversions=integer allows lax vector conversions between
  scalable and fixed-size vectors whose element types are integers.
- -flax-vector-conversions=all allows all lax vector conversions between
  scalable and fixed-size vectors (including those with floating point
  element types).

The implicit conversions are implemented as bitcasts.

Reviewed By: fpetrogalli

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

3 years ago[TableGen] Clean up Target .td include files
Paul C. Anagnostopoulos [Sat, 14 Nov 2020 18:06:58 +0000 (13:06 -0500)]
[TableGen] Clean up Target .td include files

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

3 years ago[MLIR] Fix up integration tests after b7382ed3fea08da27530a6d6d53f168fc704e4c4
Benjamin Kramer [Tue, 17 Nov 2020 14:42:45 +0000 (15:42 +0100)]
[MLIR] Fix up integration tests after b7382ed3fea08da27530a6d6d53f168fc704e4c4

3 years ago[flang][nfc] Add missing dependency in CMake
Andrzej Warzynski [Tue, 17 Nov 2020 14:32:39 +0000 (14:32 +0000)]
[flang][nfc] Add missing dependency in CMake

This missing dependency has been causing the Flang buildbots
(with BUILD_SHARED_LIBS set to ON) to fail:
  * http://lab.llvm.org:8011/#/builders/66/builds/542
  * http://lab.llvm.org:8011/#/builders/33/builds/764

This missing dependency was exposed by this change:
  * https://reviews.llvm.org/D91461
This change is fine - the root cause of the failing builds is the
missing dependency.

3 years ago[ConstraintElimination] Add support for And.
Florian Hahn [Wed, 5 Aug 2020 14:24:54 +0000 (15:24 +0100)]
[ConstraintElimination] Add support for And.

When processing conditional branches, if the condition is an AND of 2 compares
and the true successor only has the current block as predecessor, queue both
conditions for the true successor.

3 years ago[clang-tidy] Make clang-format and include-order-check coherent
Kadir Cetinkaya [Tue, 17 Nov 2020 09:28:52 +0000 (10:28 +0100)]
[clang-tidy] Make clang-format and include-order-check coherent

LLVM style puts both gtest and gmock to the end of the include list.
But llvm-include-order-check was only moving gtest headers to the end, resulting
in a false tidy-warning.

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

3 years agoUpdate 'note-candiate' functions to skip lambda-conversion-op-overloads
Erich Keane [Mon, 16 Nov 2020 23:26:22 +0000 (15:26 -0800)]
Update 'note-candiate' functions to skip lambda-conversion-op-overloads

In the wake of https://reviews.llvm.org/D89559, we discovered that a
couple of tests (the ones modified below to have additional triple
versions) would fail on Win32, for 1 of two reasons.  We seem to not
have a win32 buildbot anymore, so the triple is to make sure this
doesn't get broken in the future.

First, two of the three 'note-candidate' functions weren't appropriately
skipping the remaining conversion functions.

Second, in 1 situation (note surrogate candidates) we actually print the
type of the conversion operator.  The two tests that ran into that
needed updating to make sure it printed the proper one in the win32
case.

3 years agoReland [LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizati...
Sander de Smalen [Thu, 12 Nov 2020 12:33:36 +0000 (12:33 +0000)]
Reland [LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizationCost.

This relands https://reviews.llvm.org/D91059 and reverts commit
30fded75b48bcbc034120154a57a00c7f3d07e06.

GetRegUsage now returns 0 when Ty is not a valid vector element type.

3 years ago[VE] Implement JumpTable
Kazushi (Jam) Marukawa [Tue, 17 Nov 2020 13:38:49 +0000 (22:38 +0900)]
[VE] Implement JumpTable

Implement JumpTable to make BRIND work on VE.  Update an existing
br_jt regression test also.

Reviewed By: simoll

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

3 years ago[mlir][std] Canonicalize extract_element(tensor_cast).
Stephan Herhut [Tue, 17 Nov 2020 12:59:26 +0000 (13:59 +0100)]
[mlir][std] Canonicalize extract_element(tensor_cast).

Canonicalize extract_element(tensor_cast(v)) to just extract_element(v).

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

3 years ago[mlir][std] Fold dim(dynamic_tensor_from_elements, %cst)
Stephan Herhut [Tue, 17 Nov 2020 12:39:08 +0000 (13:39 +0100)]
[mlir][std] Fold dim(dynamic_tensor_from_elements, %cst)

The shape of the result of a dynamic_tensor_from_elements is defined via its
result type and operands. We already fold dim operations when they reference
one of the statically sized dimensions. Now, also fold dim on the dynamically
sized dimensions by picking the corresponding operand.

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

3 years ago[mlir][linalg] Allow tensor_to_memref in dependence analysis
Stephan Herhut [Tue, 17 Nov 2020 12:19:57 +0000 (13:19 +0100)]
[mlir][linalg] Allow tensor_to_memref in dependence analysis

This enables the use of fusion on buffers in partially lowered
programs.

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

3 years ago[VE] Correct getMnemonic
Kazushi (Jam) Marukawa [Tue, 17 Nov 2020 10:28:49 +0000 (19:28 +0900)]
[VE] Correct getMnemonic

https://reviews.llvm.org/D90039 breaks VE backend.  So, fix it.

Reviewed By: simoll

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

3 years ago[mlir] Allow for using interface class name in ODS interface definitions
Alex Zinenko [Sun, 15 Nov 2020 16:49:37 +0000 (17:49 +0100)]
[mlir] Allow for using interface class name in ODS interface definitions

It may be necessary for interface methods to process or return variables with
the interface class type, in particular for attribute and type interfaces that
can return modified attributes and types that implement the same interface.
However, the code generated by ODS in this case would not compile because the
signature (and the body if provided) appear in the definition of the Model
class and before the interface class, which derives from the Model. Change the ODS
interface method generator to emit only method declarations in the Model class
itself, and emit method definitions after the interface class. Mark as "inline"
since their definitions are still emitted in the header and are no longer
implicitly inline. Add a forward declaration of the interface class before the
Concept+Model classes to make the class name usable in declarations.

Reviewed By: rriddle

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

3 years ago[mlir] Fix Python tests after "module_terminator" migrated to ODS
Alex Zinenko [Tue, 17 Nov 2020 13:15:11 +0000 (14:15 +0100)]
[mlir] Fix Python tests after "module_terminator" migrated to ODS

The "module_terminator" op now has a custom syntax and therefore is
printed without quotes. Adapt Python tests to check for this syntax.

3 years ago[clang][NFC] Use SmallString instead of SmallVector<char
Nathan James [Tue, 17 Nov 2020 13:02:58 +0000 (13:02 +0000)]
[clang][NFC] Use SmallString instead of SmallVector<char

Simplifies code in some places and is more explicit about what is being used.
No additional includes were added here so no impact on compile time.

3 years ago[X86] vector-sext.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 12:39:08 +0000 (12:39 +0000)]
[X86] vector-sext.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] insert-into-constant-vector.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 12:37:59 +0000 (12:37 +0000)]
[X86] insert-into-constant-vector.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] avx-intel-ocl.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 12:35:29 +0000 (12:35 +0000)]
[X86] avx-intel-ocl.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] 2011-10-19-widen_vselect.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 12:34:10 +0000 (12:34 +0000)]
[X86] 2011-10-19-widen_vselect.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[clang][driver] Fix definition/declaration argument name mismatches. NFCI.
Simon Pilgrim [Tue, 17 Nov 2020 12:22:33 +0000 (12:22 +0000)]
[clang][driver] Fix definition/declaration argument name mismatches. NFCI.

AddCXXStdlibLibArgs args were using the names for the clang equivalent methods.

Silences cppcheck warnings.

3 years ago[LLDB] Fix SVE reginfo for sequential offset in g packet
Muhammad Omair Javaid [Tue, 17 Nov 2020 12:15:38 +0000 (17:15 +0500)]
[LLDB] Fix SVE reginfo for sequential offset in g packet

This moves in the direction of our effort to synchronize register descriptions
between LLDB and GDB xml description. We want to able to send registers in a
way that their offset fields can be re-constructed based on register sizes
in the increasing order of register number.

In context to Arm64 SVE, FPCR and FPSR are same registers in FPU regset and
SVE regset. Previously FPSR/FPCR offset was set at the end of SVE data
because Linux ptrace data placed FPCR and FPSR at the end of SVE register set.

Considering interoperability with other stubs like QEMU and that g packets
should generate register data in increasing order of register numbers. We
have to move FPCR/FPSR offset up to its original location according to
register numbering scheme of ARM64 registers with SVE registers included.

Reviewed By: labath

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

3 years agoEscape command line arguments in backtraces
Luke Drummond [Wed, 4 Nov 2020 12:10:25 +0000 (12:10 +0000)]
Escape command line arguments in backtraces

A common routine is to have the compiler crash, and attempt to rerun the
cc1 command-line by copying and pasting the arguments printed by
`llvm::Support::PrettyStackProgram::print`. However, these arguments are
not quoted or escaped which means they must be manually edited before
working correctly. This patch ensures that shell-unfriendly characters
are C-escaped, and arguments with spaces are double-quoted reducing the
frustration of running cc1 inside a debugger.

As the quoting is C, this is "best effort for most shells", but should
be fine for at least bash, zsh, csh, and cmd.exe.

Reviewed by: jhenderson

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

3 years ago[LLDB] Update SVE Z reg info to remove invalidate regs
Muhammad Omair Javaid [Tue, 17 Nov 2020 12:11:42 +0000 (17:11 +0500)]
[LLDB] Update SVE Z reg info to remove invalidate regs

In our recent discussion we are aiming to make LLDB registers exchange minimum
possible information in qRegisterInfo or XMl register descriptions.
For SVE registers, Z registers are catagorized as primary registers and should
not have any infomration about any pseudo registers. All pseudo registers
should have the information on which primary register they belong to.
This patch removes invalidate_regs list from Z registers and will mitigate its
impact on SVE resize patch in a follow up update.

Reviewed By: labath

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

3 years ago[AsmPrinter] Use getMnemonic for instruction-mix remark.
Florian Hahn [Tue, 17 Nov 2020 11:53:01 +0000 (11:53 +0000)]
[AsmPrinter] Use getMnemonic for instruction-mix remark.

This patch uses the new `getMnemonic` helper from D90039
to display mnemonics instead of the internal opcodes.

The main motivation behind using the mnemonics is that they
are more user-friendly and more directly related to the assembly
the users will be presented.

Reviewed By: paquette

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

3 years ago[OpenCL] Stop opencl-c-base.h leaking extension enabling
Sven van Haastregt [Tue, 17 Nov 2020 12:07:40 +0000 (12:07 +0000)]
[OpenCL] Stop opencl-c-base.h leaking extension enabling

opencl-c.h disables all extensions at its end, but opencl-c-base.h
does not, and that causes any inclusion of only opencl-c-base.h to
leave some extensions (such as cl_khr_fp16) enabled.  This affects the
-fdeclare-opencl-builtins option for example.

This violates the OpenCL Extension Specification which specifies that
"The initial state of the compiler is as if the directive #pragma
OPENCL EXTENSION all : disable was issued".

Fix by disabling all extensions at the end of opencl-c-base.h and
enable extensions inside opencl.h which relied on opencl-c-base.h
enabling the cl_khr_fp16/64 extensions.

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

3 years ago[build] Fix dependencies of LLVMExegesis
Serge Guelton [Tue, 17 Nov 2020 11:15:02 +0000 (06:15 -0500)]
[build] Fix dependencies of LLVMExegesis

3 years ago[mlir] Add basic support for attributes in ODS-generated Python bindings
Alex Zinenko [Mon, 16 Nov 2020 15:17:03 +0000 (16:17 +0100)]
[mlir] Add basic support for attributes in ODS-generated Python bindings

In ODS, attributes of an operation can be provided as a part of the "arguments"
field, together with operands. Such attributes are accepted by the op builder
and have accessors generated.

Implement similar functionality for ODS-generated op-specific Python bindings:
the `__init__` method now accepts arguments together with operands, in the same
order as in the ODS `arguments` field; the instance properties are introduced
to OpView classes to access the attributes.

This initial implementation accepts and returns instances of the corresponding
attribute class, and not the underlying values since the mapping scheme of the
value types between C++, C and Python is not yet clear. Default-valued
attributes are not supported as that would require Python to be able to parse
C++ literals.

Since attributes in ODS are tightely related to the actual C++ type system,
provide a separate Tablegen file with the mapping between ODS storage type for
attributes (typically, the underlying C++ attribute class), and the
corresponding class name. So far, this might look unnecessary since all names
match exactly, but this is not necessarily the cases for non-standard,
out-of-tree attributes, which may also be placed in non-default namespaces or
Python modules. This also allows out-of-tree users to generate Python bindings
without having to modify the bindings generator itself. Storage type was
preferred over the Tablegen "def" of the attribute class because ODS
essentially encodes attribute _constraints_ rather than classes, e.g. there may
be many Tablegen "def"s in the ODS that correspond to the same attribute type
with additional constraints

The presence of the explicit mapping requires the change in the .td file
structure: instead of just calling the bindings generator directly on the main
ODS file of the dialect, it becomes necessary to create a new file that
includes the main ODS file of the dialect and provides the mapping for
attribute types. Arguably, this approach offers better separability of the
Python bindings in the build system as the main dialect no longer needs to know
that it is being processed by the bindings generator.

Reviewed By: stellaraccident

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

3 years ago[clang-tidy] Fix an abseil-redundant-strcat-calls crash on 0-parameter StrCat().
Haojian Wu [Tue, 17 Nov 2020 09:26:44 +0000 (10:26 +0100)]
[clang-tidy] Fix an abseil-redundant-strcat-calls crash on 0-parameter StrCat().

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

3 years ago[VE] Add vbrd intrinsic instructions
Kazushi (Jam) Marukawa [Sat, 14 Nov 2020 20:55:02 +0000 (05:55 +0900)]
[VE] Add vbrd intrinsic instructions

Add vbrd intrinsic instructions and a regression test.

Reviewed By: simoll

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

3 years ago[AVR] Optimize the 16-bit NEGW pseudo instruction
Ben Shi [Tue, 17 Nov 2020 09:51:58 +0000 (17:51 +0800)]
[AVR] Optimize the 16-bit NEGW pseudo instruction

Reviewed By: dylanmckay

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

3 years ago[AsmWriter] Factor out mnemonic generation to accessible getMnemonic.
Florian Hahn [Tue, 17 Nov 2020 09:38:17 +0000 (09:38 +0000)]
[AsmWriter] Factor out mnemonic generation to accessible getMnemonic.

This patch factors out the part of printInstruction that gets the
mnemonic string for a given MCInst. This is intended to be used
subsequently for the instruction-mix remarks to display the final
mnemonic (D90040).

Unfortunately making `getMnemonic` available to the AsmPrinter
seems to require making it virtual. Not sure if there's a way around
that with the current layering of the AsmPrinters.

Reviewed By: Paul-C-Anagnostopoulos

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

3 years ago[build] normalize components dependencies
serge-sans-paille [Fri, 13 Nov 2020 21:45:55 +0000 (22:45 +0100)]
[build] normalize components dependencies

Use LINK_COMPONENTS instead of explicit target_link_libraries for components.
This avoids redundancy and potential inconsistencies.

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

3 years ago[PowerPC] Add negated abs test using llvm.abs intrinsic. NFC.
Kai Luo [Tue, 17 Nov 2020 09:28:56 +0000 (09:28 +0000)]
[PowerPC] Add negated abs test using llvm.abs intrinsic. NFC.

3 years ago[clang-tidy] Verify the fixes in abseil-redundant-strcat-calls test, NFC
Haojian Wu [Tue, 17 Nov 2020 09:15:29 +0000 (10:15 +0100)]
[clang-tidy] Verify the fixes in abseil-redundant-strcat-calls test, NFC

3 years ago[mlir][NFC] Remove references to Module.h and Function.h
River Riddle [Tue, 17 Nov 2020 08:38:10 +0000 (00:38 -0800)]
[mlir][NFC] Remove references to Module.h and Function.h

These includes have been deprecated in favor of BuiltinDialect.h, which contains the definitions of ModuleOp and FuncOp.

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

3 years ago[mlir][IR] Use tablegen for the BuiltinDialect and operations
River Riddle [Tue, 17 Nov 2020 08:37:14 +0000 (00:37 -0800)]
[mlir][IR] Use tablegen for the BuiltinDialect and operations

This has been a long standing TODO, and cleans up a bit of IR/. This will also make it easier to move FuncOp out of IR/ at some point in the future. For now, Module.h and Function.h just forward BuiltinDialect.h. These files will be removed in a followup.

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

3 years ago[Driver] Quote executable in reports generated by -fproc-stat-report
Serge Pavlov [Tue, 17 Nov 2020 05:46:13 +0000 (12:46 +0700)]
[Driver] Quote executable in reports generated by -fproc-stat-report

The option -fproc-stat-report=<file> makes driver to generate child
process resource comsumption report. In the report executable name was
not quoted and it made parsing the report more difficult. With this
change the executable name is surrounded by quotation marks.

3 years ago[JumpThreading] Fix branch probabilities in DuplicateCondBranchOnPHIIntoPred()
Yevgeny Rouban [Tue, 17 Nov 2020 07:24:50 +0000 (14:24 +0700)]
[JumpThreading] Fix branch probabilities in DuplicateCondBranchOnPHIIntoPred()

When instructions are cloned from block BB to PredBB in the method
DuplicateCondBranchOnPHIIntoPred() number of successors of PredBB
changes from 1 to number of successors of BB. So we have to copy
branch probabilities from BB to PredBB.

Reviewed By: Kazu Hirata

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

3 years ago[Test] Add one more elaborate test with LCSSA users
Max Kazantsev [Tue, 17 Nov 2020 07:36:51 +0000 (14:36 +0700)]
[Test] Add one more elaborate test with LCSSA users

3 years ago[crashlog] Improve patch-crashlog.py script
Jonas Devlieghere [Tue, 17 Nov 2020 07:26:35 +0000 (23:26 -0800)]
[crashlog] Improve patch-crashlog.py script

Compute the real addresses and offsets for the json crashlog test.

3 years ago[NFC] Collect ext users into vector instead of finding them twice
Max Kazantsev [Tue, 17 Nov 2020 07:00:37 +0000 (14:00 +0700)]
[NFC] Collect ext users into vector instead of finding them twice

3 years ago[NPM] Add remaining test of -slsr
Ta-Wei Tu [Tue, 17 Nov 2020 06:40:44 +0000 (14:40 +0800)]
[NPM] Add remaining test of -slsr

Add RUN lines for NPM of -slsr tests that require -separate-const-offset-from-gep

Reviewed By: aeubanks

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

3 years ago[NFC] Add const qualifier to isEmpty()
Ta-Wei Tu [Tue, 17 Nov 2020 06:39:33 +0000 (14:39 +0800)]
[NFC] Add const qualifier to isEmpty()

Reviewed By: aeubanks

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