platform/upstream/llvm.git
2 years ago[AMDGPU] Pre-commit test for D116469. NFC
Craig Topper [Fri, 14 Jan 2022 16:47:05 +0000 (08:47 -0800)]
[AMDGPU] Pre-commit test for D116469. NFC

The multiply in this test is miscompiled to 0.

Reviewed By: foad

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

2 years ago[InstCombine] add more tests for binop with phi operands; NFC
Sanjay Patel [Fri, 14 Jan 2022 15:13:11 +0000 (10:13 -0500)]
[InstCombine] add more tests for binop with phi operands; NFC

Goes with D117110.

2 years ago[InstCombine] add test for limitation of knownbits with overshift; NFC
Sanjay Patel [Fri, 14 Jan 2022 15:01:11 +0000 (10:01 -0500)]
[InstCombine] add test for limitation of knownbits with overshift; NFC

The tests above this were added for D30781 and used to provide
coverage for a limit of knownbits, but improvements in other
transforms killed that intended purpose. This was noted because
another proposed improvement in D117110 will further reduce
those tests.

2 years ago[Docs] Update opaque pointer docs (NFC)
Nikita Popov [Fri, 14 Jan 2022 16:41:42 +0000 (17:41 +0100)]
[Docs] Update opaque pointer docs (NFC)

Mention -opaque-pointers, write a bit more about migration pitfalls
and update the open issues.

2 years ago[SystemZ][z/OS] ASCII/EBCDIC support with no coexistence
Muiez Ahmed [Fri, 14 Jan 2022 16:35:53 +0000 (11:35 -0500)]
[SystemZ][z/OS] ASCII/EBCDIC support with no coexistence

