platform/upstream/llvm.git
3 years ago[mlir][Affine] Add support for multi-store producer fusion
Diego Caballero [Wed, 20 Jan 2021 22:41:51 +0000 (00:41 +0200)]
[mlir][Affine] Add support for multi-store producer fusion

This patch adds support for producer-consumer fusion scenarios with
multiple producer stores to the AffineLoopFusion pass. The patch
introduces some changes to the producer-consumer algorithm, including:

* For a given consumer loop, producer-consumer fusion iterates over its
producer candidates until a fixed point is reached.

* Producer candidates are gathered beforehand for each iteration of the
consumer loop and visited in reverse program order (not strictly guaranteed)
to maximize the number of loops fused per iteration.

In general, these changes were needed to simplify the multi-store producer
support and remove some of the workarounds that were introduced in the past
to support more fusion cases under the single-store producer limitation.

This patch also preserves the existing functionality of AffineLoopFusion with
one minor change in behavior. Producer-consumer fusion didn't fuse scenarios
with escaping memrefs and multiple outgoing edges (from a single store).
Multi-store producer scenarios will usually (always?) have multiple outgoing
edges so we couldn't fuse any with escaping memrefs, which would greatly limit
the applicability of this new feature. Therefore, the patch enables fusion for
these scenarios. Please, see modified tests for specific details.

Reviewed By: andydavis1, bondhugula

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

3 years ago[SampleFDO] Report error when reading a bad/incompatible profile instead of
Wei Mi [Fri, 22 Jan 2021 23:09:21 +0000 (15:09 -0800)]
[SampleFDO] Report error when reading a bad/incompatible profile instead of
turning off SampleFDO silently.

Currently sample loader pass turns off SampleFDO optimization silently when
it sees error in reading the profile. This behavior will defeat the tests
which could have caught those bad/incompatible profile problems. This patch
change the behavior to report error.

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

3 years ago[lld] Consistent help text for `--save-temps`
Sam Clegg [Mon, 18 Jan 2021 19:39:28 +0000 (11:39 -0800)]
[lld] Consistent help text for `--save-temps`

I noticed that this option was not appearing at all in the `--help`
messages for `wasm-ld` or `ld.lld`.

Add help text and make it consistent across all ports.

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

3 years ago[PowerPC] Add missing negate for VPERMXOR on little endian subtargets
Nemanja Ivanovic [Mon, 25 Jan 2021 18:22:19 +0000 (12:22 -0600)]
[PowerPC] Add missing negate for VPERMXOR on little endian subtargets

This intrinsic is supposed to have the permute control vector complemented on
little endian systems (as the ABI specifies and GCC implements). With the
current code gen, the result vector is byte-reversed.

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

3 years ago[mlir] Use more C99 comments in C API header files
Alex Zinenko [Mon, 25 Jan 2021 14:22:16 +0000 (15:22 +0100)]
[mlir] Use more C99 comments in C API header files

These were left over from the original reformatting commit.

Reviewed By: stellaraccident

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

3 years ago[clang] Add -fprofile-prefix-map
Keith Smiley [Mon, 25 Jan 2021 18:03:07 +0000 (10:03 -0800)]
[clang] Add -fprofile-prefix-map

This flag allows you to re-write absolute paths in coverage data analogous to -fdebug-prefix-map. This flag is also implied by -ffile-prefix-map.

3 years ago[libc++] [P0879] constexpr std::reverse, partition, *_permutation.
Arthur O'Dwyer [Thu, 17 Dec 2020 05:01:08 +0000 (00:01 -0500)]
[libc++] [P0879] constexpr std::reverse, partition, *_permutation.

After this patch, the only parts of P0879 that remain missing will be
std::nth_element, std::sort, and the heap/partial_sort algorithms.

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

3 years ago[Sema] Fix an assertion failure in -Wcompletion-handler
Erik Pilkington [Mon, 25 Jan 2021 15:53:25 +0000 (10:53 -0500)]
[Sema] Fix an assertion failure in -Wcompletion-handler

NamedDecl::getName() was being called on a constructor.

3 years ago[libc++] Implement [P0769] "Add shift to algorithm" (shift_left, shift_right)
Arthur O'Dwyer [Sat, 26 Dec 2020 06:39:03 +0000 (01:39 -0500)]
[libc++] Implement [P0769] "Add shift to algorithm" (shift_left, shift_right)

I believe this is a complete implementation of std::shift_left and std::shift_right from
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0769r2.pdf

Some test cases copied-with-modification from D60027.

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

3 years ago[clang-format] add case aware include sorting
Lukas Barth [Mon, 25 Jan 2021 17:37:54 +0000 (18:37 +0100)]
[clang-format] add case aware include sorting

* Adds an option to [clang-format] which sorts
  headers in an alphabetical manner using case
  only for tie-breakers. The options is off by
  default in favor of the current ASCIIbetical
  sorting style.

Reviewed By: curdeius, HazardyKnusperkeks

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

3 years ago[ARM] Use half directly for args/return types in test. NFC
David Green [Mon, 25 Jan 2021 17:50:19 +0000 (17:50 +0000)]
[ARM] Use half directly for args/return types in test. NFC

Until fairly recently the calling convention for IR half was not handled
correctly in the ARM backend, meaning we needed to pass pointers that
were loaded/stored. Now that that is fixed we can switch to using the
type directly instead.

3 years ago[OpenMP][NFC] Fix SourceInfo.h variable names
Joseph Huber [Mon, 25 Jan 2021 17:07:09 +0000 (12:07 -0500)]
[OpenMP][NFC] Fix SourceInfo.h variable names

Summary:
Fix the names to use Pascal case to comply with the LLVM coding guidelines. `ident_t` is required for compatibility with the rest of libomp.