The aim of this patch is to break up the larger patch (https://reviews.llvm.org/D111323) to be more upstream friendly. In particular, this patch adds the char encoding sensitive changes but does not use inline namespaces as before. The use of namespaces to build both versions of the library, and localization of error messages will follow in a subsequent patch.

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

2 years agoRevert "[MemoryBuiltins] [NFC] Add missing section comments"
Philip Reames [Fri, 14 Jan 2022 16:01:56 +0000 (08:01 -0800)]
Revert "[MemoryBuiltins] [NFC] Add missing section comments"

This reverts commit 83338d5032424741accb1e851408021b47b84c08.  Comments in source are non-idiomatic and naming choice in head is unclear.

2 years ago[LTO] runNewPMPasses - remove check for TM != nullptr as we already dereference the...
Simon Pilgrim [Fri, 14 Jan 2022 16:31:14 +0000 (16:31 +0000)]
[LTO] runNewPMPasses - remove check for TM != nullptr as we already dereference the pointer directly later on in the same code

2 years ago[libc] Update exhaustive testing documentations.
Tue Ly [Fri, 14 Jan 2022 16:08:52 +0000 (11:08 -0500)]
[libc] Update exhaustive testing documentations.

2 years ago[flang] Fix a bug in the `flang` wrapper script
Andrzej Warzynski [Fri, 14 Jan 2022 10:47:39 +0000 (10:47 +0000)]
[flang] Fix a bug in the `flang` wrapper script

Please see
https://github.com/flang-compiler/f18-llvm-project/issues/1344#issuecomment-1012706527
for context and the discussion.

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

2 years ago[LV] Add test with an integer induction based on a ptr one.
Florian Hahn [Fri, 14 Jan 2022 15:56:47 +0000 (15:56 +0000)]
[LV] Add test with an integer induction based on a ptr one.

Reduced test case from the reproducer mentioned in
073c27b5e5851f13d99.

2 years ago[llvm-profgen] ProfiledBinary::load - use cast<> instead of dyn_cast<> to avoid deref...
Simon Pilgrim [Fri, 14 Jan 2022 15:51:21 +0000 (15:51 +0000)]
[llvm-profgen] ProfiledBinary::load - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is always dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[X86] combineConcatVectorOps - fold concat(permilpd(x),permilpd(y)) -> permilpd(conca...
Simon Pilgrim [Fri, 14 Jan 2022 15:43:28 +0000 (15:43 +0000)]
[X86] combineConcatVectorOps - fold concat(permilpd(x),permilpd(y)) -> permilpd(concat(x,y))

2 years ago[X86] combineConcatVectorOps - fold concat(movs*dup(x),movs*dup(y)) -> movs*dup(conca...
Simon Pilgrim [Fri, 14 Jan 2022 15:10:23 +0000 (15:10 +0000)]
[X86] combineConcatVectorOps - fold concat(movs*dup(x),movs*dup(y)) -> movs*dup(concat(x,y))

2 years ago[libc++] _Uglify some template parameter names. NFCI.
Arthur O'Dwyer [Mon, 10 Jan 2022 17:00:10 +0000 (12:00 -0500)]
[libc++] _Uglify some template parameter names. NFCI.

2 years ago[mlir][memref] Fix memref.copy of scalar memref
Stephan Herhut [Fri, 14 Jan 2022 15:01:42 +0000 (16:01 +0100)]
[mlir][memref] Fix memref.copy of scalar memref

Also fix a memory leak in the test while at it.

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

2 years ago[gn build] Port 5726e5598104
LLVM GN Syncbot [Fri, 14 Jan 2022 15:05:57 +0000 (15:05 +0000)]
[gn build] Port 5726e5598104

2 years ago[CGBuiltin] Simplify code. NFCI.
Benjamin Kramer [Fri, 14 Jan 2022 15:02:02 +0000 (16:02 +0100)]
[CGBuiltin] Simplify code. NFCI.

2 years ago[clang][dataflow] Add transfer functions for constructors
Stanislav Gatev [Thu, 13 Jan 2022 13:53:52 +0000 (13:53 +0000)]
[clang][dataflow] Add transfer functions for constructors

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D117218

2 years ago[libc++] Modularize <chrono>
Louis Dionne [Mon, 10 Jan 2022 19:56:43 +0000 (14:56 -0500)]
[libc++] Modularize <chrono>

I didn't split the calendar bits more than this because there was little
benefit to doing it, and I know our calendar support is incomplete.
Whoever picks up the missing calendar bits can organize these headers
at their leisure.

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

2 years ago[msan] Fix typo in test from rGf6875c434ec2
Vitaly Buka [Fri, 14 Jan 2022 14:49:00 +0000 (06:49 -0800)]
[msan] Fix typo in test from rGf6875c434ec2

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

2 years ago[X86] Add tests showing failure to concatenate vmovsldup or vmovshdup nodes
Simon Pilgrim [Fri, 14 Jan 2022 14:49:40 +0000 (14:49 +0000)]
[X86] Add tests showing failure to concatenate vmovsldup or vmovshdup nodes

2 years ago[X86] combineConcatVectorOps - fold concat(movddup(x),movddup(y)) -> movddup(concat...
Simon Pilgrim [Fri, 14 Jan 2022 14:38:45 +0000 (14:38 +0000)]
[X86] combineConcatVectorOps - fold concat(movddup(x),movddup(y)) -> movddup(concat(x,y))

For AVX2+ targets this requires us to also recognise v4f64 concat(broadcast(x),broadcast(y)) -> movddup(concat(x,y))

2 years ago[llvm-profgen] Pass iteration value by reference in for-range loops to avoid unnecess...
Simon Pilgrim [Fri, 14 Jan 2022 14:16:18 +0000 (14:16 +0000)]
[llvm-profgen] Pass iteration value by reference in for-range loops to avoid unnecessary copies

2 years ago[llvm-profgen] CSProfileGenerator::generateLineNumBasedProfile - use cast<> instead...
Simon Pilgrim [Fri, 14 Jan 2022 14:10:07 +0000 (14:10 +0000)]
[llvm-profgen] CSProfileGenerator::generateLineNumBasedProfile - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr

2 years ago[AArch64][SVE] Fix VLS mulh tests to use literal vectors
David Truby [Fri, 14 Jan 2022 14:20:44 +0000 (14:20 +0000)]
[AArch64][SVE] Fix VLS mulh tests to use literal vectors

This is a simple test fix that canonicalises the SVE mulh tests.

2 years ago[NFCI][SCEV] `computeExitLimitFromCondFromBinOp()`: rely on `getSequentialMinMaxExpr...
Roman Lebedev [Fri, 14 Jan 2022 13:43:25 +0000 (16:43 +0300)]
[NFCI][SCEV] `computeExitLimitFromCondFromBinOp()`: rely on `getSequentialMinMaxExpr()` constant relaxation

`getSequentialMinMaxExpr()` has been taught to perform this relaxation,
so rely on that now. Not sure this can be tested.

2 years ago[SCEV] `getSequentialMinMaxExpr()`: relax 2-op umin_seq w/ constant to umin
Roman Lebedev [Fri, 14 Jan 2022 13:42:55 +0000 (16:42 +0300)]
[SCEV] `getSequentialMinMaxExpr()`: relax 2-op umin_seq w/ constant to umin

Currently, `computeExitLimitFromCondFromBinOp()` does that directly.

2 years ago[NFC][SCEV] Add test with umin_seq w/ 1op and constant
Roman Lebedev [Fri, 14 Jan 2022 13:52:54 +0000 (16:52 +0300)]
[NFC][SCEV] Add test with umin_seq w/ 1op and constant

2 years ago[MLIR] NFC. affine data copy generate utility return value cleanup
Uday Bondhugula [Thu, 13 Jan 2022 10:50:11 +0000 (16:20 +0530)]
[MLIR] NFC. affine data copy generate utility return value cleanup

Clean up return value on affineDataCopyGenerate utility. Return the
actual success/failure status instead of the "number of bytes" which
isn't being used in the codebase in any way. The success/failure status
wasn't being sent out earlier.

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

2 years ago[Clang] Add __builtin_reduce_or and __builtin_reduce_and
Jun Zhang [Wed, 5 Jan 2022 09:20:57 +0000 (17:20 +0800)]
[Clang] Add __builtin_reduce_or and __builtin_reduce_and

This patch implements two builtins specified in D111529.
The last __builtin_reduce_add will be seperated into another one.

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

2 years ago[LLDB][NFC] Fix a typo in comment
Coelacanthus [Fri, 14 Jan 2022 08:27:44 +0000 (16:27 +0800)]
[LLDB][NFC] Fix a typo in comment

fix typo in comment: libcstd++ -> libstdc++

Reviewed By: wallace

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

2 years ago[mlir][linalg][bufferize] Support custom insertion point for buffer copies
Matthias Springer [Fri, 14 Jan 2022 13:46:52 +0000 (22:46 +0900)]
[mlir][linalg][bufferize] Support custom insertion point for buffer copies

By default, copies are inserted right before the tensor OpOperand use. With this change, `bufferize` implementation can change the insertion point. This is needed for some ops where it would be illegal to insert a copy right before the use.

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

2 years ago[mlir][memref] Fold self copies
Matthias Springer [Fri, 14 Jan 2022 13:31:01 +0000 (22:31 +0900)]
[mlir][memref] Fold self copies

Fold `memref.copy %x, %x`.

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

2 years ago[clang-format] Add missing test for loops formatting. NFC.
Marek Kurdej [Fri, 14 Jan 2022 13:40:03 +0000 (14:40 +0100)]
[clang-format] Add missing test for loops formatting. NFC.

The case with an inner while loop wasn't tested before. Same for outer loop with a ForeachMacro.

2 years ago[LoopVersioning] Add test case with foldable icmp in runtime check.
Florian Hahn [Fri, 14 Jan 2022 13:42:20 +0000 (13:42 +0000)]
[LoopVersioning] Add test case with foldable icmp in runtime check.

Test case showing a foldable icmp ('icmp ult i8* [[SCEVGEP1]], [[SCEVGEP1]]').
This can be simplified in a follow-up change.

2 years agoRevert "[clangd] Elide even more checks in SelectionTree."
Kadir Cetinkaya [Fri, 14 Jan 2022 13:32:43 +0000 (14:32 +0100)]
Revert "[clangd] Elide even more checks in SelectionTree."

This reverts commit 07f9fb8b51417ec3e6f46508e1b5ef78287b32ad.

2 years ago[mlir][linalg][bufferize] Use memref.copy instead of linalg.copy
Matthias Springer [Fri, 14 Jan 2022 12:57:30 +0000 (21:57 +0900)]
[mlir][linalg][bufferize] Use memref.copy instead of linalg.copy

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

2 years ago[mlir][memref] Implement fast lowering of memref.copy
Stephan Herhut [Fri, 7 Jan 2022 09:00:19 +0000 (10:00 +0100)]
[mlir][memref] Implement fast lowering of memref.copy

In the absence of maps, we can lower memref.copy to a memcpy.

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

2 years ago[DebugInfo][DWARF][NFC] Refactor DWARFTypePrinter usages. Create functions to print...
Alexey Lapshin [Wed, 12 Jan 2022 15:42:48 +0000 (18:42 +0300)]
[DebugInfo][DWARF][NFC] Refactor DWARFTypePrinter usages. Create functions to print type dies.

This patch creates functions which might be used to dump types.
This functionality was already implemented by  DWARFTypePrinter.
Now it could be reused. It will help D96035, which uses DWARFTypePrinter.

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

2 years ago[mlir][memref] Fold copy of cast
Matthias Springer [Fri, 14 Jan 2022 12:50:33 +0000 (21:50 +0900)]
[mlir][memref] Fold copy of cast

If the source/dest is a cast that does not change shape/element type, the cast can be skipped.

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

2 years ago[SCEV] `getSequentialMinMaxExpr()`: rewrite deduplication to be fully recursive
Roman Lebedev [Fri, 14 Jan 2022 12:11:20 +0000 (15:11 +0300)]
[SCEV] `getSequentialMinMaxExpr()`: rewrite deduplication to be fully recursive

Since we don't merge/expand non-sequential umin exprs into umin_seq exprs,
we may have umin_seq(umin(umin_seq())) chain, and the innermost umin_seq
can have duplicate operands still.

2 years ago[clang-format] Fix typos in test. NFC.
Marek Kurdej [Fri, 14 Jan 2022 12:24:16 +0000 (13:24 +0100)]
[clang-format] Fix typos in test. NFC.

2 years ago[RISCV][NFC] Use TableGen 'foreach' to simplify repetitive CSR definitions
Alex Bradbury [Fri, 14 Jan 2022 11:58:27 +0000 (11:58 +0000)]
[RISCV][NFC] Use TableGen 'foreach' to simplify repetitive CSR definitions

Make the definitions of hpmcounter3-hpmcounter31,
hpmcounter3h-hpmcounter31h, mhpmcounter3-mhpmcounter31,
mhpmcounter3h-mhpmcounter31h, pmpaddr0-pmpaddr63, mhpmevent3-31, and
pmpcfg0-15 substantially less repetitive using a foreach loop.

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

2 years ago[mlir] Fix invalid assertion in ModuleTranslation.cpp
Alex Zinenko [Thu, 13 Jan 2022 13:29:09 +0000 (14:29 +0100)]
[mlir] Fix invalid assertion in ModuleTranslation.cpp

LLVM dialect supports terminators with repeated successor blocks that take
different operands. This cannot be directly expressed in LLVM IR though since
it uses the number of the predecessor block to differentiate values in its PHI
nodes. Therefore, the translation to LLVM IR inserts dummy blocks to forward
arguments in case of repeated succesors with arguments. The insertion works
correctly. However, when connecting PHI nodes to their source values, the
assertion of the insertion having worked correctly was incorrect: it would only
trigger if repeated blocks were adjacent in the successor list (not guaranteed
by anything) and would not check if the successors have operands (no need for
dummy blocks in absence of operands since no PHIs are being created). Change
the assertion to only trigger in case of duplicate successors with operands,
and don't expect them to be adjacent.

Reviewed By: wsmoses

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

2 years ago[IRBuilder] Migrate gep-folding to value-based FoldGEP.
Florian Hahn [Fri, 14 Jan 2022 11:23:50 +0000 (11:23 +0000)]
[IRBuilder] Migrate gep-folding to value-based FoldGEP.

Depends on D117038.

Reviewed By: lebedev.ri

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

2 years ago[Verifier] Avoid asserting on invalid cleanuppad chain
Nikita Popov [Fri, 14 Jan 2022 11:08:33 +0000 (12:08 +0100)]
[Verifier] Avoid asserting on invalid cleanuppad chain

The invalid undef value already triggers a verifier failure, but
then the upwards scan from the cleanuppad ends up asserting. Make
sure this is handled gacefully instead.

2 years ago[mlir] Use .empty() instead of checking size() == 0.
Adrian Kuegel [Fri, 14 Jan 2022 10:58:52 +0000 (11:58 +0100)]
[mlir] Use .empty() instead of checking size() == 0.

Based on a finding by ClangTidy readability-container-size-empty check.

2 years ago[llvm-dwp] Simplify FileCheck patterns. NFC.
Jay Foad [Fri, 14 Jan 2022 10:37:55 +0000 (10:37 +0000)]
[llvm-dwp] Simplify FileCheck patterns. NFC.

Take advantage of D117117 to simplify {{\[}}[[ to [[[.

2 years agoUse {LITERAL} instead of regex escaping in some lit tests. NFC.
Jay Foad [Fri, 14 Jan 2022 10:35:03 +0000 (10:35 +0000)]
Use {LITERAL} instead of regex escaping in some lit tests. NFC.

2 years ago[LLDB] Skip TestIOHandlerPythonREPLSigint.py on Arm/Linux
Muhammad Omair Javaid [Fri, 14 Jan 2022 10:46:02 +0000 (15:46 +0500)]
[LLDB] Skip TestIOHandlerPythonREPLSigint.py on Arm/Linux

TestIOHandlerPythonREPLSigint.py is failing on Arm/Linux buildbot. I am
marking it as skip for now.

2 years ago[clang-format] Fix namespace end comments fixer with anonymous namespaces.
Marek Kurdej [Fri, 14 Jan 2022 10:37:04 +0000 (11:37 +0100)]
[clang-format] Fix namespace end comments fixer with anonymous namespaces.

Previously, a strange trailing comment was produced:
```
namespace out { namespace {
}} // namespace out::
```
(mind the "out::").

Reviewed By: MyDeveloperDay, owenpan

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

2 years ago[InstSimplify] Pass pointer and indices separately to SimplifyGEPInst.
Florian Hahn [Fri, 14 Jan 2022 09:59:43 +0000 (09:59 +0000)]
[InstSimplify] Pass pointer and indices separately to SimplifyGEPInst.

This doesn't require callers to put the pointer operand and the indices
in a container like a vector when calling the function. This is not
really an issue with the existing callers. But when using it from
IRBuilder the inputs are available as separate pointer value and indices
ArrayRef.

Reviewed By: lebedev.ri

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

2 years ago[InstCombine] Fold for masked scatters to a uniform address
Caroline Concatto [Mon, 13 Dec 2021 12:03:26 +0000 (12:03 +0000)]
[InstCombine] Fold for masked scatters to a uniform address

When masked scatter intrinsic does a uniform store to a destination
address from a source vector, and in this case, the mask is all one value.
This patch replaces the masked scatter with an extracted element of the
last lane of the source vector and stores it in the destination vector.
This patch also folds when the value in the masked scatter is a splat.
In this case, the mask cannot be all zero, and it folds to a scalar store
of the value in the destination pointer.

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

2 years ago[ConstantFold] Check for uniform value before reinterpret load
Nikita Popov [Fri, 14 Jan 2022 09:07:37 +0000 (10:07 +0100)]
[ConstantFold] Check for uniform value before reinterpret load

The reinterpret load code will convert undef values into zero.
Check the uniform value case before it to produce a better result
for all-undef initializers.

However, the uniform value handling will return the uniform value
even if the access is out of bounds, while the reinterpret load
code will return undef. Add an explicit check to retain the
previous result in this case.

2 years ago[InstSimplify] Add test for load from undef (NFC)
Nikita Popov [Fri, 14 Jan 2022 08:57:03 +0000 (09:57 +0100)]
[InstSimplify] Add test for load from undef (NFC)

If we're loading from an all-undef value, we sometimes still
return zero rather than undef.

2 years ago[GlobalOpt] Add test for SRA with i8 array type (NFC)
Nikita Popov [Fri, 14 Jan 2022 08:51:13 +0000 (09:51 +0100)]
[GlobalOpt] Add test for SRA with i8 array type (NFC)

2 years ago[CMake] Do not override user specified CMAKE_{C,CXX}_ARCHIVE_FINISH on Linux
Fangrui Song [Fri, 14 Jan 2022 09:10:23 +0000 (01:10 -0800)]
[CMake] Do not override user specified CMAKE_{C,CXX}_ARCHIVE_FINISH on Linux

Respect the user choice, e.g. -DCMAKE_CXX_ARCHIVE_FINISH=: (to skip the
(usually) no-op step).

2 years ago[clang-check] Adjust argument adjusters for clang-check to strip options blocking...
Sam McCall [Fri, 14 Jan 2022 07:34:11 +0000 (08:34 +0100)]
[clang-check] Adjust argument adjusters for clang-check to strip options blocking the static analyzer

Output generation options (like `-save-temps`) will make the analyzer not executed even `--analyze` option is provided in the driver arguments.
Besides, the original approach of adding `--analyze` option will not work when (more than one) `-fsyntax-only` options are provided in the driver arguments.

This patch fixes these two problems by using the syntax-only adjuster to remove output generation options and manually filter out redundant `-fsyntax-only` options.

In the new implementation, the adjusters added by `ClangTool` will not be removed but used as dependencies for clang-check adjusters for analyzer options.

Reviewed By: sammccall

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

2 years ago[NFC][CSKY] Remove duplicate setOperationAction in CSKYTargetLowering constructor
Zi Xuan Wu [Fri, 14 Jan 2022 09:01:43 +0000 (17:01 +0800)]
[NFC][CSKY] Remove duplicate setOperationAction in CSKYTargetLowering constructor

2 years agoAdd -fsanitize-address-param-retval to clang.
Kevin Athey [Fri, 14 Jan 2022 08:20:33 +0000 (00:20 -0800)]
Add -fsanitize-address-param-retval to clang.

With the introduction of this flag, it is no longer necessary to enable noundef analysis with 4 separate flags.
(-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1).
This change only covers the introduction into the compiler.

This is a follow up to: https://reviews.llvm.org/D116855

Reviewed By: vitalybuka

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

2 years agoRevert unrelated change from: [clang-format] Fix break being added to macro define...
Marek Kurdej [Fri, 14 Jan 2022 07:43:59 +0000 (08:43 +0100)]
Revert unrelated change from: [clang-format] Fix break being added to macro define with ColumnLimit: 0

2 years ago[clang-format] Fix break being added to macro define with ColumnLimit: 0
Armen Khachkinaev [Thu, 13 Jan 2022 14:49:50 +0000 (15:49 +0100)]
[clang-format] Fix break being added to macro define with ColumnLimit: 0

Fix for #[[ https://github.com/llvm/llvm-project/issues/49164 | 49164 ]] issue.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, curdeius, owenpan

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

2 years ago[NFC] [Coroutines] Refactor implementation in checkFinalSuspendNoThrow
Chuanqi Xu [Fri, 14 Jan 2022 07:37:01 +0000 (15:37 +0800)]
[NFC] [Coroutines] Refactor implementation in checkFinalSuspendNoThrow

Now when we are checking if the expression `co_await
promise.final_suspend()` is not throw, we would check unconditionally
for its child expressions recursively. It takes unnecessary time. And
the compiler would complains if the implementation in final_suspend()
may throw even if the higher level function signature marked noexcept
already.

This fixes bug48453 too.

2 years agoFix a comment in CMake (NFC)
Mehdi Amini [Fri, 14 Jan 2022 07:33:06 +0000 (07:33 +0000)]
Fix a comment in CMake (NFC)

2 years agoDo not build llc and mlir-cpu-runner to run MLIR tests with the native target isn...
Mehdi Amini [Fri, 14 Jan 2022 07:29:50 +0000 (07:29 +0000)]
Do not build llc and mlir-cpu-runner to run MLIR tests with the native target isn't configured (NFC)

The relevant tests are already disabled in this case.

2 years ago[mlir] Expose a function to get vector::CombiningKind from Operation*.
Alexander Belyaev [Fri, 14 Jan 2022 07:23:27 +0000 (08:23 +0100)]
[mlir] Expose a function to get vector::CombiningKind from Operation*.

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

2 years agoMark some MLIR tests as requiring the native target to be configured
Mehdi Amini [Fri, 14 Jan 2022 06:57:51 +0000 (06:57 +0000)]
Mark some MLIR tests as requiring the native target to be configured

This makes `ninja check-mlir` work without the host targets configured.

2 years ago[Attributor] [NFC] Use canonical variable name
Bryce Wilson [Fri, 14 Jan 2022 07:06:00 +0000 (23:06 -0800)]
[Attributor] [NFC] Use canonical variable name

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

2 years ago[BOLT][NFC] Refactor reset-release to move assignment
Amir Ayupov [Wed, 23 Jun 2021 22:10:47 +0000 (15:10 -0700)]
[BOLT][NFC] Refactor reset-release to move assignment

Summary:
Follow the clang-tidy suggestion to replace reset-release with move assignment.

Move assignment's effect for unique_ptr:
> Effects: Transfers ownership from `u` to `*this` as if by calling `reset(u.release())`
followed by an assignment from `std::forward<D>(u.get_deleter())`.

2 years ago[BOLT][NFC] Remove uses of `std::vector<bool>`
Amir Ayupov [Thu, 13 Jan 2022 21:48:51 +0000 (13:48 -0800)]
[BOLT][NFC] Remove uses of `std::vector<bool>`

Summary:
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>`
and suggests `llvm::BitVector` as a possible replacement.

2 years agoPartially revert cac7aabbd82: some APIs don't have in-tree users and some build break...
Mehdi Amini [Fri, 14 Jan 2022 06:14:56 +0000 (06:14 +0000)]
Partially revert cac7aabbd82: some APIs don't have in-tree users and some build breaks weren't caught

2 years ago[bazel] Separate capi_deps from deps in mlir_c_api_cc_library.
Stella Laurenzo [Thu, 13 Jan 2022 01:35:29 +0000 (01:35 +0000)]
[bazel] Separate capi_deps from deps in mlir_c_api_cc_library.

This is important because *Objects targets need to only depend on other *Objects targets, not on the unsuffixed CAPI rules. Depending on how it is linked in the current setup, it can cause duplicate symbols.

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

2 years ago[RISCV] Improve i64 splat vector lowering in RV32.
jacquesguan [Tue, 4 Jan 2022 07:41:44 +0000 (15:41 +0800)]
[RISCV] Improve i64 splat vector lowering in RV32.

We could use vmv.v.i/vmv.v.x whose eew is 32 to lower the i64 splat vector if the i64 constant scalar could be splitted into two same i32 scalar.

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

2 years ago[RISCV] Add more i64 splat vector test.
jacquesguan [Tue, 4 Jan 2022 08:28:05 +0000 (16:28 +0800)]
[RISCV] Add more i64 splat vector test.

Precommit test for D117079.

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

2 years ago[RISCV] Remove unused check prefixes. NFC
Craig Topper [Fri, 14 Jan 2022 06:02:04 +0000 (22:02 -0800)]
[RISCV] Remove unused check prefixes. NFC

2 years ago[NFC][msan] Init few vars later
Vitaly Buka [Fri, 14 Jan 2022 02:56:13 +0000 (18:56 -0800)]
[NFC][msan] Init few vars later

2 years ago[RISCV] Add basic Zfh inline assembly tests. NFC
Craig Topper [Fri, 14 Jan 2022 05:51:50 +0000 (21:51 -0800)]
[RISCV] Add basic Zfh inline assembly tests. NFC

The abi name test shows incorrect fcvt.d.h, fcvt.h.d, fcvt.f.h,
and fcvt.h.f instructions around the inline assembly.

2 years ago[RISCV] Add inline asm f32 test cases with D extension. NFC
Craig Topper [Fri, 14 Jan 2022 05:34:15 +0000 (21:34 -0800)]
[RISCV] Add inline asm f32 test cases with D extension. NFC

Using named registers as input or output constraints creates fcvt.d.s
and fcvt.s.d instructions around the inline assembly.

This makes the data unusable by the inline assembly and corrupts
the results of the inline assembly.

2 years agoFix registers for Windows on ARM64
Nenad Mikša [Fri, 14 Jan 2022 05:36:57 +0000 (21:36 -0800)]
Fix registers for Windows on ARM64

Reviewed By: #sanitizers, vitalybuka

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

2 years ago[NFC][msan] Declare some getShadow vars later
Vitaly Buka [Thu, 13 Jan 2022 23:53:57 +0000 (15:53 -0800)]
[NFC][msan] Declare some getShadow vars later

2 years ago[Polly][CMake] Make PollyConfig.cmake relocatable like other projects'
John Ericson [Mon, 3 Jan 2022 21:09:33 +0000 (21:09 +0000)]
[Polly][CMake] Make PollyConfig.cmake relocatable like other projects'

This builds on D116521 to add this functionality to Polly without more copy-pasted code.

Reviewed By: beanz

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

2 years ago[MS] Implement on-demand TLS initialization for Microsoft CXX ABI
Maurice Heumann [Thu, 13 Jan 2022 02:26:30 +0000 (18:26 -0800)]
[MS] Implement on-demand TLS initialization for Microsoft CXX ABI

TLS initializers, for example constructors of thread-local variables, don't necessarily get called. If a thread was created before a module is loaded, the module's TLS initializers are not executed for this particular thread.

This is why Microsoft added support for dynamic TLS initialization. Before every use of thread-local variables, a check is added that runs the module's TLS initializers on-demand.

To do this, the method `__dyn_tls_on_demand_init` gets called. Internally, it simply calls `__dyn_tls_init`.

No additional TLS initializer that sets the guard needs to be emitted, as the guard always gets set by `__dyn_tls_init`.
The guard is also checked again within `__dyn_tls_init`. This makes our check redundant, however, as Microsoft's compiler also emits this check, the behaviour is adopted here.

Reviewed By: majnemer

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

2 years ago[mlir] Optimize OperationName construction and usage
River Riddle [Thu, 13 Jan 2022 07:46:59 +0000 (23:46 -0800)]
[mlir] Optimize OperationName construction and usage

When constructing an OperationName, the overwhelming majority of
cases are from registered operations. This revision adds a non-locked
lookup into the currently registered operations, which prevents locking
in the common case. This revision also optimizes several uses of
RegisteredOperationName that expect the operation to be registered,
e.g. such as in OpBuilder.

These changes provides a reasonable speedup (5-10%) in some
compilations, especially on platforms where locking is expensive.

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

2 years agoRevert "GlobalISel: Add G_ASSERT_ALIGN hint instruction"
James Y Knight [Fri, 14 Jan 2022 04:49:17 +0000 (04:49 +0000)]
Revert "GlobalISel: Add G_ASSERT_ALIGN hint instruction"

This commit sometimes causes a crash when compiling a vtable thunk. E.g.:

clang '--target=aarch64-grtev4-linux-gnu' -xc++ - -c -o /dev/null <<EOF
struct a {
  virtual int f();
};
struct c {
  virtual int &g() const;
};
struct d : a, c {
  int &g() const;
};
int &d::g() const {}
EOF

Some follow-up commits have been reverted as well:
Revert "IR: Make getRetAlign check callee function attributes"
Revert "Fix MSVC "32-bit shift implicitly converted to 64 bits" warning. NFC."
Revert "Fix MSVC "32-bit shift implicitly converted to 64 bits" warning. NFC."

This reverts commit 4f414af6a77cdbd9b6303a7afa525cfb3f9d792a.
This reverts commit a5507d2e253a2c94c3ca7794edf7385af8082b97.
This reverts commit 3d2d208f6a0a421b23937c39b9d371183a5913a3.
This reverts commit 07ddfa95e3b5ea8464e90545f592624221b854ae.

2 years ago[libc++] LWG3171: implement operator<< for filesystem::directory_entry.
Konstantin Varlamov [Fri, 14 Jan 2022 04:44:01 +0000 (20:44 -0800)]
[libc++] LWG3171: implement operator<< for filesystem::directory_entry.

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

2 years ago[mlir][sparse] Moving the sort from factory method to the constructor.
wren romano [Fri, 14 Jan 2022 01:46:30 +0000 (17:46 -0800)]
[mlir][sparse] Moving the sort from factory method to the constructor.

This guarantees the preconditions of fromCOO; whereas prior to this, one could call the constructor directly with an unsorted tensor, which would cause fromCOO to misbehave.

Reviewed By: aartbik

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

2 years ago[NFC] Apply the fix for different signedness warning in OpenMPIRBuilderTest.cpp
Peixin-Qiao [Fri, 14 Jan 2022 02:49:21 +0000 (10:49 +0800)]
[NFC] Apply the fix for different signedness warning in OpenMPIRBuilderTest.cpp

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

2 years ago[libc] Fix precision constants for long double in MPFRUtils.cpp.
Tue Ly [Fri, 14 Jan 2022 02:31:42 +0000 (21:31 -0500)]
[libc] Fix precision constants for long double in MPFRUtils.cpp.

2 years agoApply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:36:05 +0000 (01:36 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:36:04 +0000 (01:36 +0000)]
Apply clang-tidy fixes for readability-identifier-naming to MLIR (NFC)

2 years agoApply clang-tidy fixes for readability-avoid-const-params-in-decls to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:56 +0000 (01:35 +0000)]
Apply clang-tidy fixes for readability-avoid-const-params-in-decls to MLIR (NFC)

2 years agoApply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:55 +0000 (01:35 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC)

2 years agoApply clang-tidy fixes for performance-move-const-arg to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:44 +0000 (01:35 +0000)]
Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC)

2 years agoApply clang-tidy fixes for performance-for-range-copy to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:41 +0000 (01:35 +0000)]
Apply clang-tidy fixes for performance-for-range-copy to MLIR (NFC)