3 years ago[RISCV] Use sign extend for i32 arguments and returns in makeLibCall on RV64.
Craig Topper [Mon, 25 Jan 2021 17:16:45 +0000 (09:16 -0800)]
[RISCV] Use sign extend for i32 arguments and returns in makeLibCall on RV64.

As far as I know 32 bits arguments and returns on RV64 are always
sign extended to i64. So I think we should be taking this into
account around libcalls.

Reviewed By: luismarques

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

3 years ago[libc++][doc] Update the release notes.
Mark de Wever [Fri, 22 Jan 2021 18:03:14 +0000 (19:03 +0100)]
[libc++][doc] Update the release notes.

Updates the libc++ release notes with the changes since the last
release.

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

3 years ago[scudo][standalone] Enable death tests on Fuchsia
Kostya Kortchinsky [Sat, 9 Jan 2021 16:40:17 +0000 (08:40 -0800)]
[scudo][standalone] Enable death tests on Fuchsia

zxtest doesn't have `EXPECT_DEATH` and the Scudo unit-tests were
defining it as a no-op.

This enables death tests on Fuchsia by using `ASSERT_DEATH` instead.
I used a lambda to wrap the expressions as this appears to not be
working the same way as `EXPECT_DEATH`.

Additionnally, a death test using `alarm` was failing with the change,
as it's currently not implemented in Fuchsia, so move that test within
a `!SCUDO_FUCHSIA` block.

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

3 years ago[OpenCL] Refactor of targets OpenCL option settings
Anton Zabaznov [Mon, 25 Jan 2021 16:23:58 +0000 (19:23 +0300)]
[OpenCL] Refactor of targets OpenCL option settings

Currently, there is some refactoring needed in existing interface of OpenCL option
settings to support OpenCL C 3.0. The problem is that OpenCL extensions and features
are not only determined by the target platform but also by the OpenCL version.
Also, there are core extensions/features which are supported unconditionally in
specific OpenCL C version. In fact, these rules are not being followed for all targets.
For example, there are some targets (as nvptx and r600) which don't support
OpenCL C 2.0 core features (nvptx.languageOptsOpenCL.cl, r600.languageOptsOpenCL.cl).

After the change there will be explicit differentiation between optional core and core
OpenCL features which allows giving diagnostics if target doesn't support any of
necessary core features for specific OpenCL version.

This patch also eliminates `OpenCLOptions` instance duplication from `TargetOptions`.
`OpenCLOptions` instance should take place in `Sema` as it's going to be modified
during parsing. Removing this duplication will also allow to generally simplify
`OpenCLOptions` class for parsing purposes.

Reviewed By: Anastasia

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

3 years agoRevert "Fix unused variable in CoroFrame.cpp when building Release with GCC 10"
Xun Li [Mon, 25 Jan 2021 16:37:18 +0000 (08:37 -0800)]
Revert "Fix unused variable in CoroFrame.cpp when building Release with GCC 10"

This reverts commit ff5e896425577f445ed080d88b582aab0896fba0.

3 years ago[libc++] Implement P0655R1 visit<R>: Explicit Return Type for visit
Ruslan Arutyunyan [Mon, 25 Jan 2021 16:12:25 +0000 (11:12 -0500)]
[libc++] Implement P0655R1 visit<R>: Explicit Return Type for visit

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

3 years ago[libomptarget] Compile with older cuda, revert D95274
Jon Chesterfield [Mon, 25 Jan 2021 16:12:56 +0000 (16:12 +0000)]
[libomptarget] Compile with older cuda, revert D95274

[libomptarget] Compile with older cuda, revert D95274

Fixes regression reported in comments of D95274.

Reviewed By: jdoerfert

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

3 years ago[AMDGPU][MC] Improved errors handling for SDWA operands
Dmitry Preobrazhensky [Mon, 25 Jan 2021 16:01:19 +0000 (19:01 +0300)]
[AMDGPU][MC] Improved errors handling for SDWA operands

Reviewers: rampitec

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

3 years agoRevert "[JITLink] Enable exception handling for ELF."
Nico Weber [Mon, 25 Jan 2021 16:00:38 +0000 (11:00 -0500)]
Revert "[JITLink] Enable exception handling for ELF."

This reverts commit 6884fbc2c4fb46d0528c02d16d510f4f725fac11.
Breaks tests on Windows: http://45.33.8.238/win/31981/step_11.txt

3 years ago[LLDB] Skip TestPlatformProcessConnect on arm/aarch64 buildbot
Muhammad Omair Javaid [Mon, 25 Jan 2021 15:29:22 +0000 (20:29 +0500)]
[LLDB] Skip TestPlatformProcessConnect on arm/aarch64 buildbot

TestPlatformProcessConnect is randomly failing on LLDB Arm/AArch64
buildbot. I am disabling it temporarily untill problem is fixed.

3 years ago[LLDB] Define AUXV_AT_HWCAP2 in AuxVector.h
Muhammad Omair Javaid [Mon, 25 Jan 2021 12:04:38 +0000 (17:04 +0500)]
[LLDB] Define AUXV_AT_HWCAP2 in AuxVector.h

This patch defines AUXV_AT_HWCAP2 for accessing Aux extensions.

3 years ago[LLDB] Remove leftovers and typos from RegisterInfos_arm64_sve.h
Muhammad Omair Javaid [Mon, 25 Jan 2021 11:41:24 +0000 (16:41 +0500)]
[LLDB] Remove leftovers and typos from RegisterInfos_arm64_sve.h

This patch removes a couple of left-overs and a typo from
RegisterInfos_arm64_sve.h and RegisterInfoPOSIX_arm64.h.

3 years ago[Verifier] disable llvm.experimental.noalias.scope.decl dominance check.
Jeroen Dobbelaere [Mon, 25 Jan 2021 15:40:01 +0000 (16:40 +0100)]
[Verifier] disable llvm.experimental.noalias.scope.decl dominance check.

This was enabled in https://reviews.llvm.org/D95335 but it breaks the stage2 fuchsia build
(See http://lab.llvm.org:8011/#/builders/98/builds/4105/steps/9/logs/stdio)

3 years ago[X86][AVX] Generalize vperm2f128/vperm2i128 patterns to support all legal 256-bit...
Simon Pilgrim [Mon, 25 Jan 2021 14:48:40 +0000 (14:48 +0000)]
[X86][AVX] Generalize vperm2f128/vperm2i128 patterns to support all legal 256-bit vector types

Remove bitcasts to/from v4x64 types through vperm2f128/vperm2i128 ops to help improve shuffle combining and demanded vector elts folding.

3 years ago[Verifier] enable and limit llvm.experimental.noalias.scope.decl dominance checking
Jeroen Dobbelaere [Mon, 25 Jan 2021 15:19:12 +0000 (16:19 +0100)]
[Verifier] enable and limit llvm.experimental.noalias.scope.decl dominance checking

Checking the llvm.experimental.noalias.scope.decl dominance can be worstcase O(N^2).
Limit the dominance check to N=32.

Reviewed By: fhahn

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

3 years ago[clangd] Allow diagnostics to be suppressed with configuration
Sam McCall [Mon, 25 Jan 2021 13:03:13 +0000 (14:03 +0100)]
[clangd] Allow diagnostics to be suppressed with configuration

This has been specifically requested:
  https://github.com/clangd/vscode-clangd/issues/114
and various issues can be addressed with this as a workaround, e.g.:
  https://github.com/clangd/clangd/issues/662

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

3 years ago[clangd] Fix a crash when indexing invalid ObjC method declaration
Adam Czachorowski [Mon, 18 Jan 2021 17:17:52 +0000 (18:17 +0100)]
[clangd] Fix a crash when indexing invalid ObjC method declaration

This fix will make us not crash, but ideally we would handle this case
better.

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

3 years ago[Doc][NFC] Fix Kaleidoscope links, typos and add blog posts for MCJIT
xgupta [Mon, 25 Jan 2021 14:28:03 +0000 (19:58 +0530)]
[Doc][NFC] Fix Kaleidoscope links, typos and add blog posts for MCJIT

3 years ago[VPlan] Handle scalarized values in VPTransformState.
Florian Hahn [Mon, 25 Jan 2021 11:17:56 +0000 (11:17 +0000)]
[VPlan] Handle scalarized values in VPTransformState.

This patch adds plumbing to handle scalarized values directly in
VPTransformState.

Reviewed By: gilr

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

3 years ago[mlir] Generalize OpFoldResult usage in ops with offsets, sizes and operands.
Nicolas Vasilache [Mon, 25 Jan 2021 14:16:01 +0000 (14:16 +0000)]
[mlir] Generalize OpFoldResult usage in ops with offsets, sizes and operands.

This revision starts evolving the APIs to manipulate ops with offsets, sizes and operands towards a ValueOrAttr abstraction that is already used in folding under the name OpFoldResult.

The objective, in the future, is to allow such manipulations all the way to the level of ODS to avoid all the genuflexions involved in distinguishing between values and attributes for generic constant foldings.

Once this evolution is accepted, the next step will be a mechanical OpFoldResult -> ValueOrAttr.

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

3 years ago[NFC] Fix title comment typo and provide description for LLJIT example.
xgupta [Mon, 25 Jan 2021 14:08:32 +0000 (19:38 +0530)]
[NFC] Fix title comment typo and provide description for LLJIT example.

3 years ago[mlir][Linalg] Fix incorrect erase order
Nicolas Vasilache [Mon, 25 Jan 2021 14:04:06 +0000 (14:04 +0000)]
[mlir][Linalg] Fix incorrect erase order

3 years ago[clang] Fix a nullptr dereference bug on invalid code
Adam Czachorowski [Thu, 21 Jan 2021 16:51:13 +0000 (17:51 +0100)]
[clang] Fix a nullptr dereference bug on invalid code

When working with invalid code, we would try to dereference a nullptr
while deducing template arguments in some dependend code operating on a
lambda with invalid return type.

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

3 years ago[mlir][Linalg] Address missed review item
Nicolas Vasilache [Mon, 25 Jan 2021 13:41:50 +0000 (13:41 +0000)]
[mlir][Linalg] Address missed review item

This revision addresses a remaining comment that was overlooked in https://reviews.llvm.org/D95243:
the pad hoisting transformation is made to additionally bail out on side effecting ops other than LoopLikeOps.

3 years ago[X86][AVX] combineX86ShuffleChainWithExtract - widen to at least original root size...
Simon Pilgrim [Mon, 25 Jan 2021 13:45:19 +0000 (13:45 +0000)]
[X86][AVX] combineX86ShuffleChainWithExtract - widen to at least original root size. NFCI.

We're relying on the source inputs for shuffle combining having already been widened to the root size (otherwise the offset logic falls over) - we're going to be supporting different sized shuffle inputs soon, so we need to explicitly make the minimum widened width the original root size.

3 years agoRevert "[SystemZ][z/OS] Fix No such file or directory expression error"
Abhina Sreeskantharajan [Mon, 25 Jan 2021 13:02:41 +0000 (08:02 -0500)]
Revert "[SystemZ][z/OS] Fix No such file or directory expression error"

This reverts commit 06f8a49693957bc27b83e0ab5f429ff874941a07.

3 years agoRevert "[SystemZ][z/OS] Fix No such file or directory expression error matching in...
Abhina Sreeskantharajan [Mon, 25 Jan 2021 13:02:27 +0000 (08:02 -0500)]
Revert "[SystemZ][z/OS] Fix No such file or directory expression error matching in lit tests - continued"

This reverts commit 520b5ecf856152f35ee38207eec39f5674dd2bd4.

3 years agoAdd a --use-color option to clang-query to allow forcing the behavior
Tom Ritter [Mon, 25 Jan 2021 13:06:54 +0000 (08:06 -0500)]
Add a --use-color option to clang-query to allow forcing the behavior

D62056 makes the output color if clang auto-detects a tty, but if it
does not, there is no way to force it to use colors anyway.

This patch adjusts the command-lines given to ClangTool which will
force color on or off if --use-color is specified.

3 years ago[InstCombine] narrow min/max intrinsics with extended inputs
Sanjay Patel [Sun, 24 Jan 2021 17:57:11 +0000 (12:57 -0500)]
[InstCombine] narrow min/max intrinsics with extended inputs

We can sink extends after min/max if they match and would
not change the sign-interpreted compare. The only combo
that doesn't work is zext+smin/smax because the zexts
could change a negative number into positive:
https://alive2.llvm.org/ce/z/D6sz6J

Sext+umax/umin works:

  define i32 @src(i8 %x, i8 %y) {
  %0:
    %sx = sext i8 %x to i32
    %sy = sext i8 %y to i32
    %m = umax i32 %sx, %sy
    ret i32 %m
  }
  =>
  define i32 @tgt(i8 %x, i8 %y) {
  %0:
    %m = umax i8 %x, %y
    %r = sext i8 %m to i32
    ret i32 %r
  }
  Transformation seems to be correct!

3 years ago[InstCombine] add tests for min/max intrinsics with extended values; NFC
Sanjay Patel [Sun, 24 Jan 2021 17:37:38 +0000 (12:37 -0500)]
[InstCombine] add tests for min/max intrinsics with extended values; NFC

3 years agoRevert "[clang] Fix signedness in vector bitcast evaluation"
Sven van Haastregt [Mon, 25 Jan 2021 12:43:30 +0000 (12:43 +0000)]
Revert "[clang] Fix signedness in vector bitcast evaluation"

This reverts commit 14947cd04701d923a57a0161fd1967b81e00ff5e because
it broke clang-cmake-armv7-quick.

3 years ago[mlir][Linalg] Add a hoistPaddingOnTensors transformation
Nicolas Vasilache [Mon, 25 Jan 2021 11:48:39 +0000 (11:48 +0000)]
[mlir][Linalg] Add a hoistPaddingOnTensors transformation

This transformation anchors on a padding op whose result is only used as an input
to a Linalg op and pulls it out of a given number of loops.
The result is a packing of padded tailes of ops that is amortized just before
the outermost loop from which the pad operation is hoisted.

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

3 years ago[flang][driver] Update PP tests to use the new driver
Faris Rehman [Mon, 25 Jan 2021 12:07:17 +0000 (12:07 +0000)]
[flang][driver] Update PP tests to use the new driver

Update the preprocessor regression tests to use the new driver if the new driver is built (FLANG_BUILD_NEW_DRIVER=On), otherwise the tests will still run using f18.

Summary of changes:
- Introduce %flang to the regression tests, which points to the new driver if it is built or otherwise points to f18
- Update all tests in flang/test/Preprocessing/ to use %flang

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

3 years ago[SLPVectorizer] NFC: Migrate getVectorCallCosts to use InstructionCost.
Sander de Smalen [Wed, 20 Jan 2021 09:10:24 +0000 (09:10 +0000)]
[SLPVectorizer] NFC: Migrate getVectorCallCosts to use InstructionCost.

This change also changes getReductionCost to return InstructionCost,
and it simplifies two expressions by removing a redundant 'isValid' check.

3 years ago[X86][AVX] LowerTRUNCATE - avoid bitcasts around extract_subvectors.
Simon Pilgrim [Mon, 25 Jan 2021 12:10:12 +0000 (12:10 +0000)]
[X86][AVX] LowerTRUNCATE - avoid bitcasts around extract_subvectors.

We allow extract_subvector lowering of all legal types, so pre-bitcast the source type to try and reduce bitcast pollution.

3 years ago[clang] Fix signedness in vector bitcast evaluation
Sven van Haastregt [Mon, 25 Jan 2021 12:01:42 +0000 (12:01 +0000)]
[clang] Fix signedness in vector bitcast evaluation

The included test case triggered a sign assertion on the result in
`Success()`.  This was caused by the APSInt created for a bitcast
having its signedness bit inverted.  The second APSInt constructor
argument is `isUnsigned`, so invert the result of
`isSignedIntegerType`.

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

3 years ago[flang][driver] Remove newline in CompilerInvocation
Faris Rehman [Mon, 25 Jan 2021 11:58:52 +0000 (11:58 +0000)]
[flang][driver] Remove newline in CompilerInvocation

Remove a new line in CompilerInvocation, to now follow the style when clang-format is applied.

3 years ago[X86][AVX] combineX86ShuffleChain - avoid bitcasts around insert_subvector() shuffle...
Simon Pilgrim [Mon, 25 Jan 2021 11:10:17 +0000 (11:10 +0000)]
[X86][AVX] combineX86ShuffleChain - avoid bitcasts around insert_subvector() shuffle patterns.

We allow insert_subvector lowering of all legal types, so don't always cast to the vXi64/vXf64 shuffle types - this is only necessary for X86ISD::SHUF128/X86ISD::VPERM2X128 patterns later.

3 years ago[TableGen] RuleMatcher::defineComplexSubOperand avoid std::string copy. NFCI.
Simon Pilgrim [Sat, 23 Jan 2021 18:01:12 +0000 (18:01 +0000)]
[TableGen] RuleMatcher::defineComplexSubOperand avoid std::string copy. NFCI.

Use const reference to avoid std::string copy - accordingly to the style guide we shouldn't be using auto anyway.

Fixes MSVC analyzer warning.

3 years ago[InstructionCost] Prevent InstructionCost being created with CostState.
Sander de Smalen [Thu, 21 Jan 2021 16:37:09 +0000 (16:37 +0000)]
[InstructionCost] Prevent InstructionCost being created with CostState.

For a function that returns InstructionCost, it is very tempting to write:

  return InstructionCost::Invalid;

But that actually returns InstructionCost(1 /* int value of Invalid */))
which has a totally different meaning. By marking this constructor as
`delete`, this can no longer happen.