2 years agoApply clang-tidy fixes for modernize-use-using to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:39 +0000 (01:35 +0000)]
Apply clang-tidy fixes for modernize-use-using to MLIR (NFC)

2 years agoApply clang-tidy fixes for modernize-use-override to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:38 +0000 (01:35 +0000)]
Apply clang-tidy fixes for modernize-use-override to MLIR (NFC)

2 years agoApply clang-tidy fixes for modernize-use-equals-default to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:35 +0000 (01:35 +0000)]
Apply clang-tidy fixes for modernize-use-equals-default to MLIR (NFC)

2 years agoApply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:30 +0000 (01:35 +0000)]
Apply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC)

2 years agoApply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)
Mehdi Amini [Fri, 14 Jan 2022 01:35:24 +0000 (01:35 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)

2 years ago[C++20] [Modules] Exit early if export decl is not valid
Chuanqi Xu [Fri, 14 Jan 2022 02:21:42 +0000 (10:21 +0800)]
[C++20] [Modules] Exit early if export decl is not valid

This patch fixes a crash due to following simple program:
> export struct Unit {
>    bool operator<(const Unit&);
> };

It would crash since the compiler would set the module ownership for
Unit. And the declaration with a module ownership is assumed to own a
module. But here isn't one. So here is the crash.

This patch fixes this by exiting early if it finds the export decl is
already invalid.

Reviewed By: aaron.ballman

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