3 years ago[OpenCL][Docs] Describe tablegen BIFs declarations.
Anastasia Stulova [Mon, 25 Jan 2021 11:17:03 +0000 (11:17 +0000)]
[OpenCL][Docs] Describe tablegen BIFs declarations.

Added documentation for the fast builtin
function declarations with -fdeclare-opencl-builtins.

Tags: #clang

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

3 years ago[SelectionDAG] Support scalable-vector splats in more cases
Fraser Cormack [Fri, 8 Jan 2021 09:32:15 +0000 (09:32 +0000)]
[SelectionDAG] Support scalable-vector splats in more cases

This patch adds support for scalable-vector splats in DAGCombiner's
`isConstantOrConstantVector` and `ISD::matchUnaryPredicate` functions,
which enable the SelectionDAG div/rem-by-constant optimizations for
scalable vector types.

It also fixes up one case where the UDIV optimization was generating a
SETCC without first consulting the target for its preferred SETCC result
type.

Reviewed By: craig.topper

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

3 years ago[llvm-dwp] Automatically set the target triple
Philip Pfaffe [Mon, 25 Jan 2021 10:05:13 +0000 (11:05 +0100)]
[llvm-dwp] Automatically set the target triple

The llvm-dwp tool hard-codes the target triple to x86. Instead, deduce the
target triple from the object files being read.

Reviewed By: dblaikie

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

3 years ago[mlir] Perfectly forward ImplicitLocOpBuilder ctors to OpBuilder
Benjamin Kramer [Mon, 25 Jan 2021 10:48:58 +0000 (11:48 +0100)]
[mlir] Perfectly forward ImplicitLocOpBuilder ctors to OpBuilder

This is both cleaner and less prone to creating a mess out of overload
resolution.

3 years ago[ObjectYAML] - An attempt to fix BB after commit of D95140.
Georgii Rymar [Mon, 25 Jan 2021 10:23:58 +0000 (13:23 +0300)]
[ObjectYAML] - An attempt to fix BB after commit of D95140.

D95140 introduced `static constexpr StringRef TypeStr = "SectionHeaderTable";` member
of `SectionHeaderTable` with in-class initialized. BB reports the link error:

/usr/bin/ld: lib/libLLVMObjectYAML.a(ELFYAML.cpp.o): in function
`llvm::yaml::MappingTraits<std::unique_ptr<llvm::ELFYAML::Chunk, std::default_delete<llvm::ELFYAML::Chunk> > >::mapping(llvm::yaml::IO&, std::unique_ptr<llvm::ELFYAML::Chunk, std::default_delete<llvm::ELFYAML::Chunk> >&)':
ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x58): undefined reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'
/usr/bin/ld: ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x353):undefined reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'
/usr/bin/ld: ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x6e5): undefined reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'

This patch adds a definition to cpp file, I guess it should fix the issue.

3 years ago[clang] NFC: Remove else-after-return pattern from some files
Kirill Bobyrev [Mon, 25 Jan 2021 10:09:56 +0000 (11:09 +0100)]
[clang] NFC: Remove else-after-return pattern from some files

Follow-up on D95336. A bunch of these cases were found manually, the
rest made sense to be included to eliminate llvm-else-after-return
Clang-Tidy warnings.

3 years ago[yaml2obj, obj2yaml] - Implement section header table as a special Chunk.
Georgii Rymar [Tue, 19 Jan 2021 14:02:08 +0000 (17:02 +0300)]
[yaml2obj, obj2yaml] - Implement section header table as a special Chunk.

This was discussed in D93678 thread.
Currently we have one special chunk - Fill.

This patch re implements the "SectionHeaderTable" key to become a special chunk too.
With that we are able to place the section header table at any location,
just like we place sections.

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

3 years ago[clang-format] [docs] Fix RST indentation.
Marek Kurdej [Mon, 25 Jan 2021 09:59:47 +0000 (10:59 +0100)]
[clang-format] [docs] Fix RST indentation.

3 years ago[lld][ELF][test] Add testing for IE/LD TLS weak undef references
James Henderson [Thu, 21 Jan 2021 11:13:30 +0000 (11:13 +0000)]
[lld][ELF][test] Add testing for IE/LD TLS weak undef references

Whilst migrating/retiring some downstream testing, I came across a test
for weak undef IE and LD TLS references, but was unable to find any
equivalent in LLD's upstream testing. There does seem to be some slight
subtle differences that could be worth testing compared to LE TLS
references, in particular that IE can be relaxed to LE in this case,
hence this change.

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

Reviewed by: grimar, MaskRay

3 years ago[clang] NFC: Remove else if after return
Kirill Bobyrev [Mon, 25 Jan 2021 09:58:15 +0000 (10:58 +0100)]
[clang] NFC: Remove else if after return

Update the code to be compatible with LLVM Coding Guidelines.

Reviewed By: sammccall

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

3 years ago[mlir][Linalg] Add a padding option to Linalg tiling
Nicolas Vasilache [Mon, 25 Jan 2021 09:11:31 +0000 (09:11 +0000)]
[mlir][Linalg] Add a padding option to Linalg tiling

This revision allows the base Linalg tiling pattern to optionally require padding to
a constant bounding shape.
When requested, a simple analysis is performed, similar to buffer promotion.
A temporary `linalg.simple_pad` op is added to model padding for the purpose of
connecting the dots. This will be replaced by a more fleshed out `linalg.pad_tensor`
op when it is available.
In the meantime, this temporary op serves the purpose of exhibiting the necessary
properties required from a more fleshed out pad op, to compose with transformations
properly.

Reviewed By: ftynse

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

3 years ago[AArch64] Add Cortex CPU subtarget features for instruction fusion.
Sjoerd Meijer [Mon, 25 Jan 2021 08:48:04 +0000 (08:48 +0000)]
[AArch64] Add Cortex CPU subtarget features for instruction fusion.

This adds subtarget features for AES, literal, and compare and branch
instruction fusion for different Cortex CPUs.

Patch by: Cassie Jones.

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

3 years ago[RISCV] Add attribute support for all supported extensions
Simon Cook [Mon, 25 Jan 2021 08:58:53 +0000 (08:58 +0000)]
[RISCV] Add attribute support for all supported extensions

This adds support for ".attribute arch" for all extensions that are
currently supported by the compiler.

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

3 years ago[RISCV] Implement new architecture extension macros
Simon Cook [Mon, 25 Jan 2021 08:58:46 +0000 (08:58 +0000)]
[RISCV] Implement new architecture extension macros

This adds support for the new architecture extension test macros as
defined in the C-API Document:
https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md

Extension versions have been taken from what are used in
RISCVTargetStreamer for ratified extensions, and the -march parser
for experimental extensions.

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

3 years ago[libc++] Set CMAKE_FOLDER. NFC.
Marek Kurdej [Mon, 25 Jan 2021 08:50:03 +0000 (09:50 +0100)]
[libc++] Set CMAKE_FOLDER. NFC.

* This variable populates the default value of FOLDER target property. It is used in some IDE's (e.g. MSVC) to group different targets together.

3 years ago[XRay] Support DW_TAG_call_site and delete unneeded PATCHABLE_EVENT_CALL/PATCHABLE_TY...
Fangrui Song [Mon, 25 Jan 2021 08:49:18 +0000 (00:49 -0800)]
[XRay] Support DW_TAG_call_site and delete unneeded PATCHABLE_EVENT_CALL/PATCHABLE_TYPED_EVENT_CALL lowering

3 years ago[XRay] Make __xray_customevent support non-Linux
Fangrui Song [Mon, 25 Jan 2021 08:26:54 +0000 (00:26 -0800)]
[XRay] Make __xray_customevent support non-Linux

3 years agoFix a build-bot failure.
Haojian Wu [Mon, 25 Jan 2021 08:42:06 +0000 (09:42 +0100)]
Fix a build-bot failure.

The test ms-lookup-template-base-classes.cpp added in d972d4c749048531953a16b815e07c67e8455a3b
is failing on some builtbot that don't include x86.

This patch should fix that (following the patterns in the test directory).

3 years ago[clang-format] Add the possibility to align assignments spanning empty lines or comments
Lukas Barth [Mon, 25 Jan 2021 08:30:02 +0000 (09:30 +0100)]
[clang-format] Add the possibility to align assignments spanning empty lines or comments

Currently, empty lines and comments break alignment of assignments on consecutive
lines. This makes the AlignConsecutiveAssignments option an enum that allows controlling
whether empty lines or empty lines and comments should be ignored when aligning
assignments.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, tinloaf

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

3 years agoRevert "[clang-format] Add the possibility to align assignments spanning empty lines...
Marek Kurdej [Mon, 25 Jan 2021 08:40:46 +0000 (09:40 +0100)]
Revert "[clang-format] Add the possibility to align assignments spanning empty lines or comments"

This reverts commit f00a20e51c1d186e72844939aad10416e1cc99de.

3 years ago[clang-format] Add the possibility to align assignments spanning empty lines or comments
Marek Kurdej [Mon, 25 Jan 2021 08:30:02 +0000 (09:30 +0100)]
[clang-format] Add the possibility to align assignments spanning empty lines or comments

Currently, empty lines and comments break alignment of assignments on consecutive
lines. This makes the AlignConsecutiveAssignments option an enum that allows controlling
whether empty lines or empty lines and comments should be ignored when aligning
assignments.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, tinloaf

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

3 years agoRevert "[clang][AVR] Improve avr-ld command line options"
Ben Shi [Mon, 25 Jan 2021 08:33:58 +0000 (16:33 +0800)]
Revert "[clang][AVR] Improve avr-ld command line options"

This reverts commit 89a5147e5a0c2e886cdf7ffa34799c069d825940.

3 years ago[clang][cli] NFC: Pass CC1Option explicitly to BoolOption
Jan Svoboda [Mon, 25 Jan 2021 07:42:44 +0000 (08:42 +0100)]
[clang][cli] NFC: Pass CC1Option explicitly to BoolOption

When `Bool{F,G}Option` were introduced, they were designed after the existing `Opt{In,Out}FFlag` in that they implied `CC1Option` for the `ChangedBy` flag.

This means less typing, but can be misleading in situations when the `ResetBy` has explicit `CC1Option` and `ChangedBy` doesn't.

This patch stops implicitly putting `CC1Option` to `ChangedBy` flag.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] NFC: Move prefix to the front of BoolOption
Jan Svoboda [Mon, 25 Jan 2021 07:41:41 +0000 (08:41 +0100)]
[clang][cli] NFC: Move prefix to the front of BoolOption

The prefix used to be the last (optional) argument to BoolOption. This decision was made with the expectation that only few command line options would need to pass it explicitly instead of using Bool{F,G}Option. It turns out that a considerable number of options don't conform to Bool{F,G}Option and need to provide the prefix anyways. This sometimes requires to explicitly pass `BothFlags<[]>`.

This patch makes prefix the first parameter, so it now directly precedes the spelling base string. Now 8 options dropped `BothFlags<[]>` and only two options (`pthread` and `emit_llvm_uselists`) need to pass an empty prefix.

Reviewed By: dexonsmith

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

3 years ago[AArch64] Merge [US]MULL with half adds and subs into [US]ML[AS]L
Andre Vieira [Mon, 25 Jan 2021 07:55:13 +0000 (07:55 +0000)]
[AArch64] Merge [US]MULL with half adds and subs into [US]ML[AS]L

This patch adds patterns to teach the AArch64 backend to merge [US]MULL
instructions and adds/subs of half the size into [US]ML[AS]L where we don't use
the top half of the result.

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

3 years ago[JITLink] Enable exception handling for ELF.
Lang Hames [Mon, 25 Jan 2021 04:14:22 +0000 (15:14 +1100)]
[JITLink] Enable exception handling for ELF.

Adds the EHFrameSplitter and EHFrameEdgeFixer passes to the default JITLink
pass pipeline for ELF/x86-64, and teaches EHFrameEdgeFixer to handle some
new pointer encodings.

Together these changes enable exception handling (at least for the basic
cases that I've tested so far) for ELF/x86-64 objects loaded via JITLink.

3 years ago[NFC] [DAGCombine] Correct the result for sqrt even the iteration is zero
QingShan Zhang [Mon, 25 Jan 2021 04:00:32 +0000 (04:00 +0000)]
[NFC] [DAGCombine] Correct the result for sqrt even the iteration is zero

For now, we correct the result for sqrt if iteration > 0. This doesn't make
sense as they are not strict relative.

Reviewed By: dmgreen, spatel, RKSimon

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

3 years ago[clang][AVR] Improve avr-ld command line options
Ben Shi [Mon, 25 Jan 2021 04:01:26 +0000 (12:01 +0800)]
[clang][AVR] Improve avr-ld command line options

3 years ago[mlir][Python] Roll up of python API fixes.
Stella Laurenzo [Sun, 24 Jan 2021 22:46:56 +0000 (14:46 -0800)]
[mlir][Python] Roll up of python API fixes.

* As discussed, fixes the ordering or (operands, results) -> (results, operands) in various `create` like methods.
* Fixes a syntax error in an ODS accessor method.
* Removes the linalg example in favor of a test case that exercises the same.
* Fixes FuncOp visibility to properly use None instead of the empty string and defaults it to None.
* Implements what was documented for requiring that trailing __init__ args `loc` and `ip` are keyword only.
* Adds a check to `InsertionPoint.insert` so that if attempting to insert past the terminator, an exception is raised telling you what to do instead. Previously, this would crash downstream (i.e. when trying to print the resultant module).
* Renames `_ods_build_default` -> `build_generic` and documents it.
* Removes `result` from the list of prohibited words and for single-result ops, defaults to naming the result `result`, thereby matching expectations and what is already implemented on the base class.
* This was intended to be a relatively small set of changes to be inlined with the broader support for ODS generating the most specific builder, but it spidered out once actually testing various combinations, so rolling up separately.

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

3 years agolldb: Add support for printing variables with DW_AT_ranges on DW_TAG_subprograms
David Blaikie [Tue, 5 Jan 2021 06:48:54 +0000 (22:48 -0800)]
lldb: Add support for printing variables with DW_AT_ranges on DW_TAG_subprograms

Finishing out the support (to the best of my knowledge/based on current
testing running the whole check-lldb with a clang forcibly using
DW_AT_ranges on all DW_TAG_subprograms) for this feature.

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

3 years agoFix sign-comparison warnings in unit test EXPECTs
David Blaikie [Mon, 25 Jan 2021 02:38:16 +0000 (18:38 -0800)]
Fix sign-comparison warnings in unit test EXPECTs

3 years ago[PowerPC] support register pressure reduction in machine combiner.
Chen Zheng [Mon, 18 Jan 2021 04:53:33 +0000 (23:53 -0500)]
[PowerPC] support register pressure reduction in machine combiner.

Reassociating some patterns to generate more fma instructions to
reduce register pressure.

Reviewed By: jsji

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

3 years agoSuppress non-conforming GNU paste extension in all standard-conforming modes
Harald van Dijk [Mon, 25 Jan 2021 00:56:45 +0000 (00:56 +0000)]
Suppress non-conforming GNU paste extension in all standard-conforming modes

The GNU token paste extension that removes the comma in , ## __VA_ARGS__
conflicts with C99/C++11's requirements when a variadic macro has no
named parameters: according to the standard, an invocation as FOO()
gives it a single empty argument, and concatenation of anything with an
empty argument is well-defined. For this reason, the GNU extension was
already disabled in C99 standard-conforming mode. It was not yet
disabled in C++11 standard-conforming mode.

The associated comment suggested that GCC keeps this extension enabled
in C90/C++03 standard-conforming mode, but it actually does not, so
rather than adding a check for C++ language version, this change simply
removes the check for C language version.

Reviewed By: rsmith

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

3 years ago[AMDGPU] Fix llvm.amdgcn.init.exec and frame materialization
Carl Ritson [Sun, 24 Jan 2021 23:31:08 +0000 (08:31 +0900)]
[AMDGPU] Fix llvm.amdgcn.init.exec and frame materialization

Frame-base materialization may insert vector instructions before EXEC is initialised.
Fix this by moving lowering of llvm.amdgcn.init.exec later in backend.
Also remove SI_INIT_EXEC_LO pseudo as this is not necessary.

Reviewed By: ruiling

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

3 years ago[RISCV] Add support for Zvamo/Zvlsseg to driver
Simon Cook [Sun, 24 Jan 2021 22:07:33 +0000 (22:07 +0000)]
[RISCV] Add support for Zvamo/Zvlsseg to driver

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

3 years ago[RISCV] Use bitsLE instead of strict == MVT::i32 in assertsexti32 and assertzexti32.
Craig Topper [Sun, 24 Jan 2021 21:33:02 +0000 (13:33 -0800)]
[RISCV] Use bitsLE instead of strict == MVT::i32 in assertsexti32 and assertzexti32.

The patterns that use this really want to know if the operand has at
least 32 sign/zero bits.

This increases opportunities to use W instructions when the original
source used i8/i16. Not sure how much this matters for performance,
but it makes i8/i16 code more consistent with i32.

3 years ago[RISCV] Add test cases for missed opportunities to use *W instructions for div/rem...
Craig Topper [Sun, 24 Jan 2021 20:43:53 +0000 (12:43 -0800)]
[RISCV] Add test cases for missed opportunities to use *W instructions for div/rem when inputs are sign/zero extended from i8/16 instead of i32.

3 years ago[RISCV] Add test cases for missed opportunities to use fcvt.*.w(u) instructions on...
Craig Topper [Sun, 24 Jan 2021 19:23:25 +0000 (11:23 -0800)]
[RISCV] Add test cases for missed opportunities to use fcvt.*.w(u) instructions on RV64 when input is known to be extended from i8/i16.

3 years ago[ARM] Extra MVE unaligned VLDn tests. NFC
David Green [Sun, 24 Jan 2021 21:39:00 +0000 (21:39 +0000)]
[ARM] Extra MVE unaligned VLDn tests. NFC

3 years ago[RISCV] Fix name of Zba extension (NFC)
Simon Cook [Sun, 24 Jan 2021 21:01:49 +0000 (21:01 +0000)]
[RISCV] Fix name of Zba extension (NFC)

3 years agoImplement vAttachOrWait
Augusto Noronha [Sun, 24 Jan 2021 20:29:59 +0000 (21:29 +0100)]
Implement vAttachOrWait

Implements the required functions on gdb-remote so the '--include-existing' flag of process attach works correctly on Linux.

Reviewed By: labath, clayborg

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

3 years ago[lldb] Add -Wl,-rpath to make tests run with fresh built libc++
Fangrui Song [Sun, 24 Jan 2021 20:21:57 +0000 (20:21 +0000)]
[lldb] Add -Wl,-rpath to make tests run with fresh built libc++

On my Debian machine, system libc++/libc++abi is not installed (`libc++1-9 libc++abi-9`),
21 check-lldb-api tests fail because -stdlib=libc++ linked executables cannot
find runtime libc++.so.1 at runtime.

Use the `-Wl,-rpath,$(LLVM_LIBS_DIR)` mechanism in
`packages/Python/lldbsuite/test/make/Makefile.rules` (D58630 for NetBSD) to
allow such tests compile/link with fresh libc++ built beside lldb.
(A system libc++.so.1 is not guaranteed to match fresh libc++ header files.)

Some tweaks to the existing NetBSD rule when generalizing:

* Drop `-L$(LLVM_LIBS_DIR)` since Clang driver adds it correctly.
* Add `-stdlib=libc++` only for `USE_LIBCPP`.

Also, drop `-isystem /usr/include/c++/v1` introduced in D9426. It is not needed
by Clang driver. GCC using libc++ requires more setup.

I don't find any test needing `-Wl,-rpath` in `test/Shell/helper/{build,toolchain}.py` (D58630 for NetBSD added them).

Reviewed By: labath

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

3 years ago[llvm] Use pop_back_val (NFC)
Kazu Hirata [Sun, 24 Jan 2021 20:18:57 +0000 (12:18 -0800)]
[llvm] Use pop_back_val (NFC)

3 years ago[Target] Use llvm::append_range (NFC)
Kazu Hirata [Sun, 24 Jan 2021 20:18:55 +0000 (12:18 -0800)]
[Target] Use llvm::append_range (NFC)

3 years ago[CodeGen] Forward-declare TargetMachine (NFC)
Kazu Hirata [Sun, 24 Jan 2021 20:18:54 +0000 (12:18 -0800)]
[CodeGen] Forward-declare TargetMachine (NFC)

InstrEmitter.h needs TargetMachine but relies on a forward declaration
of TargetMachine in MachineOperand.h.  This patch adds a forward
declaration right in InstrEmitter.h.

While we are at it, this patch removes the one in MachineOperand.h,
where it is unnecessary.

3 years ago[RISCV] Use SRLIWPat in the PACKUW pattern.
Craig Topper [Sun, 24 Jan 2021 18:21:49 +0000 (10:21 -0800)]
[RISCV] Use SRLIWPat in the PACKUW pattern.

This makes the code more tolerant if we ever change SimplifyDemandedBits
to not remove 1s from the lsbs of a contiguous mask.

3 years ago[libomptarget][cuda] Fix build, change missed from D95274
Jon Chesterfield [Sun, 24 Jan 2021 18:30:04 +0000 (18:30 +0000)]
[libomptarget][cuda] Fix build, change missed from D95274

3 years ago[OpenMP] Fixed test environment of `check-libomptarget-nvptx`
Shilei Tian [Sun, 24 Jan 2021 18:18:22 +0000 (13:18 -0500)]
[OpenMP] Fixed test environment of `check-libomptarget-nvptx`

D95161 removed the option `--libomptarget-nvptx-path`, which is used in
the tests for `libomptarget-nvptx`.

Reviewed By: jdoerfert

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